Skip to content

Commit

Permalink
resolve warning Error: Not implemented: window.scrollTo
Browse files Browse the repository at this point in the history
  • Loading branch information
Ornella452 committed Sep 27, 2024
1 parent 23f5b7c commit 9cf453b
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -10,6 +10,10 @@ vi.mock('react-router-dom', () => ({
}));

describe('candidature conseiller', () => {
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(<CandidatureConseiller />);
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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(<CandidatureCoordinateur />);
Expand Down
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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(<CandidatureStructure />);
Expand Down
Original file line number Diff line number Diff line change
@@ -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(<CandidatureValideeConseiller />);
Expand Down
Original file line number Diff line number Diff line change
@@ -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(<CandidatureValideeStructure />);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
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', () => ({
useParams: () => ({ token: '1' }),
}));

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(<ConfirmationEmailCandidature />);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
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', () => ({
useParams: () => ({ token: '1' }),
}));

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(<ConfirmationEmailCandidatureStructure />);
Expand Down

0 comments on commit 9cf453b

Please sign in to comment.