Skip to content

Commit 95c8f3c

Browse files
committed
Final config settings
1 parent f75d123 commit 95c8f3c

File tree

3 files changed

+29
-9
lines changed

3 files changed

+29
-9
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import remixI18n from "./i18n.server";
2+
3+
describe("Remix I18n", () => {
4+
it("returns the correct default language from the request",async () => {
5+
const request = new Request("http://localhost:3000")
6+
const defaultLanguage = await remixI18n.getLocale(request)
7+
expect(defaultLanguage).toBe("en")
8+
})
9+
10+
it("returns the correct default language from the request if search param lang is invalid",async () => {
11+
const request = new Request("http://localhost:3000?lng=invalid")
12+
const defaultLanguage = await remixI18n.getLocale(request)
13+
expect(defaultLanguage).toBe("en")
14+
})
15+
16+
it("returns the correct language when specified in the search params from the request",async () => {
17+
const request = new Request("http://localhost:3000?lng=bs")
18+
const defaultLanguage = await remixI18n.getLocale(request)
19+
expect(defaultLanguage).toBe("bs")
20+
})
21+
})

package.json

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,9 @@
1414
"build": "react-router build",
1515
"dev": "react-router dev",
1616
"start": "NODE_ENV=production node ./build/server/index.js",
17-
"test": "vitest run",
18-
"test:ui": "vitest --ui --api 9527",
19-
"test:cov": "vitest run --coverage",
20-
"test:debug": "jest-preview",
21-
"test:live": "npm-run-all -p test:ui test:debug",
17+
"test": "vitest run --browser.headless",
18+
"test:ui": "vitest",
19+
"test:cov": "vitest run --coverage --browser.headless",
2220
"typecheck": "tsc",
2321
"validate": "pnpm run check && pnpm run typecheck && pnpm run test && pnpm run check:unused",
2422
"check": "biome check .",
@@ -64,7 +62,6 @@
6462
"autoprefixer": "10.4.20",
6563
"chalk": "5.3.0",
6664
"happy-dom": "15.11.6",
67-
"jest-preview": "0.3.1",
6865
"knip": "5.37.2",
6966
"lefthook": "1.8.4",
7067
"npm-run-all": "4.1.5",
@@ -89,4 +86,4 @@
8986
"node": ">=22.11.0",
9087
"pnpm": ">=9.14.2"
9188
}
92-
}
89+
}

vitest.workspace.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
import { defineWorkspace } from "vitest/config"
22

3+
// biome-ignore lint/nursery/noProcessEnv: Figure out the bug with --browser.headless, should work without this at all
4+
const isHeadless= process.argv.includes("--browser.headless") || !!process.env.CI;
5+
36
export default defineWorkspace([
47
{
58
extends: "./vitest.config.ts",
@@ -25,9 +28,8 @@ export default defineWorkspace([
2528
setupFiles: ["./tests/setup.browser.tsx"],
2629
name: "browser tests",
2730
browser: {
28-
// biome-ignore lint/nursery/noProcessEnv: we want to use process.env here
29-
headless: !!process.env.CI,
3031
enabled: true,
32+
headless: isHeadless,
3133
name: "chromium",
3234
provider: "playwright",
3335
// https://playwright.dev

0 commit comments

Comments
 (0)