Skip to content

Commit

Permalink
Merge pull request #10959 from qmonmert/cleantests2
Browse files Browse the repository at this point in the history
Clean tests
  • Loading branch information
pascalgrimaud authored Sep 24, 2024
2 parents e14801b + d9d96ac commit 1375285
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { defaultLandscape } from '../../domain/landscape/Landscape.fixture';
import { defaultPresets, ModulesRepositoryStub, projectHistoryWithInit, stubModulesRepository } from '../../domain/Modules.fixture';
import { ProjectFoldersRepositoryStub, stubProjectFoldersRepository } from '../../domain/ProjectFolders.fixture';
import { ModuleParametersRepositoryStub, stubModuleParametersRepository } from '../../domain/ModuleParameters.fixture';
import { beforeAll, beforeEach, describe, expect, it, vi } from 'vitest';
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { BodyCursorUpdater } from '@/module/primary/landscape/BodyCursorUpdater';
import { LandscapeScroller } from '@/module/primary/landscape/LandscapeScroller';
import { ModuleParametersRepository } from '@/module/domain/ModuleParametersRepository';
Expand Down Expand Up @@ -136,10 +136,6 @@ const repositoryWithModuleParameters = (): ModuleParametersRepositoryStub => {
};

describe('Landscape', () => {
beforeAll(() => {
vi.spyOn(console, 'error').mockImplementation(() => {});
});

describe('Loading', () => {
it('should display loader when loading landscape', () => {
const wrapper = wrap();
Expand Down Expand Up @@ -739,7 +735,7 @@ describe('Landscape', () => {
const wrapper = wrap({ modules });
await flushPromises();

const consoleErrors = vi.spyOn(console, 'error').mockImplementation(() => {});
const consoleErrors = vi.spyOn(console, 'error');
await updatePath(wrapper);

expect(console.error).toHaveBeenCalledTimes(0);
Expand Down Expand Up @@ -981,7 +977,7 @@ describe('Landscape', () => {

it('should call blur if input field has focus and click on a module', async () => {
const wrapper = await componentWithLandscape();
vi.spyOn(wrapper.find(wrappedElement('folder-path-field')).element as HTMLElement, 'blur').mockImplementation(() => {});
vi.spyOn(wrapper.find(wrappedElement('folder-path-field')).element as HTMLElement, 'blur');

Object.defineProperty(document, 'activeElement', {
value: wrapper.find(wrappedElement('folder-path-field')).element as HTMLElement,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('LandscapePresetConfigurationComponent', () => {
});

it('should handle API error', async () => {
vi.spyOn(console, 'error').mockImplementation(() => {});
vi.spyOn(console, 'error');
const error = new Error('API Error');
const modulesRepository = repositoryWithPresetError(error);
const wrapper = wrap(modulesRepository);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { stubAlertBus } from '../../../shared/alert/domain/AlertBus.fixture';
import { ProjectFoldersRepository } from '@/module/domain/ProjectFoldersRepository';
import { ProjectFoldersRepositoryStub, stubProjectFoldersRepository } from '../../domain/ProjectFolders.fixture';
import { ModuleParametersRepositoryStub, stubModuleParametersRepository } from '../../domain/ModuleParameters.fixture';
import { beforeAll, describe, expect, it, vi } from 'vitest';
import { describe, expect, it } from 'vitest';
import { Modules } from '@/module/domain/Modules';
import { Module } from '@/module/domain/Module';
import { ModuleParametersRepository } from '@/module/domain/ModuleParametersRepository';
Expand Down Expand Up @@ -56,10 +56,6 @@ const makeTaggedModule = (tag: string): Module => ({
});

describe('Modules', () => {
beforeAll(() => {
vi.spyOn(console, 'error').mockImplementation(() => {});
});

describe('Loading', () => {
it('should display loader when waiting for modules', () => {
const wrapper = wrap();
Expand Down

0 comments on commit 1375285

Please sign in to comment.