File tree Expand file tree Collapse file tree
src/flows/ContractorOnboarding Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -389,6 +389,8 @@ export const useContractorSubscriptionSchemaField = (
389389 } ,
390390 } ) ;
391391
392+ const isEmptyContractorSubscriptions = contractorSubscriptions ?. length === 0 ;
393+
392394 const isOnlyCORSubscription =
393395 contractorSubscriptions ?. length === 1 &&
394396 contractorSubscriptions [ 0 ] . product . short_name === 'COR' ;
@@ -401,7 +403,9 @@ export const useContractorSubscriptionSchemaField = (
401403 corSubscription ?. eligibility_questionnaire ?. is_blocking ;
402404
403405 const showEorSubscription =
404- ( isOnlyCORSubscription || isEligibilityQuestionnaireBlocked === true ) &&
406+ ( isOnlyCORSubscription ||
407+ isEligibilityQuestionnaireBlocked === true ||
408+ isEmptyContractorSubscriptions ) &&
405409 selectedCountry ?. eor_onboarding ;
406410
407411 const { eorSubscription, isLoading : isLoadingEorSubscription } =
Original file line number Diff line number Diff line change @@ -2286,6 +2286,47 @@ describe('ContractorOnboardingFlow', () => {
22862286 } ) ;
22872287 } ) ;
22882288
2289+ it ( 'should show Employer of Record option when contractor subscriptions are empty' , async ( ) => {
2290+ server . use (
2291+ http . get (
2292+ '*/v1/contractors/employments/*/contractor-subscriptions' ,
2293+ ( ) => {
2294+ return HttpResponse . json ( {
2295+ data : [ ] ,
2296+ } ) ;
2297+ } ,
2298+ ) ,
2299+ ) ;
2300+
2301+ mockRender . mockImplementation (
2302+ createMockRenderImplementation ( MultiStepFormWithoutCountry ) ,
2303+ ) ;
2304+
2305+ render (
2306+ < ContractorOnboardingFlow
2307+ { ...defaultProps }
2308+ countryCode = 'PRT'
2309+ skipSteps = { [ 'select_country' ] }
2310+ /> ,
2311+ { wrapper : TestProviders } ,
2312+ ) ;
2313+
2314+ await screen . findByText ( / S t e p : B a s i c I n f o r m a t i o n / i) ;
2315+ await fillBasicInformation ( ) ;
2316+
2317+ const nextButton = screen . getByText ( / N e x t S t e p / i) ;
2318+ nextButton . click ( ) ;
2319+
2320+ await screen . findByText ( / S t e p : P r i c i n g P l a n / i) ;
2321+
2322+ await waitFor ( ( ) => {
2323+ const eorOption = screen . getByRole ( 'radio' , {
2324+ name : / E m p l o y e r o f R e c o r d / i,
2325+ } ) ;
2326+ expect ( eorOption ) . toBeInTheDocument ( ) ;
2327+ } ) ;
2328+ } ) ;
2329+
22892330 it ( 'should NOT show Employer of Record option when eor_onboarding is false' , async ( ) => {
22902331 server . use (
22912332 http . get ( '*/v1/countries' , ( ) => {
You can’t perform that action at this time.
0 commit comments