43 lines
2.0 KiB
JavaScript
43 lines
2.0 KiB
JavaScript
import { readFileSync } from "node:fs";
|
|
import { fileURLToPath } from "node:url";
|
|
import { describe, expect, it } from "vitest";
|
|
|
|
const readSource = (relativePath) =>
|
|
readFileSync(fileURLToPath(new URL(`../../${relativePath}`, import.meta.url)), "utf8");
|
|
|
|
describe("Superuser user overview source", () => {
|
|
const overviewWidgetSources = [
|
|
"src/views/dashboards/superUserDashboard/user/User.vue",
|
|
"src/views/dashboards/superUserDashboard/user/SuperUserSelectedUserObject.vue",
|
|
"src/views/dashboards/superUserDashboard/user/displays/UserDefaultDepartment.vue",
|
|
"src/views/dashboards/superUserDashboard/user/displays/UserFixedPricing.vue",
|
|
"src/views/dashboards/superUserDashboard/user/displays/other/UserOtherSpecialArrangement.vue",
|
|
"src/views/dashboards/superUserDashboard/user/displays/other/UserOtherVaskeabonnement.vue",
|
|
"src/views/dashboards/superUserDashboard/user/displays/vehicles/UserVehicleSubscriptionsDisplay.vue",
|
|
];
|
|
|
|
it("keeps the overview page on the cleaned management hub implementation", () => {
|
|
const source = readSource("src/views/dashboards/superUserDashboard/user/User.vue");
|
|
|
|
expect(source).toContain('data-testid="superuser-user-overview-page"');
|
|
expect(source).toContain("superuser-user-overview-customer-management");
|
|
expect(source).toContain("superuser-user-overview-subscriptions");
|
|
expect(source).not.toContain("SessionUser.valueOf()");
|
|
expect(source).not.toContain("JSON.stringify(user");
|
|
});
|
|
|
|
it("keeps the selected user state loadable and retry-aware", () => {
|
|
const source = readSource("src/views/dashboards/superUserDashboard/user/SuperUserSelectedUserObject.vue");
|
|
|
|
expect(source).toContain("isUserLoading");
|
|
expect(source).toContain("userLoadError");
|
|
expect(source).toContain("activeLoadPromise");
|
|
});
|
|
|
|
it("keeps the overview and directly embedded widgets free of debug logging", () => {
|
|
for (const relativePath of overviewWidgetSources) {
|
|
expect(readSource(relativePath), relativePath).not.toContain("console.log");
|
|
}
|
|
});
|
|
});
|