Fix invoice period i18n release gate (#245)
Replace unreviewed dynamic invoice-period translation calls with a bounded literal-key contract and focused fallback coverage.
This commit is contained in:
@@ -3,10 +3,26 @@ import { readFileSync } from "node:fs";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { buildPeriodCacheKey } from "../../src/views/dashboards/superUserDashboard/InvoicingBillingPeriod/imports/InvoicingBillingPeriodImportPaging.js";
|
||||
import { deriveLegacyPeriodCustomerReview } from "../../src/views/dashboards/superUserDashboard/InvoicingBillingPeriod/services/invoicingPeriodReview.js";
|
||||
import { translateInvoicingPeriodReview } from "../../src/views/dashboards/superUserDashboard/InvoicingBillingPeriod/services/invoicingPeriodTranslation.js";
|
||||
|
||||
const readProjectFile = (path) => readFileSync(fileURLToPath(new URL(`../../${path}`, import.meta.url)), "utf8");
|
||||
|
||||
describe("invoicing period review workspace", () => {
|
||||
it("translates only the bounded review-workspace key contract", () => {
|
||||
const calls = [];
|
||||
const composer = {
|
||||
t(key, params) {
|
||||
calls.push([key, params]);
|
||||
return key === "invoicing_period.review_workspace.queue.count" ? `${params.count} kunder` : key;
|
||||
},
|
||||
};
|
||||
|
||||
expect(translateInvoicingPeriodReview(composer, "queue.count", "fallback", { count: 3 })).toBe("3 kunder");
|
||||
expect(translateInvoicingPeriodReview(composer, "queue.unknown", "fallback")).toBe("fallback");
|
||||
expect(translateInvoicingPeriodReview(composer, "../queue.count", "fallback")).toBe("fallback");
|
||||
expect(calls).toEqual([["invoicing_period.review_workspace.queue.count", { count: 3 }]]);
|
||||
});
|
||||
|
||||
it("scopes cached pages by every server-side review and sorting input", () => {
|
||||
const base = {
|
||||
dateFrom: "2026-08-01",
|
||||
|
||||
Reference in New Issue
Block a user