Skip to content
This repository was archived by the owner on Aug 2, 2025. It is now read-only.

Commit d02e594

Browse files
committed
fix tests
1 parent 7cadf54 commit d02e594

File tree

5 files changed

+1092
-1010
lines changed

5 files changed

+1092
-1010
lines changed

apps/client/package.json

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
{
22
"name": "client",
33
"version": "1.9.9-beta",
4+
"type": "module",
45
"scripts": {
56
"dev": "npm-run-all --parallel dev:*",
67
"dev:run": "FORCE_COLOR=1 vite",
7-
"dev:test": "FORCE_COLOR=1 vitest watch --ui --coverage",
8+
"dev:test": "vitest --ui",
89
"build": "FORCE_COLOR=1 vite build",
910
"preview": "vite preview",
1011
"format": "prettier --ignore-path .gitignore --write .",
1112
"check-format": "prettier . --list-different",
1213
"lint": "eslint . --ignore-path .gitignore",
1314
"check-types": "tsc --pretty",
14-
"test": "vitest run",
15-
"test:watch": "vitest",
16-
"validate": "npm-run-all --parallel check-types lint check-format build test",
15+
"validate": "npm-run-all --parallel check-types lint check-format build",
1716
"setup": "pnpm install && pnpm validate"
1817
},
1918
"dependencies": {
@@ -66,16 +65,15 @@
6665
"@types/react": "^18.0.21",
6766
"@typescript-eslint/eslint-plugin": "^5.60.0",
6867
"@typescript-eslint/parser": "^5.60.0",
69-
"@vitejs/plugin-react": "^3.0.0",
70-
"@vitest/coverage-v8": "^0.33.0",
71-
"@vitest/ui": "^0.32.2",
68+
"@vitejs/plugin-react": "^4.2.1",
69+
"@vitest/ui": "^1.2.2",
7270
"eslint": "^8.43.0",
7371
"eslint-config-prettier": "^8.8.0",
7472
"eslint-plugin-react": "^7.32.2",
7573
"jsdom": "^22.1.0",
7674
"npm-run-all": "^4.1.5",
7775
"prettier": "2.6.2",
78-
"vite": "^4.1.5",
79-
"vitest": "^0.32.2"
76+
"vite": "^5.0.12",
77+
"vitest": "^1.2.2"
8078
}
8179
}

apps/client/src/interfaces/DataProvider.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ export type LongOrShortString = {
88
export type Period = {
99
start: DateTime;
1010
end: DateTime;
11+
name: LongOrShortString;
1112
teacher?: LongOrShortString;
12-
name?: LongOrShortString;
1313
location?: LongOrShortString;
14+
color?: string;
1415
};
1516

1617
export const ContentEncodings = ["html", "markdown"] as const;

apps/client/src/services/dataProviders/TestDataProvider/TestDataProvider.ts

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { DataProvider } from "../../../interfaces/DataProvider";
2+
import { DateTime } from "luxon";
23
import { z } from "zod";
34

45
export class TestDataProvider implements DataProvider {
@@ -34,4 +35,31 @@ export class TestDataProvider implements DataProvider {
3435
return barcode;
3536
},
3637
};
38+
39+
dtt = {
40+
fetch: async () => undefined,
41+
parse: (data: unknown) => [
42+
{
43+
start: DateTime.fromISO("2023-09-20T09:00:00.000Z"),
44+
end: DateTime.fromISO("2023-09-20T10:00:00.000Z"),
45+
name: { short: "8LAT1", long: "8 Latin 1" },
46+
teacher: { short: "JSM", long: "Mr Smith" },
47+
location: { short: "203", long: "Room 203" },
48+
color: "#79f2cc",
49+
},
50+
{
51+
start: DateTime.fromISO("2023-09-20T10:05:00.000Z"),
52+
end: DateTime.fromISO("2023-09-20T11:05:00.000Z"),
53+
name: { short: "8MA1", long: "8 Math 1" },
54+
teacher: { short: "JBA", long: "Ms Bash" },
55+
location: { short: "103", long: "Room 103" },
56+
color: "#f28579",
57+
},
58+
{
59+
start: DateTime.fromISO("2023-09-20T11:10:00.000Z"),
60+
end: DateTime.fromISO("2023-09-20T11:40:00.000Z"),
61+
name: { short: "RCS", long: "Recess" },
62+
},
63+
],
64+
};
3765
}

apps/client/vite.config.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import replace from "@rollup/plugin-replace";
22
import { sentryVitePlugin } from "@sentry/vite-plugin";
33
import react from "@vitejs/plugin-react";
44
import { injectManifest } from "rollup-plugin-workbox";
5-
import { defineConfig } from "vitest/config";
5+
/// <reference types="vitest" />
6+
import { defineConfig } from "vite";
67

78
export default defineConfig({
89
plugins: [
@@ -41,9 +42,6 @@ export default defineConfig({
4142
port: 3000,
4243
strictPort: true,
4344
},
44-
test: {
45-
environment: "jsdom",
46-
},
4745
preview: {
4846
port: 3000,
4947
},

0 commit comments

Comments
 (0)