Thomas G. Lopes commited on
Commit
a76eef5
·
unverified ·
1 Parent(s): 15094ac

add tests (#88)

Browse files
.github/workflows/{lint-and-test.yml → lint.yml} RENAMED
File without changes
.github/workflows/test.yml ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Test
2
+ on:
3
+ pull_request:
4
+ push:
5
+ branches:
6
+ - main
7
+ jobs:
8
+ test:
9
+ runs-on: ubuntu-latest
10
+ timeout-minutes: 10
11
+ steps:
12
+ - uses: actions/checkout@v3
13
+ - uses: actions/setup-node@v3
14
+ with:
15
+ node-version: "20"
16
+ - name: Install pnpm
17
+ uses: pnpm/action-setup@v2
18
+ with:
19
+ version: latest
20
+ run_install: false
21
+ - name: Get pnpm store directory
22
+ id: pnpm-cache
23
+ shell: bash
24
+ run: |
25
+ echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
26
+ - uses: actions/cache@v3
27
+ with:
28
+ path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
29
+ key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
30
+ restore-keys: |
31
+ ${{ runner.os }}-pnpm-store-
32
+ - name: Install dependencies
33
+ run: pnpm install --frozen-lockfile
34
+ - name: Install Playwright Browsers
35
+ run: npx playwright install --with-deps
36
+ - name: "Running tests"
37
+ run: |
38
+ pnpm run test
.gitignore CHANGED
@@ -1,3 +1,4 @@
 
1
  node_modules
2
 
3
  # Output
@@ -23,3 +24,5 @@ vite.config.ts.timestamp-*
23
 
24
  # Model JSON file
25
  models.json
 
 
 
1
+ test-results
2
  node_modules
3
 
4
  # Output
 
24
 
25
  # Model JSON file
26
  models.json
27
+
28
+ e2e/*.json
e2e/home.test.ts ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { expect, test } from "@playwright/test";
2
+
3
+ const HF_TOKEN = "hf_aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa";
4
+ const HF_TOKEN_STORAGE_KEY = "hf_token";
5
+ const STORAGE_STATE_FILE = "e2e/home_test_storage_state.json";
6
+
7
+ test("home page has expected token model", async ({ page }) => {
8
+ await page.goto("/");
9
+ await expect(page.getByText("Add a Hugging Face Token")).toBeVisible();
10
+ });
11
+
12
+ // Group tests that depend on sequential execution and shared state
13
+ test.describe.serial("Token Handling and Subsequent Tests", () => {
14
+ // Test that sets the token and saves state
15
+ test("filling up token input, closes modal, and saves state", async ({ page }) => {
16
+ await page.goto("/");
17
+ await expect(page.getByText("Add a Hugging Face Token")).toBeVisible();
18
+
19
+ const input = page.getByPlaceholder("Enter HF Token");
20
+ await expect(input).toBeVisible();
21
+ await input.fill(HF_TOKEN);
22
+ await input.blur();
23
+
24
+ await page.getByText("Submit").click();
25
+ await expect(page.getByText("Add a Hugging Face Token")).not.toBeVisible();
26
+
27
+ // Save storage state
28
+ await page.context().storageState({ path: STORAGE_STATE_FILE });
29
+ });
30
+
31
+ // Nested describe for tests that use the saved state
32
+ test.describe("Tests requiring persisted token", () => {
33
+ test.use({ storageState: STORAGE_STATE_FILE });
34
+
35
+ test("can create a conversation with persisted token", async ({ page }) => {
36
+ await page.goto("/");
37
+
38
+ // Expect modal NOT to be visible due to persisted token
39
+ await expect(page.getByText("Add a Hugging Face Token")).not.toBeVisible();
40
+
41
+ // Verify token is in localStorage
42
+ const storedToken = await page.evaluate(
43
+ key => JSON.parse(window.localStorage.getItem(key) ?? ""),
44
+ HF_TOKEN_STORAGE_KEY
45
+ );
46
+ expect(storedToken).toBe(HF_TOKEN);
47
+
48
+ const userInput = page.getByRole("textbox", { name: "Enter user message" });
49
+ await expect(userInput).toBeVisible();
50
+ await userInput.fill("Hello Hugging Face!");
51
+ await userInput.blur();
52
+ expect(await userInput.inputValue()).toBe("Hello Hugging Face!");
53
+
54
+ // Reload the page
55
+ await page.reload();
56
+
57
+ // Re-select the input field and check its value
58
+ const userInputAfterReload = page.getByRole("textbox", { name: "Enter user message" });
59
+ await expect(userInputAfterReload).toBeVisible();
60
+ expect(await userInputAfterReload.inputValue()).toBe("Hello Hugging Face!");
61
+ });
62
+ });
63
+ });
package.json CHANGED
@@ -14,7 +14,8 @@
14
  "clean": "rm -rf ./node_modules/ && rm -rf ./.svelte-kit/ && ni && echo 'Project cleaned!'",
15
  "update-ctx-length": "jiti scripts/update-ctx-length.ts",
16
  "test:unit": "vitest",
17
- "test": "npm run test:unit -- --run"
 
18
  },
19
  "devDependencies": {
20
  "@eslint/eslintrc": "^3.3.0",
@@ -26,6 +27,7 @@
26
  "@huggingface/transformers": "^3.5.1",
27
  "@iconify-json/carbon": "^1.2.8",
28
  "@iconify-json/material-symbols": "^1.2.15",
 
29
  "@ryoppippi/unplugin-typia": "^1.0.0",
30
  "@samchon/openapi": "^3.0.0",
31
  "@sveltejs/adapter-auto": "^3.2.2",
@@ -37,17 +39,20 @@
37
  "@testing-library/jest-dom": "^6.6.3",
38
  "@testing-library/svelte": "^5.2.4",
39
  "@types/node": "^22.14.1",
 
40
  "clsx": "^2.1.1",
41
  "dotenv": "^16.5.0",
42
  "eslint": "^9.22.0",
43
  "eslint-config-prettier": "^10.1.1",
44
  "eslint-plugin-prettier": "^5.2.3",
 
45
  "globals": "^16.0.0",
46
  "highlight.js": "^11.10.0",
47
  "jiti": "^2.4.2",
48
  "jsdom": "^26.0.0",
49
  "melt": "^0.30.1",
50
  "openai": "^4.90.0",
 
51
  "postcss": "^8.4.38",
52
  "prettier": "^3.1.1",
53
  "prettier-plugin-svelte": "^3.4.0",
@@ -64,7 +69,8 @@
64
  "typescript-eslint": "^8.26.1",
65
  "unplugin-icons": "^22.1.0",
66
  "vite": "^5.4.4",
67
- "vitest": "^3.0.0"
 
68
  },
69
  "type": "module",
70
  "dependencies": {
 
14
  "clean": "rm -rf ./node_modules/ && rm -rf ./.svelte-kit/ && ni && echo 'Project cleaned!'",
15
  "update-ctx-length": "jiti scripts/update-ctx-length.ts",
16
  "test:unit": "vitest",
17
+ "test": "npm run test:unit -- --run && npm run test:e2e",
18
+ "test:e2e": "playwright test"
19
  },
20
  "devDependencies": {
21
  "@eslint/eslintrc": "^3.3.0",
 
27
  "@huggingface/transformers": "^3.5.1",
28
  "@iconify-json/carbon": "^1.2.8",
29
  "@iconify-json/material-symbols": "^1.2.15",
30
+ "@playwright/test": "^1.49.1",
31
  "@ryoppippi/unplugin-typia": "^1.0.0",
32
  "@samchon/openapi": "^3.0.0",
33
  "@sveltejs/adapter-auto": "^3.2.2",
 
39
  "@testing-library/jest-dom": "^6.6.3",
40
  "@testing-library/svelte": "^5.2.4",
41
  "@types/node": "^22.14.1",
42
+ "@vitest/browser": "^3.1.4",
43
  "clsx": "^2.1.1",
44
  "dotenv": "^16.5.0",
45
  "eslint": "^9.22.0",
46
  "eslint-config-prettier": "^10.1.1",
47
  "eslint-plugin-prettier": "^5.2.3",
48
+ "fake-indexeddb": "^6.0.1",
49
  "globals": "^16.0.0",
50
  "highlight.js": "^11.10.0",
51
  "jiti": "^2.4.2",
52
  "jsdom": "^26.0.0",
53
  "melt": "^0.30.1",
54
  "openai": "^4.90.0",
55
+ "playwright": "^1.52.0",
56
  "postcss": "^8.4.38",
57
  "prettier": "^3.1.1",
58
  "prettier-plugin-svelte": "^3.4.0",
 
69
  "typescript-eslint": "^8.26.1",
70
  "unplugin-icons": "^22.1.0",
71
  "vite": "^5.4.4",
72
+ "vitest": "^3.0.0",
73
+ "vitest-browser-svelte": "^0.1.0"
74
  },
75
  "type": "module",
76
  "dependencies": {
playwright.config.ts ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ import { defineConfig } from "@playwright/test";
2
+
3
+ export default defineConfig({
4
+ webServer: {
5
+ command: "npm run build && npm run preview",
6
+ port: 4173,
7
+ timeout: 1000 * 60 * 10,
8
+ },
9
+ testDir: "e2e",
10
+ });
pnpm-lock.yaml CHANGED
@@ -48,6 +48,9 @@ importers:
48
  '@iconify-json/material-symbols':
49
  specifier: ^1.2.15
50
  version: 1.2.15
 
 
 
51
  '@ryoppippi/unplugin-typia':
52
  specifier: ^1.0.0
53
  version: 1.2.0(@samchon/openapi@3.0.0)(@types/node@22.14.1)(jiti@2.4.2)(lightningcss@1.29.1)(rollup@4.34.9)(yaml@2.7.0)
@@ -77,10 +80,13 @@ importers:
77
  version: 6.6.3
78
  '@testing-library/svelte':
79
  specifier: ^5.2.4
80
- version: 5.2.8(svelte@5.30.1)(vite@5.4.14(@types/node@22.14.1)(lightningcss@1.29.1))(vitest@3.1.4(@types/node@22.14.1)(jsdom@26.1.0)(lightningcss@1.29.1))
81
  '@types/node':
82
  specifier: ^22.14.1
83
  version: 22.14.1
 
 
 
84
  clsx:
85
  specifier: ^2.1.1
86
  version: 2.1.1
@@ -96,6 +102,9 @@ importers:
96
  eslint-plugin-prettier:
97
  specifier: ^5.2.3
98
  version: 5.2.3(eslint-config-prettier@10.1.1(eslint@9.22.0(jiti@2.4.2)))(eslint@9.22.0(jiti@2.4.2))(prettier@3.5.3)
 
 
 
99
  globals:
100
  specifier: ^16.0.0
101
  version: 16.0.0
@@ -114,6 +123,9 @@ importers:
114
  openai:
115
  specifier: ^4.90.0
116
  version: 4.90.0(ws@8.18.2)
 
 
 
117
  postcss:
118
  specifier: ^8.4.38
119
  version: 8.5.3
@@ -164,7 +176,10 @@ importers:
164
  version: 5.4.14(@types/node@22.14.1)(lightningcss@1.29.1)
165
  vitest:
166
  specifier: ^3.0.0
167
- version: 3.1.4(@types/node@22.14.1)(jsdom@26.1.0)(lightningcss@1.29.1)
 
 
 
168
 
169
  packages:
170
 
@@ -786,6 +801,11 @@ packages:
786
  resolution: {integrity: sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==}
787
  engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0}
788
 
 
 
 
 
 
789
  '@polka/url@1.0.0-next.28':
790
  resolution: {integrity: sha512-8LduaNlMZGwdZ6qWrKlfa+2M4gahzFkprZiAt2TF8uS0qQgBizKXpXURqvTJ4WtmupWxaLqjRb2UCTe72mu+Aw==}
791
 
@@ -1121,6 +1141,12 @@ packages:
1121
  vitest:
1122
  optional: true
1123
 
 
 
 
 
 
 
1124
  '@types/aria-query@5.0.4':
1125
  resolution: {integrity: sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==}
1126
 
@@ -1204,6 +1230,21 @@ packages:
1204
  '@ungap/structured-clone@1.3.0':
1205
  resolution: {integrity: sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==}
1206
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1207
  '@vitest/expect@3.1.4':
1208
  resolution: {integrity: sha512-xkD/ljeliyaClDYqHPNCiJ0plY5YIcM0OlRiZizLhlPmpXWpxnGMyTZXOHFhFeG7w9P5PBeL4IdtJ/HeQwTbQA==}
1209
 
@@ -1714,6 +1755,10 @@ packages:
1714
  resolution: {integrity: sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==}
1715
  engines: {node: '>=4'}
1716
 
 
 
 
 
1717
  fast-deep-equal@3.1.3:
1718
  resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==}
1719
 
@@ -1794,6 +1839,11 @@ packages:
1794
  resolution: {integrity: sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ==}
1795
  engines: {node: '>= 12.20'}
1796
 
 
 
 
 
 
1797
  fsevents@2.3.3:
1798
  resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==}
1799
  engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
@@ -2426,6 +2476,16 @@ packages:
2426
  platform@1.3.6:
2427
  resolution: {integrity: sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==}
2428
 
 
 
 
 
 
 
 
 
 
 
2429
  postcss-load-config@3.1.4:
2430
  resolution: {integrity: sha512-6DiM4E7v4coTE4uzA8U//WhtPwyhiim3eyjEMFCnUpzbrkK9wJHgKDT2mR+HbtSrd/NubVaYTOpSpjUl8NQeRg==}
2431
  engines: {node: '>= 10'}
@@ -3074,6 +3134,14 @@ packages:
3074
  vite:
3075
  optional: true
3076
 
 
 
 
 
 
 
 
 
3077
  vitest@3.1.4:
3078
  resolution: {integrity: sha512-Ta56rT7uWxCSJXlBtKgIlApJnT6e6IGmTYxYcmxjJ4ujuZDI59GUQgVDObXXJujOmPDBYXHK1qmaGtneu6TNIQ==}
3079
  engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0}
@@ -3651,6 +3719,10 @@ snapshots:
3651
 
3652
  '@pkgr/core@0.1.1': {}
3653
 
 
 
 
 
3654
  '@polka/url@1.0.0-next.28': {}
3655
 
3656
  '@protobufjs/aspromise@1.1.2': {}
@@ -3979,13 +4051,17 @@ snapshots:
3979
  lodash: 4.17.21
3980
  redent: 3.0.0
3981
 
3982
- '@testing-library/svelte@5.2.8(svelte@5.30.1)(vite@5.4.14(@types/node@22.14.1)(lightningcss@1.29.1))(vitest@3.1.4(@types/node@22.14.1)(jsdom@26.1.0)(lightningcss@1.29.1))':
3983
  dependencies:
3984
  '@testing-library/dom': 10.4.0
3985
  svelte: 5.30.1
3986
  optionalDependencies:
3987
  vite: 5.4.14(@types/node@22.14.1)(lightningcss@1.29.1)
3988
- vitest: 3.1.4(@types/node@22.14.1)(jsdom@26.1.0)(lightningcss@1.29.1)
 
 
 
 
3989
 
3990
  '@types/aria-query@5.0.4': {}
3991
 
@@ -4099,6 +4175,25 @@ snapshots:
4099
 
4100
  '@ungap/structured-clone@1.3.0': {}
4101
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4102
  '@vitest/expect@3.1.4':
4103
  dependencies:
4104
  '@vitest/spy': 3.1.4
@@ -4620,6 +4715,8 @@ snapshots:
4620
  iconv-lite: 0.4.24
4621
  tmp: 0.0.33
4622
 
 
 
4623
  fast-deep-equal@3.1.3: {}
4624
 
4625
  fast-diff@1.3.0: {}
@@ -4698,6 +4795,9 @@ snapshots:
4698
  node-domexception: 1.0.0
4699
  web-streams-polyfill: 4.0.0-beta.3
4700
 
 
 
 
4701
  fsevents@2.3.3:
4702
  optional: true
4703
 
@@ -5317,6 +5417,14 @@ snapshots:
5317
 
5318
  platform@1.3.6: {}
5319
 
 
 
 
 
 
 
 
 
5320
  postcss-load-config@3.1.4(postcss@8.5.3):
5321
  dependencies:
5322
  lilconfig: 2.1.0
@@ -5916,7 +6024,13 @@ snapshots:
5916
  optionalDependencies:
5917
  vite: 5.4.14(@types/node@22.14.1)(lightningcss@1.29.1)
5918
 
5919
- vitest@3.1.4(@types/node@22.14.1)(jsdom@26.1.0)(lightningcss@1.29.1):
 
 
 
 
 
 
5920
  dependencies:
5921
  '@vitest/expect': 3.1.4
5922
  '@vitest/mocker': 3.1.4(vite@5.4.14(@types/node@22.14.1)(lightningcss@1.29.1))
@@ -5941,6 +6055,7 @@ snapshots:
5941
  why-is-node-running: 2.3.0
5942
  optionalDependencies:
5943
  '@types/node': 22.14.1
 
5944
  jsdom: 26.1.0
5945
  transitivePeerDependencies:
5946
  - less
 
48
  '@iconify-json/material-symbols':
49
  specifier: ^1.2.15
50
  version: 1.2.15
51
+ '@playwright/test':
52
+ specifier: ^1.49.1
53
+ version: 1.52.0
54
  '@ryoppippi/unplugin-typia':
55
  specifier: ^1.0.0
56
  version: 1.2.0(@samchon/openapi@3.0.0)(@types/node@22.14.1)(jiti@2.4.2)(lightningcss@1.29.1)(rollup@4.34.9)(yaml@2.7.0)
 
80
  version: 6.6.3
81
  '@testing-library/svelte':
82
  specifier: ^5.2.4
83
+ version: 5.2.8(svelte@5.30.1)(vite@5.4.14(@types/node@22.14.1)(lightningcss@1.29.1))(vitest@3.1.4)
84
  '@types/node':
85
  specifier: ^22.14.1
86
  version: 22.14.1
87
+ '@vitest/browser':
88
+ specifier: ^3.1.4
89
+ version: 3.1.4(playwright@1.52.0)(vite@5.4.14(@types/node@22.14.1)(lightningcss@1.29.1))(vitest@3.1.4)
90
  clsx:
91
  specifier: ^2.1.1
92
  version: 2.1.1
 
102
  eslint-plugin-prettier:
103
  specifier: ^5.2.3
104
  version: 5.2.3(eslint-config-prettier@10.1.1(eslint@9.22.0(jiti@2.4.2)))(eslint@9.22.0(jiti@2.4.2))(prettier@3.5.3)
105
+ fake-indexeddb:
106
+ specifier: ^6.0.1
107
+ version: 6.0.1
108
  globals:
109
  specifier: ^16.0.0
110
  version: 16.0.0
 
123
  openai:
124
  specifier: ^4.90.0
125
  version: 4.90.0(ws@8.18.2)
126
+ playwright:
127
+ specifier: ^1.52.0
128
+ version: 1.52.0
129
  postcss:
130
  specifier: ^8.4.38
131
  version: 8.5.3
 
176
  version: 5.4.14(@types/node@22.14.1)(lightningcss@1.29.1)
177
  vitest:
178
  specifier: ^3.0.0
179
+ version: 3.1.4(@types/node@22.14.1)(@vitest/browser@3.1.4)(jsdom@26.1.0)(lightningcss@1.29.1)
180
+ vitest-browser-svelte:
181
+ specifier: ^0.1.0
182
+ version: 0.1.0(@vitest/browser@3.1.4)(svelte@5.30.1)(vitest@3.1.4)
183
 
184
  packages:
185
 
 
801
  resolution: {integrity: sha512-cq8o4cWH0ibXh9VGi5P20Tu9XF/0fFXl9EUinr9QfTM7a7p0oTA4iJRCQWppXR1Pg8dSM0UCItCkPwsk9qWWYA==}
802
  engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0}
803
 
804
+ '@playwright/test@1.52.0':
805
+ resolution: {integrity: sha512-uh6W7sb55hl7D6vsAeA+V2p5JnlAqzhqFyF0VcJkKZXkgnFcVG9PziERRHQfPLfNGx1C292a4JqbWzhR8L4R1g==}
806
+ engines: {node: '>=18'}
807
+ hasBin: true
808
+
809
  '@polka/url@1.0.0-next.28':
810
  resolution: {integrity: sha512-8LduaNlMZGwdZ6qWrKlfa+2M4gahzFkprZiAt2TF8uS0qQgBizKXpXURqvTJ4WtmupWxaLqjRb2UCTe72mu+Aw==}
811
 
 
1141
  vitest:
1142
  optional: true
1143
 
1144
+ '@testing-library/user-event@14.6.1':
1145
+ resolution: {integrity: sha512-vq7fv0rnt+QTXgPxr5Hjc210p6YKq2kmdziLgnsZGgLJ9e6VAShx1pACLuRjd/AS/sr7phAR58OIIpf0LlmQNw==}
1146
+ engines: {node: '>=12', npm: '>=6'}
1147
+ peerDependencies:
1148
+ '@testing-library/dom': '>=7.21.4'
1149
+
1150
  '@types/aria-query@5.0.4':
1151
  resolution: {integrity: sha512-rfT93uj5s0PRL7EzccGMs3brplhcrghnDoV26NqKhCAS1hVo+WdNsPvE/yb6ilfr5hi2MEk6d5EWJTKdxg8jVw==}
1152
 
 
1230
  '@ungap/structured-clone@1.3.0':
1231
  resolution: {integrity: sha512-WmoN8qaIAo7WTYWbAZuG8PYEhn5fkz7dZrqTBZ7dtt//lL2Gwms1IcnQ5yHqjDfX8Ft5j4YzDM23f87zBfDe9g==}
1232
 
1233
+ '@vitest/browser@3.1.4':
1234
+ resolution: {integrity: sha512-2L4vR/tuUZBxKU72Qe+unIp1P8lZ0T5nlqPegkXxyZFR5gWqItV8VPPR261GOzl49Zw2AhzMABzMMHJagQ0a2g==}
1235
+ peerDependencies:
1236
+ playwright: '*'
1237
+ safaridriver: '*'
1238
+ vitest: 3.1.4
1239
+ webdriverio: ^7.0.0 || ^8.0.0 || ^9.0.0
1240
+ peerDependenciesMeta:
1241
+ playwright:
1242
+ optional: true
1243
+ safaridriver:
1244
+ optional: true
1245
+ webdriverio:
1246
+ optional: true
1247
+
1248
  '@vitest/expect@3.1.4':
1249
  resolution: {integrity: sha512-xkD/ljeliyaClDYqHPNCiJ0plY5YIcM0OlRiZizLhlPmpXWpxnGMyTZXOHFhFeG7w9P5PBeL4IdtJ/HeQwTbQA==}
1250
 
 
1755
  resolution: {integrity: sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==}
1756
  engines: {node: '>=4'}
1757
 
1758
+ fake-indexeddb@6.0.1:
1759
+ resolution: {integrity: sha512-He2AjQGHe46svIFq5+L2Nx/eHDTI1oKgoevBP+TthnjymXiKkeJQ3+ITeWey99Y5+2OaPFbI1qEsx/5RsGtWnQ==}
1760
+ engines: {node: '>=18'}
1761
+
1762
  fast-deep-equal@3.1.3:
1763
  resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==}
1764
 
 
1839
  resolution: {integrity: sha512-0iirZp3uVDjVGt9p49aTaqjk84TrglENEDuqfdlZQ1roC9CWlPk6Avf8EEnZNcAqPonwkG35x4n3ww/1THYAeQ==}
1840
  engines: {node: '>= 12.20'}
1841
 
1842
+ fsevents@2.3.2:
1843
+ resolution: {integrity: sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==}
1844
+ engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
1845
+ os: [darwin]
1846
+
1847
  fsevents@2.3.3:
1848
  resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==}
1849
  engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0}
 
2476
  platform@1.3.6:
2477
  resolution: {integrity: sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==}
2478
 
2479
+ playwright-core@1.52.0:
2480
+ resolution: {integrity: sha512-l2osTgLXSMeuLZOML9qYODUQoPPnUsKsb5/P6LJ2e6uPKXUdPK5WYhN4z03G+YNbWmGDY4YENauNu4ZKczreHg==}
2481
+ engines: {node: '>=18'}
2482
+ hasBin: true
2483
+
2484
+ playwright@1.52.0:
2485
+ resolution: {integrity: sha512-JAwMNMBlxJ2oD1kce4KPtMkDeKGHQstdpFPcPH3maElAXon/QZeTvtsfXmTMRyO9TslfoYOXkSsvao2nE1ilTw==}
2486
+ engines: {node: '>=18'}
2487
+ hasBin: true
2488
+
2489
  postcss-load-config@3.1.4:
2490
  resolution: {integrity: sha512-6DiM4E7v4coTE4uzA8U//WhtPwyhiim3eyjEMFCnUpzbrkK9wJHgKDT2mR+HbtSrd/NubVaYTOpSpjUl8NQeRg==}
2491
  engines: {node: '>= 10'}
 
3134
  vite:
3135
  optional: true
3136
 
3137
+ vitest-browser-svelte@0.1.0:
3138
+ resolution: {integrity: sha512-YB6ZUZZQNqU1T9NzvTEDpwpPv35Ng1NZMPBh81zDrLEdOgROGE6nJb79NWb1Eu/a8VkHifqArpOZfJfALge6xQ==}
3139
+ engines: {node: ^18.0.0 || >=20.0.0}
3140
+ peerDependencies:
3141
+ '@vitest/browser': ^2.1.0 || ^3.0.0-0
3142
+ svelte: '>3.0.0'
3143
+ vitest: ^2.1.0 || ^3.0.0-0
3144
+
3145
  vitest@3.1.4:
3146
  resolution: {integrity: sha512-Ta56rT7uWxCSJXlBtKgIlApJnT6e6IGmTYxYcmxjJ4ujuZDI59GUQgVDObXXJujOmPDBYXHK1qmaGtneu6TNIQ==}
3147
  engines: {node: ^18.0.0 || ^20.0.0 || >=22.0.0}
 
3719
 
3720
  '@pkgr/core@0.1.1': {}
3721
 
3722
+ '@playwright/test@1.52.0':
3723
+ dependencies:
3724
+ playwright: 1.52.0
3725
+
3726
  '@polka/url@1.0.0-next.28': {}
3727
 
3728
  '@protobufjs/aspromise@1.1.2': {}
 
4051
  lodash: 4.17.21
4052
  redent: 3.0.0
4053
 
4054
+ '@testing-library/svelte@5.2.8(svelte@5.30.1)(vite@5.4.14(@types/node@22.14.1)(lightningcss@1.29.1))(vitest@3.1.4)':
4055
  dependencies:
4056
  '@testing-library/dom': 10.4.0
4057
  svelte: 5.30.1
4058
  optionalDependencies:
4059
  vite: 5.4.14(@types/node@22.14.1)(lightningcss@1.29.1)
4060
+ vitest: 3.1.4(@types/node@22.14.1)(@vitest/browser@3.1.4)(jsdom@26.1.0)(lightningcss@1.29.1)
4061
+
4062
+ '@testing-library/user-event@14.6.1(@testing-library/dom@10.4.0)':
4063
+ dependencies:
4064
+ '@testing-library/dom': 10.4.0
4065
 
4066
  '@types/aria-query@5.0.4': {}
4067
 
 
4175
 
4176
  '@ungap/structured-clone@1.3.0': {}
4177
 
4178
+ '@vitest/browser@3.1.4(playwright@1.52.0)(vite@5.4.14(@types/node@22.14.1)(lightningcss@1.29.1))(vitest@3.1.4)':
4179
+ dependencies:
4180
+ '@testing-library/dom': 10.4.0
4181
+ '@testing-library/user-event': 14.6.1(@testing-library/dom@10.4.0)
4182
+ '@vitest/mocker': 3.1.4(vite@5.4.14(@types/node@22.14.1)(lightningcss@1.29.1))
4183
+ '@vitest/utils': 3.1.4
4184
+ magic-string: 0.30.17
4185
+ sirv: 3.0.1
4186
+ tinyrainbow: 2.0.0
4187
+ vitest: 3.1.4(@types/node@22.14.1)(@vitest/browser@3.1.4)(jsdom@26.1.0)(lightningcss@1.29.1)
4188
+ ws: 8.18.2
4189
+ optionalDependencies:
4190
+ playwright: 1.52.0
4191
+ transitivePeerDependencies:
4192
+ - bufferutil
4193
+ - msw
4194
+ - utf-8-validate
4195
+ - vite
4196
+
4197
  '@vitest/expect@3.1.4':
4198
  dependencies:
4199
  '@vitest/spy': 3.1.4
 
4715
  iconv-lite: 0.4.24
4716
  tmp: 0.0.33
4717
 
4718
+ fake-indexeddb@6.0.1: {}
4719
+
4720
  fast-deep-equal@3.1.3: {}
4721
 
4722
  fast-diff@1.3.0: {}
 
4795
  node-domexception: 1.0.0
4796
  web-streams-polyfill: 4.0.0-beta.3
4797
 
4798
+ fsevents@2.3.2:
4799
+ optional: true
4800
+
4801
  fsevents@2.3.3:
4802
  optional: true
4803
 
 
5417
 
5418
  platform@1.3.6: {}
5419
 
5420
+ playwright-core@1.52.0: {}
5421
+
5422
+ playwright@1.52.0:
5423
+ dependencies:
5424
+ playwright-core: 1.52.0
5425
+ optionalDependencies:
5426
+ fsevents: 2.3.2
5427
+
5428
  postcss-load-config@3.1.4(postcss@8.5.3):
5429
  dependencies:
5430
  lilconfig: 2.1.0
 
6024
  optionalDependencies:
6025
  vite: 5.4.14(@types/node@22.14.1)(lightningcss@1.29.1)
6026
 
6027
+ vitest-browser-svelte@0.1.0(@vitest/browser@3.1.4)(svelte@5.30.1)(vitest@3.1.4):
6028
+ dependencies:
6029
+ '@vitest/browser': 3.1.4(playwright@1.52.0)(vite@5.4.14(@types/node@22.14.1)(lightningcss@1.29.1))(vitest@3.1.4)
6030
+ svelte: 5.30.1
6031
+ vitest: 3.1.4(@types/node@22.14.1)(@vitest/browser@3.1.4)(jsdom@26.1.0)(lightningcss@1.29.1)
6032
+
6033
+ vitest@3.1.4(@types/node@22.14.1)(@vitest/browser@3.1.4)(jsdom@26.1.0)(lightningcss@1.29.1):
6034
  dependencies:
6035
  '@vitest/expect': 3.1.4
6036
  '@vitest/mocker': 3.1.4(vite@5.4.14(@types/node@22.14.1)(lightningcss@1.29.1))
 
6055
  why-is-node-running: 2.3.0
6056
  optionalDependencies:
6057
  '@types/node': 22.14.1
6058
+ '@vitest/browser': 3.1.4(playwright@1.52.0)(vite@5.4.14(@types/node@22.14.1)(lightningcss@1.29.1))(vitest@3.1.4)
6059
  jsdom: 26.1.0
6060
  transitivePeerDependencies:
6061
  - less
scripts/setup-playwright-arch.sh ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/bin/bash
2
+
3
+ sudo ln /usr/lib/libpcre.so.1 /usr/lib/libpcre.so.3
4
+
5
+ git clone https://github.com/festvox/flite.git
6
+ cd flite
7
+ ./configure --enable-shared
8
+ make
9
+ make get_voices
10
+
11
+ sudo cp build/x86_64-linux-gnu/lib/libflite.so.1 /usr/lib
12
+ sudo cp build/x86_64-linux-gnu/lib/libflite_cmu_grapheme_lang.so.1 /usr/lib
13
+ sudo cp build/x86_64-linux-gnu/lib/libflite_cmu_grapheme_lex.so.1 /usr/lib
14
+ sudo cp build/x86_64-linux-gnu/lib/libflite_cmu_indic_lang.so.1 /usr/lib
15
+ sudo cp build/x86_64-linux-gnu/lib/libflite_cmu_indic_lex.so.1 /usr/lib
16
+ sudo cp build/x86_64-linux-gnu/lib/libflite_cmu_time_awb.so.1 /usr/lib
17
+ sudo cp build/x86_64-linux-gnu/lib/libflite_cmu_us_awb.so.1 /usr/lib
18
+ sudo cp build/x86_64-linux-gnu/lib/libflite_cmu_us_kal.so.1 /usr/lib
19
+ sudo cp build/x86_64-linux-gnu/lib/libflite_cmu_us_kal16.so.1 /usr/lib
20
+ sudo cp build/x86_64-linux-gnu/lib/libflite_cmu_us_rms.so.1 /usr/lib
21
+ sudo cp build/x86_64-linux-gnu/lib/libflite_cmu_us_slt.so.1 /usr/lib
22
+ sudo cp build/x86_64-linux-gnu/lib/libflite_cmulex.so.1 /usr/lib
23
+ sudo cp build/x86_64-linux-gnu/lib/libflite_usenglish.so.1 /usr/lib
src/app.html CHANGED
@@ -4,6 +4,7 @@
4
  <meta charset="utf-8" />
5
  <link rel="icon" href="%sveltekit.assets%/favicon.png" />
6
  <meta name="viewport" content="width=device-width, initial-scale=1" />
 
7
  %sveltekit.head%
8
  </head>
9
 
@@ -47,6 +48,7 @@
47
  });
48
  })();
49
  </script>
50
- <div style="display: contents">%sveltekit.body%</div>
 
51
  </body>
52
  </html>
 
4
  <meta charset="utf-8" />
5
  <link rel="icon" href="%sveltekit.assets%/favicon.png" />
6
  <meta name="viewport" content="width=device-width, initial-scale=1" />
7
+ <title>Hugging Face Playground</title>
8
  %sveltekit.head%
9
  </head>
10
 
 
48
  });
49
  })();
50
  </script>
51
+
52
+ <div>%sveltekit.body%</div>
53
  </body>
54
  </html>
src/lib/data/context_length.json CHANGED
@@ -215,7 +215,6 @@
215
  "togethercomputer/m2-bert-80M-32k-retrieval": 32768,
216
  "cartesia/sonic": 0,
217
  "scb10x/scb10x-llama3-1-typhoon2-8b-instruct": 8192,
218
- "meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo": 130815,
219
  "Qwen/Qwen2.5-7B-Instruct-Turbo": 32768,
220
  "deepseek-ai/DeepSeek-R1-Distill-Llama-70B-free": 8192,
221
  "meta-llama-llama-2-70b-hf": 4096,
@@ -230,22 +229,20 @@
230
  "cartesia/sonic-2": 0,
231
  "togethercomputer/m2-bert-80M-8k-retrieval": 8192,
232
  "meta-llama/Llama-3.3-70B-Instruct-Turbo-Free": 131072,
 
233
  "deepseek-ai/DeepSeek-V3": 131072,
234
- "scb10x/scb10x-llama3-1-typhoon2-70b-instruct": 8192,
235
  "togethercomputer/Refuel-Llm-V2-Small": 8192,
236
  "togethercomputer/MoA-1": 32768,
237
  "meta-llama/Meta-Llama-3-70B-Instruct-Turbo": 8192,
238
  "google/gemma-2b-it": 8192,
239
  "meta-llama/Llama-3.2-11B-Vision-Instruct-Turbo": 131072,
240
  "Gryphe/MythoMax-L2-13b-Lite": 4096,
241
- "Qwen/Qwen3-235B-A22B-fp8": 40960,
242
  "meta-llama/Meta-Llama-Guard-3-8B": 8192,
243
  "marin-community/marin-8b-instruct": 131072,
244
  "deepseek-ai/DeepSeek-R1": 163840,
245
  "meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo": 131072,
246
  "Qwen/Qwen2.5-VL-72B-Instruct": 32768,
247
  "arcee-ai/arcee-blitz": 32768,
248
- "arcee_ai/arcee-spotlight": 131072,
249
  "arcee-ai/caller": 32768,
250
  "arcee-ai/coder-large": 32768,
251
  "arcee-ai/maestro-reasoning": 131072,
@@ -254,15 +251,20 @@
254
  "meta-llama/Llama-3.2-90B-Vision-Instruct-Turbo": 131072,
255
  "meta-llama/Llama-3-8b-chat-hf": 8192,
256
  "mistralai/Mistral-Small-24B-Instruct-2501": 32768,
257
- "Qwen/Qwen3-235B-A22B-fp8-tput": 40960,
258
- "perplexity-ai/r1-1776": 163840,
259
  "meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8": 1048576,
260
  "togethercomputer/MoA-1-Turbo": 32768,
261
  "meta-llama/Llama-3.3-70B-Instruct-Turbo": 131072,
 
262
  "NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO": 32768,
263
  "deepseek-ai/DeepSeek-R1-Distill-Llama-70B": 131072,
264
  "deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B": 131072,
265
  "meta-llama/Meta-Llama-3-8B-Instruct-Lite": 8192,
 
 
 
 
 
 
266
  "meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo": 131072,
267
  "mistralai/Mistral-7B-Instruct-v0.2": 32768,
268
  "deepseek-ai/DeepSeek-V3-p-dp": 131072,
@@ -272,11 +274,9 @@
272
  "meta-llama/Llama-3-70b-chat-hf": 8192,
273
  "mistralai/Mistral-7B-Instruct-v0.3": 32768,
274
  "Salesforce/Llama-Rank-V1": 8192,
275
- "nvidia/Llama-3.1-Nemotron-70B-Instruct-HF": 32768,
276
  "meta-llama/Llama-Vision-Free": 131072,
277
  "meta-llama/Llama-Guard-3-11B-Vision-Turbo": 131072,
278
  "meta-llama/Llama-3.2-3B-Instruct-Turbo": 131072,
279
- "togethercomputer/Refuel-Llm-V2": 16384,
280
  "Qwen/Qwen2.5-72B-Instruct-Turbo": 131072,
281
  "meta-llama/Llama-2-70b-hf": 4096
282
  },
@@ -284,19 +284,19 @@
284
  "accounts/fireworks/models/qwq-32b": 131072,
285
  "accounts/fireworks/models/llama4-maverick-instruct-basic": 1048576,
286
  "accounts/fireworks/models/qwen3-30b-a3b": 40000,
 
 
 
287
  "accounts/fireworks/models/llama4-scout-instruct-basic": 1048576,
 
288
  "accounts/fireworks/models/firesearch-ocr-v6": 131072,
289
  "accounts/fireworks/models/deepseek-v3": 131072,
290
  "accounts/fireworks/models/llama-v3p1-8b-instruct": 131072,
291
  "accounts/fireworks/models/llama-v3p1-70b-instruct": 131072,
292
  "accounts/fireworks/models/deepseek-v3-0324": 163840,
293
  "accounts/fireworks/models/qwen3-235b-a22b": 128000,
294
- "accounts/fireworks/models/deepseek-r1-basic": 163840,
295
  "accounts/fireworks/models/llama-v3p3-70b-instruct": 131072,
296
  "accounts/fireworks/models/deepseek-r1": 163840,
297
- "accounts/fireworks/models/qwen2p5-vl-32b-instruct": 128000,
298
- "accounts/fireworks/models/qwen2-vl-72b-instruct": 32768,
299
- "accounts/fireworks/models/llama-guard-3-8b": 131072,
300
  "accounts/sentientfoundation/models/dobby-unhinged-llama-3-3-70b-new": 131072,
301
  "accounts/perplexity/models/r1-1776": 163840,
302
  "accounts/fireworks/models/llama-v3p1-405b-instruct": 131072,
 
215
  "togethercomputer/m2-bert-80M-32k-retrieval": 32768,
216
  "cartesia/sonic": 0,
217
  "scb10x/scb10x-llama3-1-typhoon2-8b-instruct": 8192,
 
218
  "Qwen/Qwen2.5-7B-Instruct-Turbo": 32768,
219
  "deepseek-ai/DeepSeek-R1-Distill-Llama-70B-free": 8192,
220
  "meta-llama-llama-2-70b-hf": 4096,
 
229
  "cartesia/sonic-2": 0,
230
  "togethercomputer/m2-bert-80M-8k-retrieval": 8192,
231
  "meta-llama/Llama-3.3-70B-Instruct-Turbo-Free": 131072,
232
+ "togethercomputer/Refuel-Llm-V2": 16384,
233
  "deepseek-ai/DeepSeek-V3": 131072,
 
234
  "togethercomputer/Refuel-Llm-V2-Small": 8192,
235
  "togethercomputer/MoA-1": 32768,
236
  "meta-llama/Meta-Llama-3-70B-Instruct-Turbo": 8192,
237
  "google/gemma-2b-it": 8192,
238
  "meta-llama/Llama-3.2-11B-Vision-Instruct-Turbo": 131072,
239
  "Gryphe/MythoMax-L2-13b-Lite": 4096,
 
240
  "meta-llama/Meta-Llama-Guard-3-8B": 8192,
241
  "marin-community/marin-8b-instruct": 131072,
242
  "deepseek-ai/DeepSeek-R1": 163840,
243
  "meta-llama/Meta-Llama-3.1-8B-Instruct-Turbo": 131072,
244
  "Qwen/Qwen2.5-VL-72B-Instruct": 32768,
245
  "arcee-ai/arcee-blitz": 32768,
 
246
  "arcee-ai/caller": 32768,
247
  "arcee-ai/coder-large": 32768,
248
  "arcee-ai/maestro-reasoning": 131072,
 
251
  "meta-llama/Llama-3.2-90B-Vision-Instruct-Turbo": 131072,
252
  "meta-llama/Llama-3-8b-chat-hf": 8192,
253
  "mistralai/Mistral-Small-24B-Instruct-2501": 32768,
 
 
254
  "meta-llama/Llama-4-Maverick-17B-128E-Instruct-FP8": 1048576,
255
  "togethercomputer/MoA-1-Turbo": 32768,
256
  "meta-llama/Llama-3.3-70B-Instruct-Turbo": 131072,
257
+ "perplexity-ai/r1-1776": 163840,
258
  "NousResearch/Nous-Hermes-2-Mixtral-8x7B-DPO": 32768,
259
  "deepseek-ai/DeepSeek-R1-Distill-Llama-70B": 131072,
260
  "deepseek-ai/DeepSeek-R1-Distill-Qwen-1.5B": 131072,
261
  "meta-llama/Meta-Llama-3-8B-Instruct-Lite": 8192,
262
+ "Qwen/Qwen3-235B-A22B-fp8": 40960,
263
+ "Qwen/Qwen3-235B-A22B-fp8-tput": 40960,
264
+ "nvidia/Llama-3.1-Nemotron-70B-Instruct-HF": 32768,
265
+ "arcee_ai/arcee-spotlight": 131072,
266
+ "meta-llama/Meta-Llama-3.1-405B-Instruct-Turbo": 130815,
267
+ "scb10x/scb10x-llama3-1-typhoon2-70b-instruct": 8192,
268
  "meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo": 131072,
269
  "mistralai/Mistral-7B-Instruct-v0.2": 32768,
270
  "deepseek-ai/DeepSeek-V3-p-dp": 131072,
 
274
  "meta-llama/Llama-3-70b-chat-hf": 8192,
275
  "mistralai/Mistral-7B-Instruct-v0.3": 32768,
276
  "Salesforce/Llama-Rank-V1": 8192,
 
277
  "meta-llama/Llama-Vision-Free": 131072,
278
  "meta-llama/Llama-Guard-3-11B-Vision-Turbo": 131072,
279
  "meta-llama/Llama-3.2-3B-Instruct-Turbo": 131072,
 
280
  "Qwen/Qwen2.5-72B-Instruct-Turbo": 131072,
281
  "meta-llama/Llama-2-70b-hf": 4096
282
  },
 
284
  "accounts/fireworks/models/qwq-32b": 131072,
285
  "accounts/fireworks/models/llama4-maverick-instruct-basic": 1048576,
286
  "accounts/fireworks/models/qwen3-30b-a3b": 40000,
287
+ "accounts/fireworks/models/deepseek-r1-basic": 163840,
288
+ "accounts/fireworks/models/llama-guard-3-8b": 131072,
289
+ "accounts/fireworks/models/qwen2p5-vl-32b-instruct": 128000,
290
  "accounts/fireworks/models/llama4-scout-instruct-basic": 1048576,
291
+ "accounts/fireworks/models/qwen2-vl-72b-instruct": 32768,
292
  "accounts/fireworks/models/firesearch-ocr-v6": 131072,
293
  "accounts/fireworks/models/deepseek-v3": 131072,
294
  "accounts/fireworks/models/llama-v3p1-8b-instruct": 131072,
295
  "accounts/fireworks/models/llama-v3p1-70b-instruct": 131072,
296
  "accounts/fireworks/models/deepseek-v3-0324": 163840,
297
  "accounts/fireworks/models/qwen3-235b-a22b": 128000,
 
298
  "accounts/fireworks/models/llama-v3p3-70b-instruct": 131072,
299
  "accounts/fireworks/models/deepseek-r1": 163840,
 
 
 
300
  "accounts/sentientfoundation/models/dobby-unhinged-llama-3-3-70b-new": 131072,
301
  "accounts/perplexity/models/r1-1776": 163840,
302
  "accounts/fireworks/models/llama-v3p1-405b-instruct": 131072,
src/lib/state/images.svelte.test.ts ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { describe, it, expect, vi, beforeEach, type Mock } from "vitest";
2
+ import { images } from "./images.svelte";
3
+ import { fileToDataURL, compressBase64Image } from "$lib/utils/file.js";
4
+ import { JsonEntityIndexedDbStorage } from "$lib/remult.js";
5
+
6
+ // Mock dependencies
7
+ vi.mock("$lib/utils/file.js", () => ({
8
+ fileToDataURL: vi.fn(),
9
+ compressBase64Image: vi.fn(),
10
+ }));
11
+
12
+ vi.mock("$lib/remult.js", () => {
13
+ const mockStoreInstance = {
14
+ setItem: vi.fn(),
15
+ getItem: vi.fn(),
16
+ deleteItem: vi.fn(),
17
+ init: vi.fn().mockResolvedValue(undefined), // Mock init if it's called internally
18
+ };
19
+ return {
20
+ JsonEntityIndexedDbStorage: vi.fn(() => mockStoreInstance),
21
+ };
22
+ });
23
+
24
+ // Helper to get the mocked store instance
25
+ const getMockedStore = () => new JsonEntityIndexedDbStorage();
26
+
27
+ describe("Images", () => {
28
+ beforeEach(() => {
29
+ vi.clearAllMocks();
30
+ // Mock crypto.randomUUID
31
+ vi.spyOn(window.crypto, "randomUUID").mockReturnValue("123e4567-e89b-12d3-a456-426614174000");
32
+ });
33
+
34
+ describe("upload", () => {
35
+ it("should process a file, store it, and return a key", async () => {
36
+ const mockFile = new File(["dummy content"], "test.png", { type: "image/png" });
37
+ const mockDataUrl = "data:image/png;base64,dummy";
38
+ const mockCompressedDataUrl = "data:image/jpeg;base64,compresseddummy";
39
+
40
+ (fileToDataURL as Mock).mockResolvedValue(mockDataUrl);
41
+ (compressBase64Image as Mock).mockResolvedValue(mockCompressedDataUrl);
42
+ const store = getMockedStore();
43
+
44
+ const key = await images.upload(mockFile);
45
+
46
+ expect(fileToDataURL).toHaveBeenCalledWith(mockFile);
47
+ expect(compressBase64Image).toHaveBeenCalledWith({
48
+ base64: mockDataUrl,
49
+ maxSizeKB: 400,
50
+ });
51
+ expect(store.setItem).toHaveBeenCalledWith(`image-123e4567-e89b-12d3-a456-426614174000`, mockCompressedDataUrl);
52
+ expect(key).toBe(`image-123e4567-e89b-12d3-a456-426614174000`);
53
+ });
54
+ });
55
+
56
+ describe("get", () => {
57
+ it("should retrieve an item from the store", async () => {
58
+ const mockKey = "image-123";
59
+ const mockStoredData = "data:image/jpeg;base64,somedata";
60
+ const store = getMockedStore();
61
+ (store.getItem as Mock).mockResolvedValue(mockStoredData);
62
+
63
+ const result = await images.get(mockKey);
64
+
65
+ expect(store.getItem).toHaveBeenCalledWith(mockKey);
66
+ expect(result).toBe(mockStoredData);
67
+ });
68
+
69
+ it("should return undefined if item not found (or whatever getItem returns)", async () => {
70
+ const mockKey = "image-not-found";
71
+ const store = getMockedStore();
72
+ (store.getItem as Mock).mockResolvedValue(undefined); // Simulate item not found
73
+
74
+ const result = await images.get(mockKey);
75
+
76
+ expect(store.getItem).toHaveBeenCalledWith(mockKey);
77
+ expect(result).toBeUndefined();
78
+ });
79
+ });
80
+
81
+ describe("delete", () => {
82
+ it("should delete an item from the store", async () => {
83
+ const mockKey = "image-to-delete";
84
+ const store = getMockedStore();
85
+
86
+ await images.delete(mockKey);
87
+
88
+ expect(store.deleteItem).toHaveBeenCalledWith(mockKey);
89
+ });
90
+ });
91
+ });
vite.config.ts CHANGED
@@ -20,7 +20,19 @@ export default defineConfig({
20
  plugins: [svelteTesting()],
21
  test: {
22
  name: "client",
23
- environment: "jsdom",
 
 
 
 
 
 
 
 
 
 
 
 
24
  clearMocks: true,
25
  include: ["src/**/*.svelte.{test,spec}.{js,ts}"],
26
  exclude: ["src/lib/server/**"],
 
20
  plugins: [svelteTesting()],
21
  test: {
22
  name: "client",
23
+ environment: "browser",
24
+ browser: {
25
+ enabled: true,
26
+ provider: "playwright",
27
+ instances: [
28
+ {
29
+ browser: "chromium",
30
+ },
31
+ {
32
+ browser: "firefox",
33
+ },
34
+ ],
35
+ },
36
  clearMocks: true,
37
  include: ["src/**/*.svelte.{test,spec}.{js,ts}"],
38
  exclude: ["src/lib/server/**"],
vitest-setup-client.ts CHANGED
@@ -1,18 +1,22 @@
1
- import "@testing-library/jest-dom/vitest";
2
- import { vi } from "vitest";
3
 
4
- // required for svelte5 + jsdom as jsdom does not support matchMedia
5
- Object.defineProperty(window, "matchMedia", {
6
- writable: true,
7
- enumerable: true,
8
- value: vi.fn().mockImplementation(query => ({
9
- matches: false,
10
- media: query,
11
- onchange: null,
12
- addEventListener: vi.fn(),
13
- removeEventListener: vi.fn(),
14
- dispatchEvent: vi.fn(),
15
- })),
16
- });
17
-
18
- // add more mocks here if you need them
 
 
 
 
 
1
+ /// <reference types="@vitest/browser/matchers" />
2
+ /// <reference types="@vitest/browser/providers/playwright" />
3
 
4
+ // import "@testing-library/jest-dom/vitest";
5
+ // import { vi } from "vitest";
6
+ // import fakeIndexedDB from "fake-indexeddb";
7
+ //
8
+ // // required for svelte5 + jsdom as jsdom does not support matchMedia
9
+ // Object.defineProperty(window, "matchMedia", {
10
+ // writable: true,
11
+ // enumerable: true,
12
+ // value: vi.fn().mockImplementation(query => ({
13
+ // matches: false,
14
+ // media: query,
15
+ // onchange: null,
16
+ // addEventListener: vi.fn(),
17
+ // removeEventListener: vi.fn(),
18
+ // dispatchEvent: vi.fn(),
19
+ // })),
20
+ // });
21
+ //
22
+ // globalThis.indexedDB = fakeIndexedDB;