mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-08-03 19:17:07 -04:00

- Adds a new test suite with Docker-based smoke tests for all locales. Can be run using the ./smoketest.sh script. - Replaces all calls to Math.random() with a new helper that returns 0.5 in snapshot testing mode, ensuring deterministic snapshots. - Similarly replaces all calls to new Date() and Date.now() with new helpers that return a fixed date in snapshot testing mode. - Replaces checks against NODE_ENV with APP_ENV, to ensure that the bundles can be built with Nuxt for testing without losing code that would otherwise be stripped out by production optimizations. - Adds a database init script that can be used to initialize the database with a single admin user and a long-lived JWT token for use in automation tests. - Adds a JWT decoding/encoding CLI tool for debugging JWTs. Note: Snapshots are not checked in, and must be generated manually. See test/__snapshots__/.gitignore for more information.
23 lines
550 B
TypeScript
23 lines
550 B
TypeScript
import { defineNuxtPlugin } from 'nuxt/app';
|
|
import type { Router } from 'vue-router';
|
|
|
|
declare global {
|
|
interface Window {
|
|
__NUXT_ROUTES__: string[];
|
|
}
|
|
}
|
|
|
|
export default defineNuxtPlugin((nuxtApp) => {
|
|
// Only expose routes in development
|
|
if (import.meta.env?.APP_ENV !== 'production') {
|
|
const router = nuxtApp.$router as Router;
|
|
const routes: string[] = [];
|
|
|
|
for (const route of router.getRoutes()) {
|
|
routes.push(route.path);
|
|
}
|
|
|
|
window.__NUXT_ROUTES__ = routes;
|
|
}
|
|
});
|