Files
pleno-vue/tests/unit/weatherapi-wiring.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

45 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("weatherapi superuser wiring", () => {
it("is registered in SessionUser superuser modules", () => {
expect(superUserObjectSource).toContain(
'import { WeatherAPI } from "@/components/session/token/superUser/modules/weatherapi/WeatherAPI.vue";'
);
expect(superUserObjectSource).toContain("get weatherapi() { return WeatherAPI; },");
});
it("has a dedicated superuser configuration route", () => {
expect(routerSource).toContain(
'import ConfigurationWeatherAPI from "@/views/dashboards/superUserDashboard/configuration/ConfigurationWeatherAPI.vue";'
);
expect(routerSource).toContain("name: 'configurationWeatherAPI'");
expect(routerSource).toContain("path: '/superuser/configuration/weatherapi'");
expect(routerSource).toContain("component: ConfigurationWeatherAPI");
});
it("appears in superuser configuration navigation menus", () => {
expect(navItemsSource).toContain("SessionUser.superUser.modules.weatherapi.meta.labels.multiple");
expect(navItemsSource).toContain("to: '/superuser/configuration/weatherapi'");
expect(leftMenuSource).toContain("SessionUser.superUser.modules.weatherapi.meta.title");
expect(leftMenuSource).toContain("SessionUser.superUser.modules.weatherapi.meta.config_endpoint");
expect(configTabsSource).toContain("{ name: 'WeatherAPI', path: '/superuser/configuration/weatherapi' }");
});
});