feat: expose mobile localization contracts
This commit is contained in:
@@ -18,16 +18,32 @@ for (const value of [
|
||||
'NETA_PROTOCOL = "neta"',
|
||||
"NETA_DISCOVERY_VERSION = 1",
|
||||
'NETA_API_VERSION = "1"',
|
||||
'"instance.localization"',
|
||||
'"auth.device-pairing"',
|
||||
'status: "planned"',
|
||||
"minimumSupportedVersion",
|
||||
"workspaceName",
|
||||
"metaTitle",
|
||||
"faviconUrl",
|
||||
"NetaLocalizedResponse",
|
||||
"NetaTranslationMutationShape",
|
||||
"ownerMutationTranslations",
|
||||
"absoluteUrl",
|
||||
]) {
|
||||
assert.ok(contracts.includes(value), `Missing API contract marker: ${value}`);
|
||||
}
|
||||
|
||||
const localization = read("server/api/v1/localization.ts");
|
||||
for (const value of [
|
||||
"parseAcceptLanguage",
|
||||
"negotiateLocale",
|
||||
"UNSUPPORTED_LOCALE",
|
||||
"Accept-Language",
|
||||
"exact-or-base-language",
|
||||
]) {
|
||||
assert.ok(localization.includes(value), `Missing localization contract marker: ${value}`);
|
||||
}
|
||||
|
||||
const instanceService = read("server/instance/service.ts");
|
||||
assert.doesNotMatch(
|
||||
instanceService,
|
||||
@@ -46,6 +62,39 @@ assert.match(
|
||||
/getUserPreferences/,
|
||||
"Authenticated mobile metadata must expose the persisted user color mode",
|
||||
);
|
||||
assert.match(
|
||||
read("app/api/v1/me/route.ts"),
|
||||
/resolvedLocale/,
|
||||
"Authenticated mobile metadata must expose resolved localization state",
|
||||
);
|
||||
assert.match(
|
||||
read("app/api/v1/me/route.ts"),
|
||||
/portalLocale/,
|
||||
"Authenticated mobile metadata must expose client portal locale when available",
|
||||
);
|
||||
|
||||
assert.match(
|
||||
read("app/api/v1/meta/route.ts"),
|
||||
/stale-while-revalidate=300/,
|
||||
"Meta endpoint must keep a public revalidation cache contract",
|
||||
);
|
||||
|
||||
const domainErrors = read("server/domain/errors.ts");
|
||||
assert.match(
|
||||
domainErrors,
|
||||
/UNSUPPORTED_LOCALE/,
|
||||
"Unsupported locale must have a stable API error code",
|
||||
);
|
||||
|
||||
for (const fixture of [
|
||||
"docs/self-hosted-redesign/i18n-phase-8-fixtures/api-v1-locale-tr.json",
|
||||
"docs/self-hosted-redesign/i18n-phase-8-fixtures/api-v1-locale-en.json",
|
||||
"docs/self-hosted-redesign/i18n-phase-8-fixtures/api-v1-locale-fr.json",
|
||||
]) {
|
||||
const parsed = JSON.parse(read(fixture));
|
||||
assert.ok(parsed.request, `Missing request fixture in ${fixture}`);
|
||||
assert.ok(parsed.expected, `Missing expected fixture in ${fixture}`);
|
||||
}
|
||||
|
||||
for (const route of requiredRoutes.slice(1)) {
|
||||
const content = read(route);
|
||||
@@ -66,6 +115,7 @@ for (const futureRoute of [
|
||||
const runtimeFiles = [
|
||||
...requiredRoutes,
|
||||
"server/api/v1/contracts.ts",
|
||||
"server/api/v1/localization.ts",
|
||||
"server/api/v1/responses.ts",
|
||||
"server/api/v1/runtime.ts",
|
||||
"server/instance/service.ts",
|
||||
|
||||
Reference in New Issue
Block a user