- Added tests to verify legacy scope selectors for lanes and vehicle types. - Ensured condition submission is guarded for both machine type and legacy scopes. - Validated vehicle type scoping with product query filtering and new record defaults.
27 lines
1.6 KiB
JavaScript
27 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 studio vehicle type scope", () => {
|
|
it("adds a vehicle-type select bound to product query scope", () => {
|
|
const studioSource = readSource("src/views/dashboards/departmentDashboard/modules/self-serve/DepartmentSelfServeStudio.vue");
|
|
|
|
expect(studioSource).toContain("const scopedProductId = computed(() => parseScopedProduct(route.query.product));");
|
|
expect(studioSource).toContain("const scopedProductModel = computed({");
|
|
expect(studioSource).toContain("delete nextQuery.product;");
|
|
expect(studioSource).toContain("data-testid=\"self-serve-studio-vehicle-type-select\"");
|
|
expect(studioSource).toContain("<option :value=\"null\">All vehicle types</option>");
|
|
});
|
|
|
|
it("applies product scope filtering and defaults for new records", () => {
|
|
const studioSource = readSource("src/views/dashboards/departmentDashboard/modules/self-serve/DepartmentSelfServeStudio.vue");
|
|
|
|
expect(studioSource).toContain("const scopedQuestions = computed(() => questions.value.filter((entry) => matchesScopedProduct(entry)));");
|
|
expect(studioSource).toContain("const scopedConditions = computed(() => conditions.value.filter((entry) => matchesScopedProduct(entry)));");
|
|
expect(studioSource).toContain("const scopedTasks = computed(() => tasks.value.filter((entry) => matchesScopedProduct(entry)));");
|
|
expect(studioSource).toContain("product: scopedProductId.value || 0,");
|
|
});
|
|
});
|