From 83529e635486fd942de13290f0a52be147bb3240 Mon Sep 17 00:00:00 2001 From: Adam Moussa Date: Fri, 25 Sep 2026 17:25:19 -0400 Subject: [PATCH 1/2] fix(ci): format invoice mock helpers --- src/mocks/invoices.ts | 111 +++++++++++++++++++----------------------- 1 file changed, 49 insertions(+), 62 deletions(-) diff --git a/src/mocks/invoices.ts b/src/mocks/invoices.ts index f4ef455..8f7b4b5 100644 --- a/src/mocks/invoices.ts +++ b/src/mocks/invoices.ts @@ -168,29 +168,27 @@ function withRefreshedCatalogFields(invoice: MockInvoice): MockInvoice { } function enrichInvoice(core: MockInvoiceCore, index: number): MockInvoice { - return withRefreshedCatalogFields( - { - ...core, - hasBolt: index % 3 === 0, - hasBell: index % 2 === 0, - hasEye: true, - actionLabel: actionLabelForStatus(core.status), - lastUpdate: "", - lastUpdateMessage: "", - lastUpdateActorName: "", - lastUpdateAt: "", - invoiceDate: invoiceDateBeforeDue(core.dueDate, index), - processingBegan: core.activity[0]?.createdAt?.slice(0, 10) ?? core.dueDate, - tagging: index % 2 === 0 ? "Ops" : "", - fs: index % 2 === 0 ? "synced" : "", - description: core.memo, - invoiceType: "Standard", - location: "Ronkonkoma", - paymentAccount: paymentAccountFor(core.paymentMethod), - relatedInvoice: null, - rowCount: core.lines.length, - }, - ); + return withRefreshedCatalogFields({ + ...core, + hasBolt: index % 3 === 0, + hasBell: index % 2 === 0, + hasEye: true, + actionLabel: actionLabelForStatus(core.status), + lastUpdate: "", + lastUpdateMessage: "", + lastUpdateActorName: "", + lastUpdateAt: "", + invoiceDate: invoiceDateBeforeDue(core.dueDate, index), + processingBegan: core.activity[0]?.createdAt?.slice(0, 10) ?? core.dueDate, + tagging: index % 2 === 0 ? "Ops" : "", + fs: index % 2 === 0 ? "synced" : "", + description: core.memo, + invoiceType: "Standard", + location: "Ronkonkoma", + paymentAccount: paymentAccountFor(core.paymentMethod), + relatedInvoice: null, + rowCount: core.lines.length, + }); } function cloneInvoice(invoice: MockInvoice): MockInvoice { @@ -580,22 +578,20 @@ export function updateMockInvoicePayDate(id: string, payDate: string | null): Mo const current = invoiceStore[index]; return replaceInvoice( index, - withRefreshedCatalogFields( - { - ...current, - payDate, - activity: [ - ...current.activity, - { - id: `activity-pay-date-${Date.now()}`, - actorUserId: "user-1", - actorName: "System", - message: "Pay date updated", - createdAt: new Date().toISOString(), - }, - ], - }, - ), + withRefreshedCatalogFields({ + ...current, + payDate, + activity: [ + ...current.activity, + { + id: `activity-pay-date-${Date.now()}`, + actorUserId: "user-1", + actorName: "System", + message: "Pay date updated", + createdAt: new Date().toISOString(), + }, + ], + }), ); } @@ -605,10 +601,7 @@ export function updateMockInvoiceHeader(id: string, patch: MockInvoiceHeaderPatc throw new Error(`Mock invoice not found: ${id}`); } - return replaceInvoice( - index, - withRefreshedCatalogFields({ ...invoiceStore[index], ...patch }), - ); + return replaceInvoice(index, withRefreshedCatalogFields({ ...invoiceStore[index], ...patch })); } export function updateMockInvoiceLines(id: string, lines: MockInvoiceLine[]): MockInvoice { @@ -619,12 +612,10 @@ export function updateMockInvoiceLines(id: string, lines: MockInvoiceLine[]): Mo return replaceInvoice( index, - withRefreshedCatalogFields( - { - ...invoiceStore[index], - lines: lines.map((line) => ({ ...line })), - }, - ), + withRefreshedCatalogFields({ + ...invoiceStore[index], + lines: lines.map((line) => ({ ...line })), + }), ); } @@ -651,12 +642,10 @@ export function addMockInvoiceComment( return replaceInvoice( index, - withRefreshedCatalogFields( - { - ...current, - comments: [...current.comments, nextComment], - }, - ), + withRefreshedCatalogFields({ + ...current, + comments: [...current.comments, nextComment], + }), ); } @@ -684,13 +673,11 @@ export function transitionMockInvoiceStatus( const updated = replaceInvoice( index, - withRefreshedCatalogFields( - { - ...current, - status, - activity: [...current.activity, nextActivity], - }, - ), + withRefreshedCatalogFields({ + ...current, + status, + activity: [...current.activity, nextActivity], + }), ); if (status === "approved" || status === "rejected") { From aba37782f3990e7f384df82e83bfc5dfd3ecea40 Mon Sep 17 00:00:00 2001 From: Adam Moussa Date: Fri, 25 Sep 2026 17:25:19 -0400 Subject: [PATCH 2/2] fix(web): assert the vendor column by its grid field --- e2e/invoice-columns.spec.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/e2e/invoice-columns.spec.ts b/e2e/invoice-columns.spec.ts index 27e6914..2ebc1ba 100644 --- a/e2e/invoice-columns.spec.ts +++ b/e2e/invoice-columns.spec.ts @@ -34,14 +34,22 @@ test.describe("Invoice Processing columns drawer (AP-45)", () => { await page.goto("/"); await page.getByTestId("columns-toggle").click(); const drawer = page.getByTestId("columns-drawer"); - const vendorBox = drawer.getByTestId("columns-visible-vendor").locator('input[type="checkbox"]'); + const vendorBox = drawer + .getByTestId("columns-visible-vendor") + .locator('input[type="checkbox"]'); await expect(vendorBox).toBeDisabled(); await vendorBox.evaluate((el: HTMLInputElement) => { el.disabled = false; el.click(); }); await expect( - page.getByTestId("grid-pending").locator('.MuiDataGrid-columnHeader[data-field="vendor"]'), + page + .getByTestId("grid-pending") + .locator('.MuiDataGrid-columnHeader[data-field="vendorName"]'), + ).toBeVisible(); + await page.getByTestId("tab-ready").click(); + await expect( + page.getByTestId("grid-ready").locator('.MuiDataGrid-columnHeader[data-field="vendorName"]'), ).toBeVisible(); const search = drawer.getByTestId("columns-hidden-search");