Skip to content

Commit

Permalink
test: update manager and contact form summary tests to use latest com…
Browse files Browse the repository at this point in the history
…mitted data
  • Loading branch information
mikevespi committed May 15, 2024
1 parent 9a8d54f commit 99f10bb
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 79 deletions.
86 changes: 43 additions & 43 deletions app/tests/unit/components/Form/ProjectContactFormSummary.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,53 +104,53 @@ const mockQueryPayload = {
},
},
],
latestCommittedProjectContactFormChanges: {
edges: [
{
node: {
newFormData: {
contactIndex: 1,
contactId: 1,
projectId: 1,
},
asProjectContact: {
contactByContactId: {
fullName: "Test Full Name primary PREVIOUS",
},
},
}
},
{
node: {
newFormData: {
contactIndex: 1,
contactId: 2,
projectId: 1,
},
asProjectContact: {
contactByContactId: {
fullName: "I did not change",
},
},
latestCommittedProjectContactFormChanges: {
edges: [
{
node: {
newFormData: {
contactIndex: 1,
contactId: 1,
projectId: 1,
},
asProjectContact: {
contactByContactId: {
fullName: "Test Full Name primary PREVIOUS",
},
}
},
{
node: {
newFormData: {
contactIndex: 4,
contactId: 4,
projectId: 1,
},
}
},
{
node: {
newFormData: {
contactIndex: 1,
contactId: 2,
projectId: 1,
},
asProjectContact: {
contactByContactId: {
fullName: "I did not change",
},
asProjectContact: {
contactByContactId: {
fullName: "I was removed",
},
},
}
},
{
node: {
newFormData: {
contactIndex: 4,
contactId: 4,
projectId: 1,
},
asProjectContact: {
contactByContactId: {
fullName: "I was removed",
},
}
},
}
]
}
},
}
]
}
};
return result;
},
Expand Down
83 changes: 47 additions & 36 deletions app/tests/unit/components/Form/ProjectManagerFormSummary.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,6 @@ const mockQueryPayload = {
fullName: "Test Full Name Update",
},
},
formChangeByPreviousFormChangeId: {
newFormData: {
projectId: 1,
cifUserId: 1,
projectManagerLabelId: 1,
},
asProjectManager: {
cifUserByCifUserId: {
fullName: "Test Full Name Update PREVIOUS",
},
},
},
},
projectManagerLabel: {
label: "Test First Label",
Expand All @@ -75,18 +63,6 @@ const mockQueryPayload = {
fullName: "Test Full Name Archive",
},
},
formChangeByPreviousFormChangeId: {
newFormData: {
projectId: 1,
cifUserId: 1,
projectManagerLabelId: 1,
},
asProjectManager: {
cifUserByCifUserId: {
fullName: "Test Full Name Archive PREVIOUS",
},
},
},
},
projectManagerLabel: {
label: "Test Second Label",
Expand Down Expand Up @@ -130,18 +106,6 @@ const mockQueryPayload = {
fullName: "Test Full Name No Change",
},
},
formChangeByPreviousFormChangeId: {
newFormData: {
projectId: 1,
cifUserId: 4,
projectManagerLabelId: 4,
},
asProjectManager: {
cifUserByCifUserId: {
fullName: "Test Full Name No Change",
},
},
},
},
projectManagerLabel: {
label: "Test Fourth Label",
Expand All @@ -150,6 +114,52 @@ const mockQueryPayload = {
},
],
},
latestCommittedProjectManagerFormChanges: {
edges: [
{
node: {
newFormData: {
projectId: 1,
cifUserId: 1,
projectManagerLabelId: 1,
},
asProjectManager: {
cifUserByCifUserId: {
fullName: "Test Full Name Update PREVIOUS",
},
},
}
},
{
node: {
newFormData: {
projectId: 1,
cifUserId: 1,
projectManagerLabelId: 1,
},
asProjectManager: {
cifUserByCifUserId: {
fullName: "Test Full Name Archive PREVIOUS",
},
},
}
},
{
node: {
newFormData: {
projectId: 1,
cifUserId: 4,
projectManagerLabelId: 4,
},
asProjectManager: {
cifUserByCifUserId: {
fullName: "Test Full Name No Change",
},
},
}
}
]
},
},
};
},
Expand Down Expand Up @@ -197,6 +207,7 @@ describe("The ProjectManagerForm", () => {
it("Only displays diffs of the the data fields that have changed", () => {
componentTestingHelper.loadQuery();
componentTestingHelper.renderComponent();
screen.logTestingPlaygroundURL();

expect(screen.getByText("Test Full Name Update")).toBeInTheDocument();
expect(
Expand Down

0 comments on commit 99f10bb

Please sign in to comment.