Skip to content

Commit cc8fca0

Browse files
committed
Update tests to use copy
Signed-off-by: Milos Dzepina <milos@aragon.org>
1 parent 356ad24 commit cc8fca0

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

src/modules/components/action/actionSimulation/actionSimulation.test.tsx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import { render, screen } from '@testing-library/react';
22
import { DateTime } from 'luxon';
33
import { GukCoreProvider } from '../../../../core';
4+
import { modulesCopy } from '../../../assets';
45
import { ActionSimulation } from './actionSimulation';
56
import type { IActionSimulationProps } from './actionSimulation.api';
67

8+
const { actionSimulation: actionSimulationCopy } = modulesCopy;
9+
710
describe('<ActionSimulation /> component', () => {
811
const createTestComponent = (props?: Partial<IActionSimulationProps>) => {
912
const completeProps: IActionSimulationProps = {
@@ -21,9 +24,9 @@ describe('<ActionSimulation /> component', () => {
2124
it('renders all definition list items', () => {
2225
render(createTestComponent());
2326

24-
expect(screen.getByText('Total actions')).toBeInTheDocument();
25-
expect(screen.getByText('Last simulation')).toBeInTheDocument();
26-
expect(screen.getByText('Executable')).toBeInTheDocument();
27+
expect(screen.getByText(actionSimulationCopy.totalActionsTerm)).toBeInTheDocument();
28+
expect(screen.getByText(actionSimulationCopy.lastSimulationTerm)).toBeInTheDocument();
29+
expect(screen.getByText(actionSimulationCopy.executableTerm)).toBeInTheDocument();
2730
});
2831

2932
it('renders the total actions count', () => {
@@ -38,7 +41,7 @@ describe('<ActionSimulation /> component', () => {
3841

3942
it('renders "Never" when no last simulation is provided', () => {
4043
render(createTestComponent());
41-
expect(screen.getByText('Never')).toBeInTheDocument();
44+
expect(screen.getByText(actionSimulationCopy.never)).toBeInTheDocument();
4245
});
4346

4447
it('renders the execution status label', () => {
@@ -51,7 +54,7 @@ describe('<ActionSimulation /> component', () => {
5154
},
5255
}),
5356
);
54-
expect(screen.getByText('Likely to succeed')).toBeInTheDocument();
57+
expect(screen.getByText(actionSimulationCopy.likelyToSucceed)).toBeInTheDocument();
5558
});
5659

5760
it('renders failure status label', () => {
@@ -64,12 +67,12 @@ describe('<ActionSimulation /> component', () => {
6467
},
6568
}),
6669
);
67-
expect(screen.getByText('Likely to fail')).toBeInTheDocument();
70+
expect(screen.getByText(actionSimulationCopy.likelyToFail)).toBeInTheDocument();
6871
});
6972

7073
it('renders unknown status when no lastSimulation is provided', () => {
7174
render(createTestComponent());
72-
expect(screen.getByText('Unknown')).toBeInTheDocument();
75+
expect(screen.getByText(actionSimulationCopy.unknown)).toBeInTheDocument();
7376
});
7477

7578
it('renders loading state when execution status is loading', () => {
@@ -79,18 +82,18 @@ describe('<ActionSimulation /> component', () => {
7982
}),
8083
);
8184

82-
expect(screen.getAllByText('Simulating')).toHaveLength(3);
85+
expect(screen.getAllByText(actionSimulationCopy.simulating)).toHaveLength(3);
8386
});
8487

8588
it('shows simulate button by default when isSimulatable is not specified', () => {
8689
render(createTestComponent());
8790

88-
expect(screen.getByText(/simulate/i)).toBeInTheDocument();
91+
expect(screen.getByText(actionSimulationCopy.simulate)).toBeInTheDocument();
8992
});
9093

9194
it('hides simulate button when isSimulatable is false', () => {
9295
render(createTestComponent({ isEnabled: false }));
9396

94-
expect(screen.queryByText(/simulate/i)).toBeNull();
97+
expect(screen.queryByText(actionSimulationCopy.simulate)).toBeNull();
9598
});
9699
});

0 commit comments

Comments
 (0)