@@ -703,48 +703,130 @@ describe('Oracle Fusion HCM payroll, compensation, talent, and time', () => {
703703 }
704704
705705 it ( 'reads historical payroll relationships without current worker-directory membership' , async ( ) => {
706- mocks . requestOracleFusionJson . mockResolvedValueOnce ( collection ( [ { PayrollRelationshipId : '9007199254740993' , PersonNumber : '0007' , EffectiveStartDate : '2001-01-01' } ] ) )
707- const result = await operations . executeOracleFusionHcmListPayrollRelationships ( { ...auth , personNumber : '0007' , effectiveDate : '2001-01-01' } )
706+ mocks . requestOracleFusionJson . mockResolvedValueOnce (
707+ collection ( [
708+ {
709+ PayrollRelationshipId : '9007199254740993' ,
710+ PersonNumber : '0007' ,
711+ EffectiveStartDate : '2001-01-01' ,
712+ } ,
713+ ] )
714+ )
715+ const result = await operations . executeOracleFusionHcmListPayrollRelationships ( {
716+ ...auth ,
717+ personNumber : '0007' ,
718+ effectiveDate : '2001-01-01' ,
719+ } )
708720 expect ( mocks . requestOracleFusionJson ) . toHaveBeenCalledOnce ( )
709- expect ( lastRequest ( ) ) . toMatchObject ( { address : { family : 'hcm' , relativePath : 'payrollRelationships' } , query : { q : "PersonNumber='0007'" , effectiveDate : '2001-01-01' , limit : 20 , offset : 0 } } )
721+ expect ( lastRequest ( ) ) . toMatchObject ( {
722+ address : { family : 'hcm' , relativePath : 'payrollRelationships' } ,
723+ query : { q : "PersonNumber='0007'" , effectiveDate : '2001-01-01' , limit : 20 , offset : 0 } ,
724+ } )
710725 expect ( result . output . payrollRelationships [ 0 ] . payrollRelationshipId ) . toBe ( '9007199254740993' )
711726 } )
712727
713728 it ( 'keeps payroll assignment identity distinct from HR assignment identity and bounds child pages' , async ( ) => {
714729 mocks . requestOracleFusionJson
715- . mockResolvedValueOnce ( discovery ( 'payrollRelationships' , 'PayrollRelationshipId' , '1' , 'relationship%20key' ) )
716- . mockResolvedValueOnce ( collection ( [ { RelationshipGroupId : '9007199254740993' , AssignmentId : '9007199254740995' , AssignmentNumber : 'E7' , TimeCardRequired : 'Y' } ] , { limit : 10 , offset : 30 , hasMore : true } ) )
717- const result = await operations . executeOracleFusionHcmListPayrollAssignments ( { ...auth , payrollRelationshipId : '1' , effectiveDate : '2020-01-01' , limit : 10 , offset : 30 } )
718- expect ( lastRequest ( ) ) . toMatchObject ( { address : { relativePath : 'payrollRelationships/relationship%20key/child/payrollAssignments' } , query : { limit : 10 , offset : 30 , effectiveDate : '2020-01-01' } } )
719- expect ( result . output . payrollAssignments [ 0 ] ) . toMatchObject ( { payrollAssignmentId : '9007199254740993' , assignmentId : '9007199254740995' , timeCardRequired : 'Y' } )
730+ . mockResolvedValueOnce (
731+ discovery ( 'payrollRelationships' , 'PayrollRelationshipId' , '1' , 'relationship%20key' )
732+ )
733+ . mockResolvedValueOnce (
734+ collection (
735+ [
736+ {
737+ RelationshipGroupId : '9007199254740993' ,
738+ AssignmentId : '9007199254740995' ,
739+ AssignmentNumber : 'E7' ,
740+ TimeCardRequired : 'Y' ,
741+ } ,
742+ ] ,
743+ { limit : 10 , offset : 30 , hasMore : true }
744+ )
745+ )
746+ const result = await operations . executeOracleFusionHcmListPayrollAssignments ( {
747+ ...auth ,
748+ payrollRelationshipId : '1' ,
749+ effectiveDate : '2020-01-01' ,
750+ limit : 10 ,
751+ offset : 30 ,
752+ } )
753+ expect ( lastRequest ( ) ) . toMatchObject ( {
754+ address : { relativePath : 'payrollRelationships/relationship%20key/child/payrollAssignments' } ,
755+ query : { limit : 10 , offset : 30 , effectiveDate : '2020-01-01' } ,
756+ } )
757+ expect ( result . output . payrollAssignments [ 0 ] ) . toMatchObject ( {
758+ payrollAssignmentId : '9007199254740993' ,
759+ assignmentId : '9007199254740995' ,
760+ timeCardRequired : 'Y' ,
761+ } )
720762 expect ( result . output . nextOffset ) . toBe ( 31 )
721763 expect ( mocks . requestOracleFusionJson ) . toHaveBeenCalledTimes ( 2 )
722764 } )
723765
724766 it . each ( [
725767 collection ( [ ] , { limit : 2 } ) ,
726- collection ( [ { PayrollRelationshipId : '9' , links : self ( 'payrollRelationships/key' ) } ] , { limit : 2 } ) ,
768+ collection ( [ { PayrollRelationshipId : '9' , links : self ( 'payrollRelationships/key' ) } ] , {
769+ limit : 2 ,
770+ } ) ,
727771 collection ( [ { PayrollRelationshipId : '1' , links : self ( 'publicWorkers/key' ) } ] , { limit : 2 } ) ,
728- collection ( [ { PayrollRelationshipId : '1' , links : self ( 'payrollRelationships/key' ) } ] , { limit : 2 , hasMore : true } ) ,
729- ] ) ( 'rejects missing, mismatched, foreign-parent, or ambiguous payroll resolution' , async ( response ) => {
730- mocks . requestOracleFusionJson . mockResolvedValueOnce ( response )
731- await expect ( operations . executeOracleFusionHcmListPayrollAssignments ( { ...auth , payrollRelationshipId : '1' } ) ) . rejects . toBeInstanceOf ( OracleFusionProviderError )
732- expect ( mocks . requestOracleFusionJson ) . toHaveBeenCalledOnce ( )
733- } )
772+ collection ( [ { PayrollRelationshipId : '1' , links : self ( 'payrollRelationships/key' ) } ] , {
773+ limit : 2 ,
774+ hasMore : true ,
775+ } ) ,
776+ ] ) (
777+ 'rejects missing, mismatched, foreign-parent, or ambiguous payroll resolution' ,
778+ async ( response ) => {
779+ mocks . requestOracleFusionJson . mockResolvedValueOnce ( response )
780+ await expect (
781+ operations . executeOracleFusionHcmListPayrollAssignments ( {
782+ ...auth ,
783+ payrollRelationshipId : '1' ,
784+ } )
785+ ) . rejects . toBeInstanceOf ( OracleFusionProviderError )
786+ expect ( mocks . requestOracleFusionJson ) . toHaveBeenCalledOnce ( )
787+ }
788+ )
734789
735790 it ( 'creates assigned payroll with all required dates and an exact numeric payroll ID' , async ( ) => {
736791 const assignmentPath = 'payrollRelationships/rel/child/payrollAssignments/asg'
737792 mocks . requestOracleFusionJson
738793 . mockResolvedValueOnce ( discovery ( 'payrollRelationships' , 'PayrollRelationshipId' , '1' , 'rel' ) )
739- . mockResolvedValueOnce ( discovery ( 'payrollRelationships/rel/child/payrollAssignments' , 'RelationshipGroupId' , '2' , 'asg' ) )
740- . mockResolvedValueOnce ( { AssignedPayrollId : '3' , PayrollId : '9223372036854775807' , links : self ( `${ assignmentPath } /child/assignedPayrolls/new` ) } )
741- await operations . executeOracleFusionHcmCreateAssignedPayroll ( { ...auth , payrollRelationshipId : '1' , payrollAssignmentId : '2' , payrollId : '9223372036854775807' , effectiveStartDate : '2026-01-01' , effectiveEndDate : '4712-12-31' , startDate : '2026-01-01' , endDate : '4712-12-31' } )
742- expect ( lastRequest ( ) ) . toMatchObject ( { address : { relativePath : `${ assignmentPath } /child/assignedPayrolls` } , method : 'POST' , mediaType : 'application/json' } )
743- expect ( serializeOracleFusionJsonBody ( lastRequest ( ) . body ) ) . toBe ( '{"PayrollId":9223372036854775807,"EffectiveStartDate":"2026-01-01","EffectiveEndDate":"4712-12-31","StartDate":"2026-01-01","EndDate":"4712-12-31"}' )
794+ . mockResolvedValueOnce (
795+ discovery (
796+ 'payrollRelationships/rel/child/payrollAssignments' ,
797+ 'RelationshipGroupId' ,
798+ '2' ,
799+ 'asg'
800+ )
801+ )
802+ . mockResolvedValueOnce ( {
803+ AssignedPayrollId : '3' ,
804+ PayrollId : '9223372036854775807' ,
805+ links : self ( `${ assignmentPath } /child/assignedPayrolls/new` ) ,
806+ } )
807+ await operations . executeOracleFusionHcmCreateAssignedPayroll ( {
808+ ...auth ,
809+ payrollRelationshipId : '1' ,
810+ payrollAssignmentId : '2' ,
811+ payrollId : '9223372036854775807' ,
812+ effectiveStartDate : '2026-01-01' ,
813+ effectiveEndDate : '4712-12-31' ,
814+ startDate : '2026-01-01' ,
815+ endDate : '4712-12-31' ,
816+ } )
817+ expect ( lastRequest ( ) ) . toMatchObject ( {
818+ address : { relativePath : `${ assignmentPath } /child/assignedPayrolls` } ,
819+ method : 'POST' ,
820+ mediaType : 'application/json' ,
821+ } )
822+ expect ( serializeOracleFusionJsonBody ( lastRequest ( ) . body ) ) . toBe (
823+ '{"PayrollId":9223372036854775807,"EffectiveStartDate":"2026-01-01","EffectiveEndDate":"4712-12-31","StartDate":"2026-01-01","EndDate":"4712-12-31"}'
824+ )
744825 } )
745826
746827 it ( 'updates only assigned-payroll fields and sends an explicit effective-dating header' , async ( ) => {
747- const collectionPath = 'payrollRelationships/rel/child/payrollAssignments/asg/child/assignedPayrolls'
828+ const collectionPath =
829+ 'payrollRelationships/rel/child/payrollAssignments/asg/child/assignedPayrolls'
748830 mocks . requestOracleFusionJson
749831 . mockResolvedValueOnce ( discovery ( 'payrollRelationships' , 'PayrollRelationshipId' , '1' , 'rel' ) )
750832 . mockResolvedValueOnce ( discovery ( 'payrollRelationships/rel/child/payrollAssignments' , 'RelationshipGroupId' , '2' , 'asg' ) )
0 commit comments