Skip to content

Commit 932b6fc

Browse files
test(frontend): Use i18n close label in HiddenMicroTransactionsInfoBox tests
Co-authored-by: Antonio Ventilii <[email protected]>
1 parent 5700800 commit 932b6fc

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/frontend/src/tests/lib/components/transactions/HiddenMicroTransactionsInfoBox.spec.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { NOTIFICATION_VERSIONS } from '$lib/constants/notification.constants';
44
import * as notificationServices from '$lib/services/notification.services';
55
import { hiddenMicroTransactionsResetStore } from '$lib/stores/settings.store';
66
import { userProfileStore } from '$lib/stores/user-profile.store';
7+
import en from '$tests/mocks/i18n.mock';
78
import { mockUserProfile, mockUserSettings } from '$tests/mocks/user-profile.mock';
89
import { toNullable } from '@dfinity/utils';
910
import { fireEvent, render } from '@testing-library/svelte';
@@ -50,15 +51,15 @@ describe('HiddenMicroTransactionsInfoBox', () => {
5051

5152
const { queryByRole } = render(HiddenMicroTransactionsInfoBox);
5253

53-
expect(queryByRole('button', { name: 'Close' })).toBeInTheDocument();
54+
expect(queryByRole('button', { name: en.core.text.close })).toBeInTheDocument();
5455
});
5556

5657
it('is hidden when the feature is off', () => {
5758
setUserProfile({ hideMicroTransactions: false });
5859

5960
const { queryByRole } = render(HiddenMicroTransactionsInfoBox);
6061

61-
expect(queryByRole('button', { name: 'Close' })).not.toBeInTheDocument();
62+
expect(queryByRole('button', { name: en.core.text.close })).not.toBeInTheDocument();
6263
});
6364

6465
it('is hidden when the backend notification is dismissed and the reset flag is off', () => {
@@ -69,7 +70,7 @@ describe('HiddenMicroTransactionsInfoBox', () => {
6970

7071
const { queryByRole } = render(HiddenMicroTransactionsInfoBox);
7172

72-
expect(queryByRole('button', { name: 'Close' })).not.toBeInTheDocument();
73+
expect(queryByRole('button', { name: en.core.text.close })).not.toBeInTheDocument();
7374
});
7475

7576
it('re-shows the info box when the reset flag is on, even if the backend notification is dismissed (OISY-2876)', () => {
@@ -84,7 +85,7 @@ describe('HiddenMicroTransactionsInfoBox', () => {
8485

8586
const { queryByRole } = render(HiddenMicroTransactionsInfoBox);
8687

87-
expect(queryByRole('button', { name: 'Close' })).toBeInTheDocument();
88+
expect(queryByRole('button', { name: en.core.text.close })).toBeInTheDocument();
8889
});
8990

9091
it('clears the reset flag and persists the backend dismissal when the user closes the box', async () => {
@@ -99,7 +100,7 @@ describe('HiddenMicroTransactionsInfoBox', () => {
99100

100101
const { getByRole } = render(HiddenMicroTransactionsInfoBox);
101102

102-
await fireEvent.click(getByRole('button', { name: 'Close' }));
103+
await fireEvent.click(getByRole('button', { name: en.core.text.close }));
103104

104105
expect(get(hiddenMicroTransactionsResetStore).enabled).toBeFalsy();
105106

0 commit comments

Comments
 (0)