-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
51 additions
and
48 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,7 +107,7 @@ describe('FixEmailAddresses-Home', () => { | |
expect(getByTestId('starOutlineIcon-testid-0')).toBeInTheDocument(); | ||
}); | ||
|
||
it('should add an new email address and update GraphQL and reset form', async () => { | ||
it('should add an new email address, firing a GraphQL mutation and resetting the form', async () => { | ||
const { getByTestId, getAllByLabelText } = render(<Components />); | ||
await waitFor(() => { | ||
expect(getByTestId('textfield-testid-0')).toBeInTheDocument(); | ||
|
@@ -172,7 +172,53 @@ describe('FixEmailAddresses-Home', () => { | |
expect(getByTestId('starIcon-testid2-0')).toBeInTheDocument(); | ||
}); | ||
|
||
describe('add email address', () => { | ||
it('should render no contacts with no data', async () => { | ||
const { getByText, getByTestId } = render( | ||
<Components | ||
mocks={{ | ||
GetInvalidEmailAddresses: { | ||
people: { nodes: [] }, | ||
}, | ||
}} | ||
/>, | ||
); | ||
await waitFor(() => | ||
expect(getByTestId('fixEmailAddresses-null-state')).toBeInTheDocument(), | ||
); | ||
expect( | ||
getByText('No people with email addresses need attention'), | ||
).toBeInTheDocument(); | ||
}); | ||
|
||
it('should modify first email of first contact', async () => { | ||
const { getByTestId } = render(<Components />); | ||
await waitFor(() => { | ||
expect(getByTestId('textfield-testid-0')).toBeInTheDocument(); | ||
}); | ||
const firstInput = getByTestId('textfield-testid-0'); | ||
|
||
expect(firstInput).toHaveValue('[email protected]'); | ||
userEvent.type(firstInput, '123'); | ||
expect(firstInput).toHaveValue('[email protected]'); | ||
}); | ||
|
||
describe('setContactFocus()', () => { | ||
it('should open up contact details', async () => { | ||
const { getByText, queryByTestId } = render(<Components />); | ||
await waitFor(() => | ||
expect(queryByTestId('loading')).not.toBeInTheDocument(), | ||
); | ||
expect(setContactFocus).not.toHaveBeenCalled(); | ||
|
||
const contactName = getByText('Test Contact'); | ||
|
||
expect(contactName).toBeInTheDocument(); | ||
userEvent.click(contactName); | ||
expect(setContactFocus).toHaveBeenCalledWith(contactId); | ||
}); | ||
}); | ||
|
||
describe('Add email address - Testing cache', () => { | ||
interface AddEmailAddressProps { | ||
postSaveResponse: object; | ||
emailAddressNodes: object[]; | ||
|
@@ -302,50 +348,4 @@ describe('FixEmailAddresses-Home', () => { | |
}); | ||
}); | ||
}); | ||
|
||
it('should render no contacts with no data', async () => { | ||
const { getByText, getByTestId } = render( | ||
<Components | ||
mocks={{ | ||
GetInvalidEmailAddresses: { | ||
people: { nodes: [] }, | ||
}, | ||
}} | ||
/>, | ||
); | ||
await waitFor(() => | ||
expect(getByTestId('fixEmailAddresses-null-state')).toBeInTheDocument(), | ||
); | ||
expect( | ||
getByText('No people with email addresses need attention'), | ||
).toBeInTheDocument(); | ||
}); | ||
|
||
it('should modify first email of first contact', async () => { | ||
const { getByTestId } = render(<Components />); | ||
await waitFor(() => { | ||
expect(getByTestId('textfield-testid-0')).toBeInTheDocument(); | ||
}); | ||
const firstInput = getByTestId('textfield-testid-0'); | ||
|
||
expect(firstInput).toHaveValue('[email protected]'); | ||
userEvent.type(firstInput, '123'); | ||
expect(firstInput).toHaveValue('[email protected]'); | ||
}); | ||
|
||
describe('setContactFocus()', () => { | ||
it('should open up contact details', async () => { | ||
const { getByText, queryByTestId } = render(<Components />); | ||
await waitFor(() => | ||
expect(queryByTestId('loading')).not.toBeInTheDocument(), | ||
); | ||
expect(setContactFocus).not.toHaveBeenCalled(); | ||
|
||
const contactName = getByText('Test Contact'); | ||
|
||
expect(contactName).toBeInTheDocument(); | ||
userEvent.click(contactName); | ||
expect(setContactFocus).toHaveBeenCalledWith(contactId); | ||
}); | ||
}); | ||
}); |