Skip to content
This repository was archived by the owner on May 13, 2024. It is now read-only.

Commit 6d2ab3d

Browse files
fix: fix broken tests
1 parent 91563bd commit 6d2ab3d

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

src/features/Apiexplorer/Schema/HighlightCode/__tests__/HighlightCode.test.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@ import React from 'react';
22
import { HighlightCode } from '..';
33
import { render, screen } from '@testing-library/react';
44

5+
jest.mock('@docusaurus/router', () => ({
6+
useLocation: () => ({
7+
pathname: '',
8+
hash: '',
9+
}),
10+
useHistory: () => ({
11+
push: jest.fn(),
12+
}),
13+
}));
14+
515
describe('HighlightCode', () => {
616
it('should render HighlightCode properly', async () => {
717
render(<HighlightCode description={'This is a `highlight` test'} />);

src/features/Apiexplorer/Schema/RecursiveContent/RecursiveProperties/__tests__/RecursiveProperties.test.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ const fakeItem = {
1919
},
2020
};
2121

22+
jest.mock('@docusaurus/router', () => ({
23+
useLocation: () => ({
24+
pathname: '',
25+
hash: '',
26+
}),
27+
useHistory: () => ({
28+
push: jest.fn(),
29+
}),
30+
}));
31+
2232
describe('RecursiveProperties', () => {
2333
it('should be able to render recursive items', async () => {
2434
render(

src/features/Apiexplorer/Schema/RecursiveContent/SchemaObjectContent/__tests__/SchemaObjectContent.test.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@ import SchemaObjectContent from '..';
33
import userEvent from '@testing-library/user-event';
44
import { screen, render } from '@testing-library/react';
55

6+
jest.mock('@docusaurus/router', () => ({
7+
useLocation: () => ({
8+
pathname: '',
9+
hash: '',
10+
}),
11+
useHistory: () => ({
12+
push: jest.fn(),
13+
}),
14+
}));
15+
616
const fake_properties = {
717
test_item: {
818
description: 'test description',

src/features/Apiexplorer/Schema/SchemaProperties/__tests__/SchemaProperties.test.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,16 @@ import SchemaProperties from '..';
33
import userEvent from '@testing-library/user-event';
44
import { render, screen } from '@testing-library/react';
55

6+
jest.mock('@docusaurus/router', () => ({
7+
useLocation: () => ({
8+
pathname: '',
9+
hash: '',
10+
}),
11+
useHistory: () => ({
12+
push: jest.fn(),
13+
}),
14+
}));
15+
616
describe('SchemaProperties', () => {
717
it('should throw an error when invalid JSON properties are passed', async () => {
818
const consoleOutput = [];

0 commit comments

Comments
 (0)