Skip to content

clear globally mocks and timers after tests #3709

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions packages/synapse-bridge/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#### v3.0.0

- Fix AlertWrapper background [`#3692`](https://github.com/assurance-maladie-digital/design-system/pull/3692)
- Fix DatePicker's issues with validation [`#3688`](https://github.com/assurance-maladie-digital/design-system/pull/3688)
- NirField: add labels props [`#3689`](https://github.com/assurance-maladie-digital/design-system/pull/3689)
- improve validDate rule ans set it by default to DatePicker [`#3681`](https://github.com/assurance-maladie-digital/design-system/pull/3681)
- DatePicker: block submit based on rules [`#3677`](https://github.com/assurance-maladie-digital/design-system/pull/3677)
- Fix buttons style [`#3667`](https://github.com/assurance-maladie-digital/design-system/pull/3667)
- DatePicker refactor delete [`#3670`](https://github.com/assurance-maladie-digital/design-system/pull/3670)
- Fix AlertWrapper background [`#3692`](https://github.com/assurance-maladie-digital/design-system/pull/3692)
- Fix DatePicker's issues with validation [`#3688`](https://github.com/assurance-maladie-digital/design-system/pull/3688)
- NirField: add labels props [`#3689`](https://github.com/assurance-maladie-digital/design-system/pull/3689)
- improve validDate rule ans set it by default to DatePicker [`#3681`](https://github.com/assurance-maladie-digital/design-system/pull/3681)
- DatePicker: block submit based on rules [`#3677`](https://github.com/assurance-maladie-digital/design-system/pull/3677)
- Fix buttons style [`#3667`](https://github.com/assurance-maladie-digital/design-system/pull/3667)
- DatePicker refactor delete [`#3670`](https://github.com/assurance-maladie-digital/design-system/pull/3670)

#### v1.4.10-alpha.0

Expand Down
24 changes: 18 additions & 6 deletions packages/synapse-bridge/tests/unit/setup.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
import vueSnapshotSerializer from 'jest-serializer-vue'
import { expect } from 'vitest'

expect.addSnapshotSerializer(vueSnapshotSerializer)

import { afterEach, beforeEach, expect, vitest } from 'vitest'
import { createVuetify } from 'vuetify'
import * as components from 'vuetify/components'
import * as directives from 'vuetify/directives'

import Vuex from 'vuex'
import { state, actions, mutations } from '@/modules/notification'
import { actions, mutations, state } from '@/modules/notification'

// Configuration de Vuetify
export const vuetify = createVuetify({
components,
directives,
})

// Fonction pour créer un store Vuex personnalisé
export function createNotificationStore() {
return new Vuex.Store({
modules: {
Expand All @@ -28,4 +26,18 @@ export function createNotificationStore() {
})
}

// Ajout du sérialiseur de snapshots pour Vue
expect.addSnapshotSerializer(vueSnapshotSerializer)

// Polyfill pour ResizeObserver
global.ResizeObserver = require('resize-observer-polyfill')

// Ajout des hooks globaux pour isoler les tests et eviter les faux positifs
beforeEach(() => {
document.body.innerHTML = '' // Réinitialisation du DOM
})

afterEach(() => {
vitest.clearAllMocks() // Réinitialisation des mocks
vitest.clearAllTimers() // Réinitialisation des timers
})
Loading