Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coaching Page - Add person's name #1116

Merged
merged 4 commits into from
Oct 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ describe('SuggestedContactStatus', () => {
});

it('renders suggested status when single contact and checks contact status with gql call', async () => {
const { findByText } = render(
const { getByText } = render(
<Components
suggestedContactStatus={StatusEnum.ContactForAppointment}
contactIds={['contact-1']}
Expand All @@ -114,16 +114,16 @@ describe('SuggestedContactStatus', () => {
);
await waitFor(() => {
expect(mutationSpy).toHaveBeenCalledTimes(2);
expect(mutationSpy.mock.calls[0][0].operation).toMatchObject({
operationName: 'ContactStatus',
variables: {
accountListId: accountListId,
contactId: 'contact-1',
},
expect(mutationSpy).toHaveGraphqlOperation('ContactStatus', {
accountListId: accountListId,
contactId: 'contact-1',
});
});

expect(await findByText('Initiate for Appointment')).toBeInTheDocument();
await waitFor(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also customize findByText's timeout if you need to: findByText('...', {}, { timeout: 3000 }).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok good to know

() => expect(getByText('Initiate for Appointment')).toBeInTheDocument(),
{ timeout: 3000 },
);
});

it('does not send a ContactStatus graphql request when the current contacts status is provided', async () => {
Expand All @@ -138,13 +138,17 @@ describe('SuggestedContactStatus', () => {

await waitFor(() => {
expect(mutationSpy).toHaveBeenCalledTimes(1);
expect(mutationSpy.mock.calls[0][0].operation).toMatchObject({
operationName: 'LoadConstants',
variables: {},
});
expect(getByText("Change the contact's status to:")).toBeInTheDocument();
expect(getByText('Initiate for Appointment')).toBeInTheDocument();
expect(mutationSpy).toHaveGraphqlOperation('LoadConstants', {});
});
await waitFor(
() => {
expect(
getByText("Change the contact's status to:"),
).toBeInTheDocument();
expect(getByText('Initiate for Appointment')).toBeInTheDocument();
},
{ timeout: 3000 },
);
});

it('renders suggested status when the contact has no status', async () => {
Expand All @@ -157,11 +161,14 @@ describe('SuggestedContactStatus', () => {
/>,
);

await waitFor(() => {
expect(getByText("Change the contact's status to:")).toBeInTheDocument();
});
await waitFor(() =>
expect(getByText('Initiate for Appointment')).toBeInTheDocument(),
await waitFor(
() => {
expect(
getByText("Change the contact's status to:"),
).toBeInTheDocument();
expect(getByText('Initiate for Appointment')).toBeInTheDocument();
},
{ timeout: 3000 },
);
});
});
Loading