Previously only 2-3 workspaces participated in each turbo task. This expands test, lint, and typecheck to cover all 11 workspaces with parallel execution and caching. Test pipeline: - Move from single root vitest to per-workspace test scripts via turbo - Shared vitest config (vitest.shared.ts) with passWithNoTests - Per-workspace configs re-export the shared base - Mobile uses Jest (jest-expo + React Native Testing Library) - Add node-environment GPX tests verifying linkedom fallback - Add i18n mobile init tests - Exclude apps/mobile from root vitest (uses Jest separately) Lint pipeline: - Add eslint lint script to all 9 previously unlinted workspaces - Standardize all scripts to "eslint ." with shared root config - Add .expo/ to global ESLint ignores - Fix lint errors: unused imports in api/types, export parseGpx Typecheck pipeline: - Add "typecheck": "tsc" to all 8 packages - Add @types/node (catalog) to gpx and db packages - Fix mobile app.config.ts: remove deprecated experiments.monorepo and newArchEnabled (both default in Expo SDK 55) - Add allowImportingTsExtensions to mobile tsconfig Shared package compatibility (mobile-app Phase 1.3): - Add linkedom as explicit dependency to @trails-cool/gpx - Add initI18nMobile() export to @trails-cool/i18n - Confirm @trails-cool/types is pure interfaces (no DOM deps) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
/**
|
|
* @vitest-environment node
|
|
*
|
|
* Tests run in node environment (no browser APIs) to verify
|
|
* React Native compatibility of initI18nMobile.
|
|
*/
|
|
import { describe, it, expect } from "vitest";
|
|
import { initI18nMobile, i18n, supportedLngs, resources } from "./index.ts";
|
|
|
|
describe("initI18nMobile", () => {
|
|
it("initializes i18next without browser APIs", () => {
|
|
// Verify no browser globals exist in this environment
|
|
expect(typeof document).toBe("undefined");
|
|
expect(typeof localStorage).toBe("undefined");
|
|
|
|
initI18nMobile("de-AT");
|
|
expect(i18n.isInitialized).toBe(true);
|
|
// Regional variant should match supported "de"
|
|
expect(i18n.language).toBe("de");
|
|
});
|
|
|
|
it("has all translation namespaces loaded", () => {
|
|
expect(i18n.hasResourceBundle("en", "common")).toBe(true);
|
|
expect(i18n.hasResourceBundle("de", "common")).toBe(true);
|
|
expect(i18n.hasResourceBundle("en", "planner")).toBe(true);
|
|
expect(i18n.hasResourceBundle("de", "journal")).toBe(true);
|
|
});
|
|
|
|
it("can switch language after init", () => {
|
|
i18n.changeLanguage("en");
|
|
expect(i18n.language).toBe("en");
|
|
});
|
|
|
|
it("exports supported languages and resources", () => {
|
|
expect(supportedLngs).toContain("en");
|
|
expect(supportedLngs).toContain("de");
|
|
expect(resources.en.common).toBeDefined();
|
|
expect(resources.de.common).toBeDefined();
|
|
});
|
|
});
|