33 lines
1.0 KiB
JavaScript
33 lines
1.0 KiB
JavaScript
import { describe, expect, it } from "vitest";
|
|
import { readI18nRuntimeMessages } from "./helpers/readI18nRuntimeMessages";
|
|
|
|
const activeLocales = ["da", "en", "sv", "de", "no"];
|
|
const migrationKey = "superuser.pages.employees.migrate_to_limited_backoffice";
|
|
|
|
const getKeyPathValue = (messages, keyPath) => {
|
|
let current = messages;
|
|
|
|
for (const segment of keyPath.split(".")) {
|
|
if (!current || typeof current !== "object" || Array.isArray(current)) {
|
|
return undefined;
|
|
}
|
|
|
|
current = current[segment];
|
|
}
|
|
|
|
return current;
|
|
};
|
|
|
|
describe("superuser users i18n", () => {
|
|
it("resolves the limited backoffice migration action label in all active locales", () => {
|
|
for (const locale of activeLocales) {
|
|
const value = getKeyPathValue(readI18nRuntimeMessages(locale), migrationKey);
|
|
|
|
expect(value, `${locale} ${migrationKey}`).toEqual(expect.any(String));
|
|
expect(value.trim()).not.toBe("");
|
|
expect(value).not.toBe(migrationKey);
|
|
expect(value).not.toMatch(/^@:/);
|
|
}
|
|
});
|
|
});
|