From 64ea604701b8f3b6d2c362e0181f355b2f36b309 Mon Sep 17 00:00:00 2001 From: Ornella Ourfi Date: Fri, 27 Sep 2024 14:27:25 +0200 Subject: [PATCH] resolve warning Error: Not implemented: window.scrollTo --- .../candidature-conseiller/CandidatureConseiller.test.jsx | 5 ++++- .../CandidatureCoordinateur.test.jsx | 7 ++++++- .../candidature-structure/CandidatureStructure.test.jsx | 7 ++++++- .../CandidatureValideeConseiller.test.jsx | 7 ++++++- .../CandidatureValideeStructure.test.jsx | 7 ++++++- .../PageConfirmationEmailCandidatureConseiller.test.jsx | 7 ++++++- .../PageConfirmationEmailCandidatureStructure.test.jsx | 7 ++++++- 7 files changed, 40 insertions(+), 7 deletions(-) diff --git a/src/views/candidature-conseiller/CandidatureConseiller.test.jsx b/src/views/candidature-conseiller/CandidatureConseiller.test.jsx index 4a9eb4a..3c6f243 100644 --- a/src/views/candidature-conseiller/CandidatureConseiller.test.jsx +++ b/src/views/candidature-conseiller/CandidatureConseiller.test.jsx @@ -1,5 +1,5 @@ import { render, screen, within, fireEvent, act } from '@testing-library/react'; -import { describe, expect, it, vi } from 'vitest'; +import { describe, expect, it, vi, beforeEach } from 'vitest'; import CandidatureConseiller from './CandidatureConseiller'; import { textMatcher, dateDujour } from '../../../test/test-utils'; import * as ReactRouterDom from 'react-router-dom'; @@ -10,6 +10,9 @@ vi.mock('react-router-dom', () => ({ })); describe('candidature conseiller', () => { + beforeEach(() => { + global.scrollTo = vi.fn(() => { }); + }); it('quand j’affiche le formulaire alors le titre et le menu s’affichent', () => { // WHEN render(); diff --git a/src/views/candidature-coordinateur/CandidatureCoordinateur.test.jsx b/src/views/candidature-coordinateur/CandidatureCoordinateur.test.jsx index 07a98eb..8e1220c 100644 --- a/src/views/candidature-coordinateur/CandidatureCoordinateur.test.jsx +++ b/src/views/candidature-coordinateur/CandidatureCoordinateur.test.jsx @@ -1,5 +1,5 @@ import { render, screen, within, fireEvent, act } from '@testing-library/react'; -import { describe, expect, it, vi } from 'vitest'; +import { describe, expect, it, vi, beforeEach } from 'vitest'; import CandidatureCoordinateur from './CandidatureCoordinateur'; import { textMatcher, dateDujour } from '../../../test/test-utils'; import * as ReactRouterDom from 'react-router-dom'; @@ -10,6 +10,11 @@ vi.mock('react-router-dom', () => ({ })); describe('candidature coordinateur', () => { + beforeEach(() => { + // eslint-disable-next-line vitest/prefer-spy-on + global.scrollTo = vi.fn(); + }); + it('quand j’affiche le formulaire alors le titre et le menu s’affichent', () => { // WHEN render(); diff --git a/src/views/candidature-structure/CandidatureStructure.test.jsx b/src/views/candidature-structure/CandidatureStructure.test.jsx index 114f24e..179655c 100644 --- a/src/views/candidature-structure/CandidatureStructure.test.jsx +++ b/src/views/candidature-structure/CandidatureStructure.test.jsx @@ -1,5 +1,5 @@ import { render, screen, within, waitFor, fireEvent, act } from '@testing-library/react'; -import { describe, expect, it, vi } from 'vitest'; +import { describe, expect, it, vi, beforeEach } from 'vitest'; import CandidatureStructure from './CandidatureStructure'; import { textMatcher, dateDujour } from '../../../test/test-utils'; import * as ReactRouterDom from 'react-router-dom'; @@ -10,6 +10,11 @@ vi.mock('react-router-dom', () => ({ })); describe('candidature structure', () => { + beforeEach(() => { + // eslint-disable-next-line vitest/prefer-spy-on + global.scrollTo = vi.fn(); + }); + it('quand j’affiche le formulaire alors le titre et le menu s’affichent', () => { // WHEN render(); diff --git a/src/views/candidature-validee-conseiller/CandidatureValideeConseiller.test.jsx b/src/views/candidature-validee-conseiller/CandidatureValideeConseiller.test.jsx index a677c80..aa88800 100644 --- a/src/views/candidature-validee-conseiller/CandidatureValideeConseiller.test.jsx +++ b/src/views/candidature-validee-conseiller/CandidatureValideeConseiller.test.jsx @@ -1,9 +1,14 @@ import { render, screen } from '@testing-library/react'; -import { describe, expect, it } from 'vitest'; +import { describe, expect, it, vi, beforeEach } from 'vitest'; import CandidatureValideeConseiller from './CandidatureValideeConseiller'; import { textMatcher } from '../../../test/test-utils'; describe('candidature validée', () => { + beforeEach(() => { + // eslint-disable-next-line vitest/prefer-spy-on + global.scrollTo = vi.fn(); + }); + it('quand j’affiche la page candidature validée alors le titre et les informations de la page s’affichent', () => { // WHEN render(); diff --git a/src/views/candidature-validee-structure/CandidatureValideeStructure.test.jsx b/src/views/candidature-validee-structure/CandidatureValideeStructure.test.jsx index 0310581..8a7fc22 100644 --- a/src/views/candidature-validee-structure/CandidatureValideeStructure.test.jsx +++ b/src/views/candidature-validee-structure/CandidatureValideeStructure.test.jsx @@ -1,9 +1,14 @@ import { render, screen } from '@testing-library/react'; -import { describe, expect, it } from 'vitest'; +import { describe, expect, it, vi, beforeEach } from 'vitest'; import CandidatureValideeStructure from './CandidatureValideeStructure'; import { textMatcher } from '../../../test/test-utils'; describe('candidature validée', () => { + beforeEach(() => { + // eslint-disable-next-line vitest/prefer-spy-on + global.scrollTo = vi.fn(); + }); + it('quand j’affiche la page candidature validée alors le titre et les informations de la page s’affichent', () => { // WHEN render(); diff --git a/src/views/confirmation-email-candidature-conseiller/PageConfirmationEmailCandidatureConseiller.test.jsx b/src/views/confirmation-email-candidature-conseiller/PageConfirmationEmailCandidatureConseiller.test.jsx index 1317177..edcd94b 100644 --- a/src/views/confirmation-email-candidature-conseiller/PageConfirmationEmailCandidatureConseiller.test.jsx +++ b/src/views/confirmation-email-candidature-conseiller/PageConfirmationEmailCandidatureConseiller.test.jsx @@ -1,5 +1,5 @@ import { render, act, screen, fireEvent } from '@testing-library/react'; -import { describe, expect, it, vi } from 'vitest'; +import { describe, expect, it, vi, beforeEach } from 'vitest'; import ConfirmationEmailCandidature from './ConfirmationEmailCandidatureConseiller'; vi.mock('react-router-dom', () => ({ @@ -7,6 +7,11 @@ vi.mock('react-router-dom', () => ({ })); describe('confirmation Email', () => { + beforeEach(() => { + // eslint-disable-next-line vitest/prefer-spy-on + global.scrollTo = vi.fn(); + }); + it('quand j’affiche la page de confirmation de l’email validée alors le titre et les informations de la page s’affichent', () => { // WHEN render(); diff --git a/src/views/confirmation-email-candidature-structure/PageConfirmationEmailCandidatureStructure.test.jsx b/src/views/confirmation-email-candidature-structure/PageConfirmationEmailCandidatureStructure.test.jsx index f115a3e..ead6f83 100644 --- a/src/views/confirmation-email-candidature-structure/PageConfirmationEmailCandidatureStructure.test.jsx +++ b/src/views/confirmation-email-candidature-structure/PageConfirmationEmailCandidatureStructure.test.jsx @@ -1,5 +1,5 @@ import { render, act, screen, fireEvent } from '@testing-library/react'; -import { describe, expect, it, vi } from 'vitest'; +import { describe, expect, it, vi, beforeEach } from 'vitest'; import ConfirmationEmailCandidatureStructure from './ConfirmationEmailCandidatureStructure'; vi.mock('react-router-dom', () => ({ @@ -7,6 +7,11 @@ vi.mock('react-router-dom', () => ({ })); describe('confirmation Email', () => { + beforeEach(() => { + // eslint-disable-next-line vitest/prefer-spy-on + global.scrollTo = vi.fn(); + }); + it('quand j’affiche la page de confirmation de l’email validée alors le titre et les informations de la page s’affichent', () => { // WHEN render();