- Introduced `.prettierrc.json` to enforce consistent code formatting across the project. - Updated unit and e2e test files to address formatting issues, improve readability, and ensure alignment with the new Prettier configuration.
36 lines
1.6 KiB
JavaScript
36 lines
1.6 KiB
JavaScript
import { readFileSync } from "node:fs";
|
|
import { join } from "node:path";
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
const readSource = (relativePath) => readFileSync(join(process.cwd(), relativePath), "utf8");
|
|
|
|
describe("self-serve pagination machine scope filtering", () => {
|
|
it("enforces machine-scoped vehicle type matching in tasks pagination", () => {
|
|
const source = readSource(
|
|
"src/components/displays/pagination/models/DepartmentDashboard/SelfServeTasksPagination.vue"
|
|
);
|
|
|
|
expect(source).toContain("if (vehicleTypeFilter) {");
|
|
expect(source).toContain("if (itemMachineType !== 0) {");
|
|
expect(source).toContain("if (itemMachineType !== vehicleTypeFilter) {");
|
|
expect(source).toContain("} else if (itemProduct !== 0 && itemProduct !== vehicleTypeFilter) {");
|
|
expect(source).not.toContain(
|
|
"if (vehicleTypeFilter && itemMachineType === 0 && itemProduct !== 0 && itemProduct !== vehicleTypeFilter)"
|
|
);
|
|
});
|
|
|
|
it("enforces machine-scoped vehicle type matching in conditions pagination", () => {
|
|
const source = readSource(
|
|
"src/components/displays/pagination/models/DepartmentDashboard/SelfServeConditionsPagination.vue"
|
|
);
|
|
|
|
expect(source).toContain("if (vehicleTypeFilter) {");
|
|
expect(source).toContain("if (itemMachineType !== 0) {");
|
|
expect(source).toContain("if (itemMachineType !== vehicleTypeFilter) {");
|
|
expect(source).toContain("} else if (itemProduct !== 0 && itemProduct !== vehicleTypeFilter) {");
|
|
expect(source).not.toContain(
|
|
"if (vehicleTypeFilter && itemMachineType === 0 && itemProduct !== 0 && itemProduct !== vehicleTypeFilter)"
|
|
);
|
|
});
|
|
});
|