Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
@@ -0,0 +1,33 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import path from "node:path";
|
||||
import { describe, expect, test } from "vitest";
|
||||
|
||||
// Guard test (#72 i18n-foundation): the tenant profile route MUST keep its
|
||||
// locale picker. The picker itself lives in
|
||||
// `apps/web/app/modules/users/components/UserProfileSettings.tsx`. The route
|
||||
// composes the component and passes `currentSession.locale` so the UI can
|
||||
// show the active language. If somebody refactors the picker out we want CI
|
||||
// to scream — switching language is a privacy/UX requirement we already
|
||||
// shipped, not an optional feature.
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
const profilePath = path.join(__dirname, "profile.tsx");
|
||||
const settingsPath = path.resolve(__dirname, "../../../modules/users/components/UserProfileSettings.tsx");
|
||||
|
||||
describe("tenant profile locale picker", () => {
|
||||
test("profile route loader includes the active locale in currentSession", () => {
|
||||
const source = readFileSync(profilePath, "utf8");
|
||||
expect(source).toContain("currentSession: getCurrentSessionSettings");
|
||||
expect(source).toContain("locale: userInfo.lng");
|
||||
});
|
||||
|
||||
test("UserProfileSettings exposes a locale-picker InputSelect", () => {
|
||||
const source = readFileSync(settingsPath, "utf8");
|
||||
// The picker uses `i18nConfig.supportedLngs` to render the options and
|
||||
// submits the change to the root /preferences action via setLocale.
|
||||
expect(source).toContain("i18nConfig.supportedLngs");
|
||||
expect(source).toMatch(/changedLocale\(/);
|
||||
expect(source).toContain('"setLocale"');
|
||||
expect(source).toContain('"/preferences"');
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user