Skip to content

Commit

Permalink
Fix unit test issues
Browse files Browse the repository at this point in the history
  • Loading branch information
tassoevan committed Sep 10, 2024
1 parent 367f7ab commit 656c756
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 56 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { mockAppRoot } from '@rocket.chat/mock-providers';
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import React from 'react';
Expand Down Expand Up @@ -31,7 +32,7 @@ const sections = [regular, danger];

describe('Room Actions Menu', () => {
it('should render kebab menu with the list content', async () => {
render(<GenericMenu title='Kebab' sections={sections} />, { legacyRoot: true });
render(<GenericMenu title='Kebab' sections={sections} />, { legacyRoot: true, wrapper: mockAppRoot().build() });

await userEvent.click(screen.getByRole('button'));

Expand All @@ -40,7 +41,7 @@ describe('Room Actions Menu', () => {
});

it('should have two different sections, regular and danger', async () => {
render(<GenericMenu title='Kebab' sections={sections} />, { legacyRoot: true });
render(<GenericMenu title='Kebab' sections={sections} />, { legacyRoot: true, wrapper: mockAppRoot().build() });

await userEvent.click(screen.getByRole('button'));

Expand All @@ -49,7 +50,7 @@ describe('Room Actions Menu', () => {
});

it('should call the action when item clicked', async () => {
render(<GenericMenu title='Kebab' sections={sections} />, { legacyRoot: true });
render(<GenericMenu title='Kebab' sections={sections} />, { legacyRoot: true, wrapper: mockAppRoot().build() });

await userEvent.click(screen.getByRole('button'));
await userEvent.click(screen.getAllByRole('menuitem')[0]);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { mockAppRoot } from '@rocket.chat/mock-providers';
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import React from 'react';
Expand Down Expand Up @@ -52,7 +53,7 @@ describe('TimespanSettingInput component', () => {
placeholder='Enter timespan'
onChangeValue={onChangeValueMock}
/>,
{ legacyRoot: true },
{ legacyRoot: true, wrapper: mockAppRoot().build() },
);

const numberInput = screen.getByRole('spinbutton');
Expand All @@ -74,7 +75,7 @@ describe('TimespanSettingInput component', () => {
placeholder='Enter timespan'
onChangeValue={onChangeValueMock}
/>,
{ legacyRoot: true },
{ legacyRoot: true, wrapper: mockAppRoot().build() },
);

const selectInput = screen.getByRole('button', { name: 'hours' });
Expand All @@ -99,7 +100,7 @@ describe('TimespanSettingInput component', () => {
placeholder='Enter timespan'
onChangeValue={onChangeValueMock}
/>,
{ legacyRoot: true },
{ legacyRoot: true, wrapper: mockAppRoot().build() },
);

const selectInput = screen.getByRole('button', { name: 'days' });
Expand All @@ -124,7 +125,7 @@ describe('TimespanSettingInput component', () => {
placeholder='Enter timespan'
onChangeValue={onChangeValueMock}
/>,
{ legacyRoot: true },
{ legacyRoot: true, wrapper: mockAppRoot().build() },
);

const selectInput = screen.getByRole('button', { name: 'hours' });
Expand All @@ -150,7 +151,7 @@ describe('TimespanSettingInput component', () => {
hasResetButton
onResetButtonClick={onResetButtonClickMock}
/>,
{ legacyRoot: true },
{ legacyRoot: true, wrapper: mockAppRoot().build() },
);

const resetButton = screen.getByTitle('Reset');
Expand Down
2 changes: 1 addition & 1 deletion packages/i18n/jest.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import type { Config } from 'jest';
export default {
preset: server.preset,
testMatch: ['<rootDir>/src/**/*.spec.(ts|js|mjs)'],
transformIgnorePatterns: ['<rootDir>/node_modules/@babel', '<rootDir>/node_modules/@jest', 'signal-exit'],
transformIgnorePatterns: ['<rootDir>/node_modules/@babel', '<rootDir>/node_modules/@jest', 'signal-exit', 'is-typedarray'],
collectCoverage: false,
} satisfies Config;
2 changes: 1 addition & 1 deletion packages/jest-presets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"/server"
],
"dependencies": {
"@swc/core": "~1.7.4",
"@swc/core": "~1.7.23",
"@swc/jest": "~0.2.36",
"@testing-library/jest-dom": "~6.4.8",
"@types/jest-axe": "~3.5.9",
Expand Down
92 changes: 46 additions & 46 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9078,7 +9078,7 @@ __metadata:
resolution: "@rocket.chat/jest-presets@workspace:packages/jest-presets"
dependencies:
"@rocket.chat/eslint-config": "workspace:~"
"@swc/core": ~1.7.4
"@swc/core": ~1.7.23
"@swc/jest": ~0.2.36
"@testing-library/jest-dom": ~6.4.8
"@types/identity-obj-proxy": ^3
Expand Down Expand Up @@ -12417,90 +12417,90 @@ __metadata:
languageName: node
linkType: hard

"@swc/core-darwin-arm64@npm:1.7.4":
version: 1.7.4
resolution: "@swc/core-darwin-arm64@npm:1.7.4"
"@swc/core-darwin-arm64@npm:1.7.23":
version: 1.7.23
resolution: "@swc/core-darwin-arm64@npm:1.7.23"
conditions: os=darwin & cpu=arm64
languageName: node
linkType: hard

"@swc/core-darwin-x64@npm:1.7.4":
version: 1.7.4
resolution: "@swc/core-darwin-x64@npm:1.7.4"
"@swc/core-darwin-x64@npm:1.7.23":
version: 1.7.23
resolution: "@swc/core-darwin-x64@npm:1.7.23"
conditions: os=darwin & cpu=x64
languageName: node
linkType: hard

"@swc/core-linux-arm-gnueabihf@npm:1.7.4":
version: 1.7.4
resolution: "@swc/core-linux-arm-gnueabihf@npm:1.7.4"
"@swc/core-linux-arm-gnueabihf@npm:1.7.23":
version: 1.7.23
resolution: "@swc/core-linux-arm-gnueabihf@npm:1.7.23"
conditions: os=linux & cpu=arm
languageName: node
linkType: hard

"@swc/core-linux-arm64-gnu@npm:1.7.4":
version: 1.7.4
resolution: "@swc/core-linux-arm64-gnu@npm:1.7.4"
"@swc/core-linux-arm64-gnu@npm:1.7.23":
version: 1.7.23
resolution: "@swc/core-linux-arm64-gnu@npm:1.7.23"
conditions: os=linux & cpu=arm64 & libc=glibc
languageName: node
linkType: hard

"@swc/core-linux-arm64-musl@npm:1.7.4":
version: 1.7.4
resolution: "@swc/core-linux-arm64-musl@npm:1.7.4"
"@swc/core-linux-arm64-musl@npm:1.7.23":
version: 1.7.23
resolution: "@swc/core-linux-arm64-musl@npm:1.7.23"
conditions: os=linux & cpu=arm64 & libc=musl
languageName: node
linkType: hard

"@swc/core-linux-x64-gnu@npm:1.7.4":
version: 1.7.4
resolution: "@swc/core-linux-x64-gnu@npm:1.7.4"
"@swc/core-linux-x64-gnu@npm:1.7.23":
version: 1.7.23
resolution: "@swc/core-linux-x64-gnu@npm:1.7.23"
conditions: os=linux & cpu=x64 & libc=glibc
languageName: node
linkType: hard

"@swc/core-linux-x64-musl@npm:1.7.4":
version: 1.7.4
resolution: "@swc/core-linux-x64-musl@npm:1.7.4"
"@swc/core-linux-x64-musl@npm:1.7.23":
version: 1.7.23
resolution: "@swc/core-linux-x64-musl@npm:1.7.23"
conditions: os=linux & cpu=x64 & libc=musl
languageName: node
linkType: hard

"@swc/core-win32-arm64-msvc@npm:1.7.4":
version: 1.7.4
resolution: "@swc/core-win32-arm64-msvc@npm:1.7.4"
"@swc/core-win32-arm64-msvc@npm:1.7.23":
version: 1.7.23
resolution: "@swc/core-win32-arm64-msvc@npm:1.7.23"
conditions: os=win32 & cpu=arm64
languageName: node
linkType: hard

"@swc/core-win32-ia32-msvc@npm:1.7.4":
version: 1.7.4
resolution: "@swc/core-win32-ia32-msvc@npm:1.7.4"
"@swc/core-win32-ia32-msvc@npm:1.7.23":
version: 1.7.23
resolution: "@swc/core-win32-ia32-msvc@npm:1.7.23"
conditions: os=win32 & cpu=ia32
languageName: node
linkType: hard

"@swc/core-win32-x64-msvc@npm:1.7.4":
version: 1.7.4
resolution: "@swc/core-win32-x64-msvc@npm:1.7.4"
"@swc/core-win32-x64-msvc@npm:1.7.23":
version: 1.7.23
resolution: "@swc/core-win32-x64-msvc@npm:1.7.23"
conditions: os=win32 & cpu=x64
languageName: node
linkType: hard

"@swc/core@npm:~1.7.4":
version: 1.7.4
resolution: "@swc/core@npm:1.7.4"
dependencies:
"@swc/core-darwin-arm64": 1.7.4
"@swc/core-darwin-x64": 1.7.4
"@swc/core-linux-arm-gnueabihf": 1.7.4
"@swc/core-linux-arm64-gnu": 1.7.4
"@swc/core-linux-arm64-musl": 1.7.4
"@swc/core-linux-x64-gnu": 1.7.4
"@swc/core-linux-x64-musl": 1.7.4
"@swc/core-win32-arm64-msvc": 1.7.4
"@swc/core-win32-ia32-msvc": 1.7.4
"@swc/core-win32-x64-msvc": 1.7.4
"@swc/core@npm:~1.7.23":
version: 1.7.23
resolution: "@swc/core@npm:1.7.23"
dependencies:
"@swc/core-darwin-arm64": 1.7.23
"@swc/core-darwin-x64": 1.7.23
"@swc/core-linux-arm-gnueabihf": 1.7.23
"@swc/core-linux-arm64-gnu": 1.7.23
"@swc/core-linux-arm64-musl": 1.7.23
"@swc/core-linux-x64-gnu": 1.7.23
"@swc/core-linux-x64-musl": 1.7.23
"@swc/core-win32-arm64-msvc": 1.7.23
"@swc/core-win32-ia32-msvc": 1.7.23
"@swc/core-win32-x64-msvc": 1.7.23
"@swc/counter": ^0.1.3
"@swc/types": ^0.1.12
peerDependencies:
Expand Down Expand Up @@ -12529,7 +12529,7 @@ __metadata:
peerDependenciesMeta:
"@swc/helpers":
optional: true
checksum: 1b2231fcb6a2a63171e34e80f0d43cd459d259b0a2fa269a129456291dc11b95a716aed60f61e5fcafd039a217916ece375876b02d125d88cdc7927382805e55
checksum: a21e9a67d305ad9b49b6def9f9698b374db6c15b2ded5e5cf29390221181fc6b91bfa317b53fd41d9cca989d85b79bbbca5ab27635df1e0232cad4681f618fa5
languageName: node
linkType: hard

Expand Down

0 comments on commit 656c756

Please sign in to comment.