@@ -19,6 +19,12 @@ import {
1919 oracleEpmDataStatusSchema ,
2020 projectOracleEpmDataResult ,
2121} from '@/lib/internal/oracle-epm-data/contracts'
22+ import { executeOracleEpmDataExportDataIntegrationOperation } from '@/lib/internal/oracle-epm-data/operations/export-data-integration'
23+ import { executeOracleEpmDataImportMappingsOperation } from '@/lib/internal/oracle-epm-data/operations/import-mappings'
24+ import { executeOracleEpmDataRunDataRuleOperation } from '@/lib/internal/oracle-epm-data/operations/run-data-rule'
25+ import { executeOracleEpmDataRunIntegrationOperation } from '@/lib/internal/oracle-epm-data/operations/run-integration'
26+ import { executeOracleEpmDataRunPipelineOperation } from '@/lib/internal/oracle-epm-data/operations/run-pipeline'
27+ import { executeOracleEpmDataSetPovLockOperation } from '@/lib/internal/oracle-epm-data/operations/set-pov-lock'
2228
2329const auth = {
2430 oauthCredential : 'credential' ,
@@ -83,6 +89,135 @@ describe('Data Integration foundation contracts', () => {
8389 expect ( mocks . fetch ) . not . toHaveBeenCalled ( )
8490 } )
8591
92+ it . each ( [
93+ {
94+ name : 'integration' ,
95+ run : ( ) =>
96+ executeOracleEpmDataRunIntegrationOperation ( {
97+ ...auth ,
98+ jobName : 'Load' ,
99+ periodName : '{Jan-26}' ,
100+ importMode : 'Replace' ,
101+ exportMode : 'Merge' ,
102+ } ) ,
103+ body : {
104+ jobType : 'INTEGRATION' ,
105+ jobName : 'Load' ,
106+ periodName : '{Jan-26}' ,
107+ importMode : 'Replace' ,
108+ exportMode : 'Merge' ,
109+ } ,
110+ response : { synthetic : 'opaque response' } ,
111+ } ,
112+ {
113+ name : 'pipeline' ,
114+ run : ( ) => executeOracleEpmDataRunPipelineOperation ( { ...auth , pipelineCode : 'Load26' } ) ,
115+ body : { jobType : 'PIPELINE' , jobName : 'Load26' } ,
116+ response : { synthetic : 'opaque response' } ,
117+ } ,
118+ {
119+ name : 'data rule' ,
120+ run : ( ) =>
121+ executeOracleEpmDataRunDataRuleOperation ( {
122+ ...auth ,
123+ jobName : 'Rule' ,
124+ startPeriod : 'Jan-26' ,
125+ endPeriod : 'Jan-26' ,
126+ importMode : 'APPEND' ,
127+ exportMode : 'NONE' ,
128+ } ) ,
129+ body : {
130+ jobType : 'DATARULE' ,
131+ jobName : 'Rule' ,
132+ startPeriod : 'Jan-26' ,
133+ endPeriod : 'Jan-26' ,
134+ importMode : 'APPEND' ,
135+ exportMode : 'NONE' ,
136+ } ,
137+ response : { status : 0 , jobId : 42 } ,
138+ } ,
139+ {
140+ name : 'mapping import' ,
141+ run : ( ) =>
142+ executeOracleEpmDataImportMappingsOperation ( {
143+ ...auth ,
144+ dimension : 'ALL' ,
145+ fileName : 'map.csv' ,
146+ } ) ,
147+ body : { jobType : 'MAPPINGIMPORT' , jobName : 'ALL' , fileName : 'map.csv' } ,
148+ response : { status : 0 , jobId : 42 } ,
149+ } ,
150+ {
151+ name : 'snapshot export' ,
152+ run : ( ) =>
153+ executeOracleEpmDataExportDataIntegrationOperation ( {
154+ ...auth ,
155+ snapshotType : 'ALL' ,
156+ fileName : 'snapshot.zip' ,
157+ } ) ,
158+ body : { action : 'EXPORT' , snapshotType : 'ALL' , fileName : 'snapshot.zip' } ,
159+ response : { status : 0 , jobId : 42 } ,
160+ } ,
161+ {
162+ name : 'application POV lock' ,
163+ run : ( ) =>
164+ executeOracleEpmDataSetPovLockOperation ( {
165+ ...auth ,
166+ period : 'Jan-26' ,
167+ category : 'Actual' ,
168+ application : 'Plan' ,
169+ lockType : 'application' ,
170+ lockOperation : 'lock' ,
171+ } ) ,
172+ body : {
173+ period : 'Jan-26' ,
174+ category : 'Actual' ,
175+ application : 'Plan' ,
176+ locktype : 'application' ,
177+ operation : 'lock' ,
178+ } ,
179+ response : { status : 0 , response : 'Synthetic result' } ,
180+ } ,
181+ ] ) (
182+ 'serializes $name without absent optional fields through the real foundation' ,
183+ async ( { run, body, response } ) => {
184+ mocks . fetch . mockResolvedValue ( Response . json ( response ) )
185+ expect ( await run ( ) ) . toMatchObject ( { success : true } )
186+ expect ( mocks . fetch ) . toHaveBeenCalledTimes ( 1 )
187+ expect ( JSON . parse ( mocks . fetch . mock . calls [ 0 ] [ 2 ] . body ) ) . toEqual ( body )
188+ }
189+ )
190+
191+ it ( 'preserves explicit false and empty option values at the transport boundary' , async ( ) => {
192+ mocks . fetch . mockImplementation ( async ( ) => Response . json ( { status : 0 , jobId : 42 } ) )
193+ expect (
194+ await executeOracleEpmDataImportMappingsOperation ( {
195+ ...auth ,
196+ dimension : 'ALL' ,
197+ fileName : 'map.csv' ,
198+ validationMode : false ,
199+ } )
200+ ) . toMatchObject ( { success : true } )
201+ expect ( JSON . parse ( mocks . fetch . mock . calls [ 0 ] [ 2 ] . body ) ) . toEqual ( {
202+ jobType : 'MAPPINGIMPORT' ,
203+ jobName : 'ALL' ,
204+ fileName : 'map.csv' ,
205+ validationMode : false ,
206+ } )
207+ expect (
208+ await executeOracleEpmDataRunPipelineOperation ( {
209+ ...auth ,
210+ pipelineCode : 'Load26' ,
211+ variables : { OPTIONAL : '' } ,
212+ } )
213+ ) . toMatchObject ( { success : true } )
214+ expect ( JSON . parse ( mocks . fetch . mock . calls [ 1 ] [ 2 ] . body ) ) . toEqual ( {
215+ jobType : 'PIPELINE' ,
216+ jobName : 'Load26' ,
217+ variables : { OPTIONAL : '' } ,
218+ } )
219+ } )
220+
86221 it ( 'normalizes documented numeric strings without inventing missing job IDs' , ( ) => {
87222 expect ( oracleEpmDataJobSchema . parse ( { status : '-1' , jobId : 42 , outputFileName : null } ) ) . toEqual (
88223 { status : - 1 , jobId : '42' , details : null , outputFileName : null }
0 commit comments