Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions shell-ui/jest.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
module.exports = {
transformIgnorePatterns: [
'/node_modules/(?!vega-lite|@scality|pretty-bytes|uuid)',
],
setupFilesAfterEnv: ['./src/setupTests.ts'],
clearMocks: true,
moduleNameMapper: {
'\\.(css|less)$': 'identity-obj-proxy',
},
testEnvironment: 'jsdom',
transformIgnorePatterns: [
"/node_modules/(?!vega-lite|@scality|pretty-bytes|uuid|@fortawesome)",
],
setupFilesAfterEnv: ["./src/setupTests.ts"],
clearMocks: true,
moduleNameMapper: {
"\\.(css|less)$": "identity-obj-proxy",
"^@fortawesome/free-solid-svg-icons/(.*)\\.js$": "@fortawesome/free-solid-svg-icons/$1",
"^@fortawesome/free-regular-svg-icons/(.*)\\.js$": "@fortawesome/free-regular-svg-icons/$1",
},
testEnvironment: "jsdom",
};
101 changes: 50 additions & 51 deletions shell-ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions shell-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"ts-node": "^10.9.2"
},
"dependencies": {
"@scality/core-ui": "0.193.0",
"@scality/core-ui": "0.197.0",
"@scality/module-federation": "1.6.1",
"downshift": "^8.0.0",
"history": "^5.3.0",
Expand All @@ -58,8 +58,8 @@
"react-error-boundary": "^4.0.2",
"react-intl": "^5.15.3",
"react-query": "^3.34.0",
"react-router": "7.8.1",
"react-router-dom": "7.8.1",
"react-router": "7.13.0",
"react-router-dom": "7.13.0",
"styled-components": "^5.3.11",
"typescript": "^5.6.3",
"zod": "^4.0.17"
Expand Down
39 changes: 21 additions & 18 deletions shell-ui/src/navbar/NotificationCenter.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import React, { PropsWithChildren } from 'react';
import { act, screen, waitFor, within } from '@testing-library/react';
import NotificationCenterProvider, {
InternalNotification,
Notification,
} from '../NotificationCenterProvider';
import NotificationCenter from './NotificationCenter';
import userEvent from '@testing-library/user-event';
import { PropsWithChildren } from 'react';
import { QueryClient } from 'react-query';
import { prepareRenderMultipleHooks } from './__TESTS__/testMultipleHooks';
import { MemoryRouter, Route, Routes } from 'react-router-dom';
import { ShellHistoryProvider } from '../initFederation/ShellHistoryProvider';
import { useNotificationCenter } from '../useNotificationCenter';
import NotificationCenterProvider, {
InternalNotification,
Notification,
} from '../NotificationCenterProvider';
import { QueryClientProvider } from '../QueryClientProvider';
import { useNotificationCenter } from '../useNotificationCenter';
import { prepareRenderMultipleHooks } from './__TESTS__/testMultipleHooks';
import NotificationCenter from './NotificationCenter';
import {debug} from "jest-preview";

export const notificationCenterSelectors = {
const notificationCenterSelectors = {
notificationCenterButton: () =>
screen.getByRole('button', { name: /notification center/i }),
emptyNotificationCenterIcon: () =>
Expand Down Expand Up @@ -175,21 +176,23 @@ describe('NotificationCenter', () => {
//E open again the notification center
userEvent.click(notificationCenterSelectors.notificationCenterButton());
//V the notification are marked as read
debug();

expect(
within(screen.getAllByRole('option')[0]).queryByRole('img', {
name: /unread notification mark/i,
}),
).toBeNull();
name: /unread notification mark/i,
}),
).not.toBeVisible();
expect(
within(screen.getAllByRole('option')[1]).queryByRole('img', {
name: /unread notification mark/i,
}),
).toBeNull();
).not.toBeVisible();
expect(
within(screen.getAllByRole('option')[2]).queryByRole('img', {
name: /unread notification mark/i,
}),
).toBeNull();
).not.toBeVisible();
});

it('can be navigated with the keyboard', async () => {
Expand Down Expand Up @@ -241,7 +244,7 @@ describe('NotificationCenter', () => {
within(lastNotification).queryByRole('img', {
name: /unread notification mark/i,
}),
).toBeNull();
).not.toBeVisible();
});

it('should not display notifications with the same ID', async () => {
Expand All @@ -267,17 +270,17 @@ describe('NotificationCenter', () => {
within(screen.getAllByRole('option')[0]).queryByRole('img', {
name: /unread notification mark/i,
}),
).toBeNull();
).not.toBeVisible();
expect(
within(screen.getAllByRole('option')[1]).queryByRole('img', {
name: /unread notification mark/i,
}),
).toBeNull();
).not.toBeVisible();
expect(
within(screen.getAllByRole('option')[2]).queryByRole('img', {
name: /unread notification mark/i,
}),
).toBeNull();
).not.toBeVisible();
//E
userEvent.click(notificationCenterSelectors.notificationCenterButton());
//V
Expand Down
Loading
Loading