Skip to content

Commit

Permalink
Add test and remove mocked fields
Browse files Browse the repository at this point in the history
  • Loading branch information
caleballdrin committed Oct 9, 2024
1 parent 53d91dd commit 01ce8d1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,6 @@ describe('FixMailingAddresses', () => {
contacts: {
nodes: [
{
id: contactId,
name: 'Baggins, Frodo',
status: null,
addresses: {
nodes: [tntSourcedAddress],
},
Expand Down Expand Up @@ -148,9 +145,6 @@ describe('FixMailingAddresses', () => {
contacts: {
nodes: [
{
id: contactId,
name: 'Baggins, Frodo',
status: null,
addresses: {
nodes: [mpdxSourcedAddress],
},
Expand Down
20 changes: 20 additions & 0 deletions src/components/Tool/FixSendNewsletter/Contact.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ describe('Fix Newsletter - Contact', () => {
it('should be Physical and display startDate', () => {
primaryAddress.street = '100 Test St';
primaryAddress.startDate = '2022-12-10T16:05:26-05:00';
primaryAddress.createdAt = '2022-10-10T16:05:26-05:00';
primaryAddress.source = 'Siebel';

const { getByRole, getByText } = render(
Expand All @@ -97,6 +98,25 @@ describe('Fix Newsletter - Contact', () => {
).toBeInTheDocument();
});

it('should show createdAt if startDate is null', () => {
primaryAddress.street = '100 Test St';
primaryAddress.startDate = null;
primaryAddress.createdAt = '2022-10-10T16:05:26-05:00';
primaryAddress.source = 'Siebel';

const { getByRole, getByText } = render(
<TestComponent
primaryPerson={primaryPerson}
primaryAddress={primaryAddress}
/>,
);

expect(getByText(/(10\/10\/2022)/i)).toBeInTheDocument();
expect(
within(getByRole('combobox')).getByText('Physical'),
).toBeInTheDocument();
});

it('should be Digital', () => {
primaryPerson.primaryEmailAddress = { id: '1', email: '[email protected]' };

Expand Down

0 comments on commit 01ce8d1

Please sign in to comment.