30 lines
1.3 KiB
JavaScript
30 lines
1.3 KiB
JavaScript
import { readFileSync } from "node:fs";
|
|
import { join } from "node:path";
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
const root = process.cwd();
|
|
const vehiclesTableSource = readFileSync(join(root, "src/components/displays/user/vehicles/vehiclesTable.vue"), "utf8");
|
|
const userVehicleSummarySource = readFileSync(
|
|
join(root, "src/views/dashboards/superUserDashboard/user/displays/vehicles/UserVehicleSummaryDisplay.vue"),
|
|
"utf8"
|
|
);
|
|
|
|
describe("user vehicles actions visibility contract", () => {
|
|
it("keeps vehicle row actions in the wheel menu instead of rendering directly", () => {
|
|
expect(vehiclesTableSource).toContain(':displayActionsDirectly="false"');
|
|
});
|
|
|
|
it("hides legacy vehicle row actions when the shared superuser vehicle wheel is available", () => {
|
|
expect(vehiclesTableSource).toContain("usesBuiltInVehicleWheelActions");
|
|
expect(vehiclesTableSource).toContain('v-if="!usesBuiltInVehicleWheelActions(object)" #actions');
|
|
});
|
|
|
|
it("refreshes the customer vehicle list after adding from the summary card", () => {
|
|
expect(userVehicleSummarySource).toContain("const reloadVehicleDisplays = async () =>");
|
|
expect(userVehicleSummarySource).toContain("await loadList();");
|
|
expect(userVehicleSummarySource).toContain(
|
|
"showCreateObjectForCustomerForm(props.customer_number, reloadVehicleDisplays)"
|
|
);
|
|
});
|
|
});
|