diff --git a/frontend/README.md b/frontend/README.md index 76656bcf..845abdc0 100644 --- a/frontend/README.md +++ b/frontend/README.md @@ -57,6 +57,7 @@ npm run lint -- --fix npm run test ``` +Note: Tests are setup to run in America/Vancouver timezone. ### Customize configuration diff --git a/frontend/package-lock.json b/frontend/package-lock.json index a2e55409..d30cb370 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -21,13 +21,13 @@ "@vueuse/core": "^11.1.0", "core-js": "^3.8.3", "dayjs": "^1.11.5", - "pinia": "^2.1.6", + "pinia": "^2.2.6", "posthog-js": "^1.174.3", "qalendar": "^3.7.0", "tailwindcss": "^3.4.3", "ua-parser-js": "^1.0.38", "vite": "^5.4.6", - "vue": "^3.5.4", + "vue": "^3.5.12", "vue-i18n": "^10.0.3", "vue-router": "^4.0.3" }, diff --git a/frontend/package.json b/frontend/package.json index 47a79740..381efd9f 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -24,13 +24,13 @@ "@vueuse/core": "^11.1.0", "core-js": "^3.8.3", "dayjs": "^1.11.5", - "pinia": "^2.1.6", + "pinia": "^2.2.6", "posthog-js": "^1.174.3", "qalendar": "^3.7.0", "tailwindcss": "^3.4.3", "ua-parser-js": "^1.0.38", "vite": "^5.4.6", - "vue": "^3.5.4", + "vue": "^3.5.12", "vue-i18n": "^10.0.3", "vue-router": "^4.0.3" }, diff --git a/frontend/test/stores/appointment-store.test.js b/frontend/test/stores/appointment-store.test.js index 7898e4f9..b082c26a 100644 --- a/frontend/test/stores/appointment-store.test.js +++ b/frontend/test/stores/appointment-store.test.js @@ -73,7 +73,6 @@ describe('Appointment Store', () => { test('fetch', async () => { const apmt = useAppointmentStore(); await apmt.fetch(createFetch({ baseUrl: API_URL })); - console.log(apmt.appointments); expect(apmt.appointments.length).toBe(2); expect(apmt.appointments[0].slots.length).toBe(1); }); @@ -87,10 +86,7 @@ describe('Appointment Store', () => { test('timezone', async () => { const apmt = useAppointmentStore(); await apmt.fetch(createFetch({ baseUrl: API_URL })); - // TODO This check depends on the timzone set in the user store. - // If no user timezone is set it defaults to UTC, which is currently the case. - // So we might want to adjust the github workflow runner to set a timezone for testing. - expect(apmt.appointments[0].slots[0].start.toISOString()).toBe('3000-01-01T09:00:00.000Z'); + expect(apmt.appointments[0].slots[0].start.toISOString()).toBe('3000-01-01T01:00:00.000Z'); }); test('reset', async () => { diff --git a/frontend/vitest.config.ts b/frontend/vitest.config.ts index 1acec488..0b254b51 100644 --- a/frontend/vitest.config.ts +++ b/frontend/vitest.config.ts @@ -2,7 +2,7 @@ import { fileURLToPath } from 'node:url'; import { defineConfig, mergeConfig } from 'vitest/config'; import viteConfig from './vite.config'; -export default defineConfig(configEnv => mergeConfig( +export default defineConfig((configEnv) => mergeConfig( viteConfig(configEnv), defineConfig({ resolve: { @@ -17,7 +17,8 @@ export default defineConfig(configEnv => mergeConfig( ], globals: true, environment: 'jsdom', + globalSetup: './vitest.global-setup.ts', root: fileURLToPath(new URL('./', import.meta.url)), }, - }) + }), )); diff --git a/frontend/vitest.global-setup.ts b/frontend/vitest.global-setup.ts new file mode 100644 index 00000000..e7037a92 --- /dev/null +++ b/frontend/vitest.global-setup.ts @@ -0,0 +1,6 @@ +/** + * Enforce some globals like timezone for tests + */ +export const setup = () => { + process.env.TZ = 'America/Vancouver'; +};