11import { render , screen } from '@testing-library/react' ;
22import { DateTime } from 'luxon' ;
33import { GukCoreProvider } from '../../../../core' ;
4+ import { modulesCopy } from '../../../assets' ;
45import { ActionSimulation } from './actionSimulation' ;
56import type { IActionSimulationProps } from './actionSimulation.api' ;
67
8+ const { actionSimulation : actionSimulationCopy } = modulesCopy ;
9+
710describe ( '<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 ( / s i m u l a t e / 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 ( / s i m u l a t e / i ) ) . toBeNull ( ) ;
97+ expect ( screen . queryByText ( actionSimulationCopy . simulate ) ) . toBeNull ( ) ;
9598 } ) ;
9699} ) ;
0 commit comments