Skip to content

Commit

Permalink
Update deps and fix timezone related tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MelissaAutumn committed Nov 7, 2024
1 parent 0edea64 commit 00be641
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 11 deletions.
1 change: 1 addition & 0 deletions frontend/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ npm run lint -- --fix
npm run test
```

Note: Tests are setup to run in America/Vancouver timezone.

### Customize configuration

Expand Down
4 changes: 2 additions & 2 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
6 changes: 1 addition & 5 deletions frontend/test/stores/appointment-store.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
Expand All @@ -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 () => {
Expand Down
5 changes: 3 additions & 2 deletions frontend/vitest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand All @@ -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)),
},
})
}),
));
6 changes: 6 additions & 0 deletions frontend/vitest.global-setup.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/**
* Enforce some globals like timezone for tests
*/
export const setup = () => {
process.env.TZ = 'America/Vancouver';
};

0 comments on commit 00be641

Please sign in to comment.