22541 extract breadcrumb route-state helper and align phase22 auth locale test

This commit is contained in:
2026-04-09 09:23:22 +01:00
parent 3cea83b7e1
commit 1c06ef1639
7 changed files with 279 additions and 105 deletions
+6 -6
View File
@@ -21,7 +21,7 @@ const loadAuthInternals = () => {
source = source.replace(/import[\s\S]*?from\s+"[^"]+";\n?/g, "");
source = source.replace(
/export default NextAuthPEDW;\s*$/,
"module.exports = { appendParamsAndPathToNewUrl, resolveLocale, authOptions, NextAuthPEDW };"
"module.exports = { appendParamsAndPathToNewUrl, resolveRequestLocale, authOptions, NextAuthPEDW };"
);
const context = {
@@ -68,11 +68,11 @@ const loadAuthInternals = () => {
return context.module.exports;
};
test("auth/resolveLocale prefers query then body then cookie then default", async () => {
test("auth/resolveRequestLocale prefers query then body then cookie then default", async () => {
const mod = loadAuthInternals();
assert.strictEqual(
mod.resolveLocale({
mod.resolveRequestLocale({
query: { locale: "cy" },
body: { locale: "en" },
cookies: { pedw_locale: "en" }
@@ -81,7 +81,7 @@ test("auth/resolveLocale prefers query then body then cookie then default", asyn
);
assert.strictEqual(
mod.resolveLocale({
mod.resolveRequestLocale({
body: { locale: "cy" },
cookies: { pedw_locale: "en" }
}),
@@ -89,13 +89,13 @@ test("auth/resolveLocale prefers query then body then cookie then default", asyn
);
assert.strictEqual(
mod.resolveLocale({
mod.resolveRequestLocale({
cookies: { pedw_locale: "cy" }
}),
"cy"
);
assert.strictEqual(mod.resolveLocale({}), "en");
assert.strictEqual(mod.resolveRequestLocale({}), "en");
});
test("auth/redirect callback keeps relative URLs on same base", async () => {