Files
pleno-vue/tests/unit/workfeed-wiring.spec.js
T

47 lines
2.1 KiB
JavaScript

import { readFileSync } from "node:fs";
import { join } from "node:path";
import { describe, expect, it } from "vitest";
const root = process.cwd();
const superUserObjectSource = readFileSync(join(root, "src/components/session/token/superUserObject.vue"), "utf8");
const routerSource = readFileSync(join(root, "src/router.js"), "utf8");
const navItemsSource = readFileSync(
join(root, "src/components/models/navigation/items/NavigationMenuItemsSuperUser.vue"),
"utf8"
);
const leftMenuSource = readFileSync(join(root, "src/components/menus/superuser/SuperUserLeftMenu.vue"), "utf8");
const configTabsSource = readFileSync(
join(root, "src/views/dashboards/superUserDashboard/configuration/SuperUserDashboardConfigurationNavigation.vue"),
"utf8"
);
describe("workfeed superuser wiring", () => {
it("is registered in SessionUser superuser modules", () => {
expect(superUserObjectSource).toContain(
'import { Workfeed } from "@/components/session/token/superUser/modules/workfeed/Workfeed.vue";'
);
expect(superUserObjectSource).toMatch(/get\s+workfeed\(\)\s*{\s*return\s+Workfeed;\s*}/);
});
it("has a dedicated superuser configuration route", () => {
expect(routerSource).toContain(
"const ConfigurationWorkfeed = lazyView('@/views/dashboards/superUserDashboard/configuration/ConfigurationWorkfeed.vue');"
);
expect(routerSource).toContain("name: 'configurationWorkfeed'");
expect(routerSource).toContain("path: '/superuser/configuration/workfeed'");
expect(routerSource).toContain("component: ConfigurationWorkfeed");
});
it("appears in superuser configuration navigation menus", () => {
expect(navItemsSource).toContain("SessionUser.superUser.modules.workfeed.meta.labels.multiple");
expect(navItemsSource).toMatch(/to:\s*["']\/superuser\/configuration\/workfeed["']/);
expect(leftMenuSource).toContain("SessionUser.superUser.modules.workfeed.meta.title");
expect(leftMenuSource).toContain("SessionUser.superUser.modules.workfeed.meta.config_endpoint");
expect(configTabsSource).toMatch(
/name:\s*["']Workfeed["']\s*,\s*path:\s*["']\/superuser\/configuration\/workfeed["']/
);
});
});