Files
pleno-vue/tests/unit/self-serve-pagination-machine-scope.spec.js
T
Jeppe Bundgaard b39b458f4f Add .prettierrc.json and refactor test files for improved formatting consistency:
- 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.
2026-04-13 09:13:27 +02:00

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)"
);
});
});