Created
February 9, 2022 17:14
-
-
Save kelly-tock/388908235696d7107aff0addacc5e41f to your computer and use it in GitHub Desktop.
example test renderer syntax
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('<WalkinWaitlistActionCard />', () => { | |
const defaultBusiness = { | |
id: 123, | |
domainName: 'testWalkinWaitlist', | |
onlineWalkinWaitlistEnabled: true, | |
}; | |
function createBaseTestRenderer() { | |
return testRender() | |
.enableFeatureFlag(['ONLINE_WALKIN_WAITLIST', 'ONLINE_WALKIN_WAITLIST_POSITION']) | |
.setStoreState('app', { | |
...initialAppState, | |
config: { | |
...initialAppState.config, | |
business: defaultBusiness, | |
}, | |
}); | |
} | |
it('Shows action card for waitlisted parties', () => { | |
const { container } = createBaseTestRenderer() | |
.dispatchAction({ | |
type: AppConstants.WALK_IN_WAITLIST_ADD_DONE, | |
payload: { | |
businessId: 123, | |
partyId: -12, | |
serviceDate: LocalDate.now().toString(), | |
}, | |
}) | |
.render(<WalkinWaitlistActionCard business={defaultBusiness} className="actionCard-test" />); | |
expect(container.firstChild).toMatchSnapshot(); | |
}); | |
it('Shows action card for non-waitlisted parties', () => { | |
const { container } = createBaseTestRenderer().render( | |
<WalkinWaitlistActionCard business={defaultBusiness} className="actionCard-test" /> | |
); | |
expect(container.firstChild).toMatchSnapshot(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment