Skip to content

Commit 0fc4f1e

Browse files
committed
Fix tests for navigation path
1 parent c930a64 commit 0fc4f1e

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

frontend/src/common/components/Router/__tests__/TabNavigation.test.tsx

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -36,28 +36,28 @@ vi.mock('@ionic/react', async () => {
3636
return {
3737
...actual,
3838
IonApp: ({ children }: { children: React.ReactNode }) => <div data-testid="mock-ion-app">{children}</div>,
39-
IonTabs: ({ children, className }: { children: React.ReactNode, className?: string }) =>
39+
IonTabs: ({ children, className }: { children: React.ReactNode, className?: string }) =>
4040
<div data-testid="mock-ion-tabs" className={className}>{children}</div>,
41-
IonRouterOutlet: ({ children, id }: { children: React.ReactNode, id?: string }) =>
41+
IonRouterOutlet: ({ children, id }: { children: React.ReactNode, id?: string }) =>
4242
<div data-testid="mock-ion-router-outlet" id={id}>{children}</div>,
43-
IonTabBar: ({ children, slot, className }: { children: React.ReactNode, slot?: string, className?: string }) =>
43+
IonTabBar: ({ children, slot, className }: { children: React.ReactNode, slot?: string, className?: string }) =>
4444
<div data-testid="mock-ion-tab-bar" data-slot={slot} className={className}>{children}</div>,
45-
IonTabButton: ({
46-
children,
47-
tab,
45+
IonTabButton: ({
46+
children,
47+
tab,
4848
href,
4949
className,
50-
onClick
51-
}: {
52-
children: React.ReactNode,
53-
tab?: string,
50+
onClick
51+
}: {
52+
children: React.ReactNode,
53+
tab?: string,
5454
href?: string,
5555
className?: string,
5656
onClick?: () => void
5757
}) => {
5858
const tabButton = (
59-
<div
60-
data-testid={`mock-ion-tab-button-${tab}`}
59+
<div
60+
data-testid={`mock-ion-tab-button-${tab}`}
6161
data-tab={tab}
6262
data-href={href}
6363
className={className}
@@ -132,9 +132,9 @@ vi.mock('../../Icon/Icon', () => ({
132132
size?: string;
133133
fixedWidth?: boolean;
134134
}) => (
135-
<div
136-
data-testid={`mock-icon-${icon}`}
137-
data-icon-style={iconStyle}
135+
<div
136+
data-testid={`mock-icon-${icon}`}
137+
data-icon-style={iconStyle}
138138
className={className}
139139
data-size={size}
140140
data-fixed-width={fixedWidth ? 'true' : 'false'}
@@ -220,16 +220,16 @@ describe('TabNavigation', () => {
220220
// ASSERT
221221
// Check for home tab button
222222
expect(screen.getByTestId('mock-ion-tab-button-home')).toHaveAttribute('data-href', '/tabs/home');
223-
223+
224224
// Check for analytics tab button
225-
expect(screen.getByTestId('mock-ion-tab-button-analytics')).toHaveAttribute('data-href', '/tabs/analytics');
226-
225+
expect(screen.getByTestId('mock-ion-tab-button-reports')).toHaveAttribute('data-href', '/reports');
226+
227227
// Check for chat tab button
228228
expect(screen.getByTestId('mock-ion-tab-button-chat')).toHaveAttribute('data-href', '/tabs/chat');
229-
229+
230230
// Check for account tab button
231231
expect(screen.getByTestId('mock-ion-tab-button-account')).toHaveAttribute('data-href', '/tabs/account');
232-
232+
233233
// Upload button doesn't have href attribute as it opens modal
234234
const uploadButton = screen.getByTestId('mock-ion-tab-button-upload');
235235
expect(uploadButton).not.toHaveAttribute('data-href');
@@ -242,16 +242,16 @@ describe('TabNavigation', () => {
242242
// ASSERT
243243
// Check for home tab button
244244
expect(screen.getByTestId('mock-ion-tab-button-home')).toHaveAttribute('data-tab', 'home');
245-
245+
246246
// Check for analytics tab button
247-
expect(screen.getByTestId('mock-ion-tab-button-analytics')).toHaveAttribute('data-tab', 'analytics');
248-
247+
expect(screen.getByTestId('mock-ion-tab-button-reports')).toHaveAttribute('data-tab', 'reports');
248+
249249
// Check for upload tab button
250250
expect(screen.getByTestId('mock-ion-tab-button-upload')).toHaveAttribute('data-tab', 'upload');
251-
251+
252252
// Check for chat tab button
253253
expect(screen.getByTestId('mock-ion-tab-button-chat')).toHaveAttribute('data-tab', 'chat');
254-
254+
255255
// Check for account tab button
256256
expect(screen.getByTestId('mock-ion-tab-button-account')).toHaveAttribute('data-tab', 'account');
257257
});
@@ -264,21 +264,21 @@ describe('TabNavigation', () => {
264264
// Home icon should not have a style (using default solid)
265265
const homeIcon = screen.getByTestId('mock-icon-home');
266266
expect(homeIcon).not.toHaveAttribute('data-icon-style');
267-
267+
268268
// FileLines icon should have regular style
269269
const fileLinesIcon = screen.getByTestId('mock-icon-fileLines');
270270
expect(fileLinesIcon).toHaveAttribute('data-icon-style', 'regular');
271-
271+
272272
// Upload icon should not have a style (using default solid)
273273
const uploadIcon = screen.getByTestId('mock-icon-arrowUpFromBracket');
274274
expect(uploadIcon).not.toHaveAttribute('data-icon-style');
275-
275+
276276
// Comment icon should have regular style
277277
const commentIcon = screen.getByTestId('mock-icon-comment');
278278
expect(commentIcon).toHaveAttribute('data-icon-style', 'regular');
279-
279+
280280
// User icon should not have a style (using default solid)
281281
const userIcon = screen.getByTestId('mock-icon-userCircle');
282282
expect(userIcon).not.toHaveAttribute('data-icon-style');
283283
});
284-
});
284+
});

0 commit comments

Comments
 (0)