Skip to content

Commit

Permalink
fix: ensure mock item id's don't contain 'CONTACT#'
Browse files Browse the repository at this point in the history
  • Loading branch information
trevor-anderson committed May 18, 2023
1 parent 05e1a2f commit b997a65
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/__tests__/mockItems/mockInvoices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ const createMockInvoice = ({
return {
__typename: "Invoice",

id: `INV#${createdBy.id}#${Math.floor(invCreatedAt.getTime() / 1000)}`,
// If 'createdBy' is a Contact, rm "CONTACT#" prefix from ID, else use ID as-is
id: `INV#${createdBy.id.replace(/CONTACT#/, "")}#${Math.floor(invCreatedAt.getTime() / 1000)}`,
createdBy,
assignedTo,
status: invoiceStatus,
Expand Down
5 changes: 4 additions & 1 deletion src/__tests__/mockItems/mockWorkOrders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ const createMockWorkOrder = ({
),
});

const workOrderID = `WO#${createdBy.id}#${Math.floor(woCreatedAt.getTime() / 1000)}`;
// If 'createdBy' is a Contact, rm "CONTACT#" prefix from ID, else use ID as-is
const workOrderID = `WO#${createdBy.id.replace(/CONTACT#/, "")}#${Math.floor(
woCreatedAt.getTime() / 1000
)}`;

return {
__typename: "WorkOrder",
Expand Down

0 comments on commit b997a65

Please sign in to comment.