1
- // Copyright (c) 2014 - 2023 UNICEF. All rights reserved.
2
-
3
- import { Route } from "react-router-dom" ;
4
1
import { fromJS , OrderedMap } from "immutable" ;
5
2
6
3
import { ACTIONS } from "../permissions" ;
@@ -11,7 +8,6 @@ import { PrimeroModuleRecord } from "../application/records";
11
8
import RecordList from "./container" ;
12
9
13
10
describe ( "<RecordList />" , ( ) => {
14
-
15
11
const initialState = fromJS ( {
16
12
records : {
17
13
FiltersTabs : {
@@ -305,41 +301,39 @@ describe("<RecordList />", () => {
305
301
} ) ;
306
302
307
303
it ( "renders record list table" , done => {
308
- mountedComponent ( < RecordList /> , initialState , [ "/cases" ] )
309
- expect ( screen . getByRole ( ' toolbar' ) ) . toBeInTheDocument ( )
304
+ mountedComponent ( < RecordList /> , initialState , [ "/cases" ] ) ;
305
+ expect ( screen . getByRole ( " toolbar" ) ) . toBeInTheDocument ( ) ;
310
306
done ( ) ;
311
307
} ) ;
312
308
313
309
it ( "renders record view modal" , done => {
314
- mountedComponent ( < RecordList /> , initialState , [ "/cases" ] )
315
- expect ( screen . getAllByText ( ' messages.record_list.rows_per_page' ) ) . toHaveLength ( 2 )
316
-
310
+ mountedComponent ( < RecordList /> , initialState , [ "/cases" ] ) ;
311
+ expect ( screen . getAllByText ( " messages.record_list.rows_per_page" ) ) . toHaveLength ( 2 ) ;
312
+
317
313
done ( ) ;
318
314
} ) ;
319
315
320
316
it ( "opens the view modal when a record is clicked" , ( ) => {
321
- mountedComponent ( < RecordList /> , initialState , [ "/cases" ] )
322
- expect ( screen . getAllByText ( ' messages.record_list.rows_per_page' ) ) . toHaveLength ( 2 )
317
+ mountedComponent ( < RecordList /> , initialState , [ "/cases" ] ) ;
318
+ expect ( screen . getAllByText ( " messages.record_list.rows_per_page" ) ) . toHaveLength ( 2 ) ;
323
319
} ) ;
324
320
325
321
it ( "renders filters" , ( ) => {
326
- mountedComponent ( < RecordList /> , initialState , [ "/cases" ] )
327
- expect ( screen . getByTestId ( 'filters' ) ) . toBeInTheDocument ( )
328
-
322
+ mountedComponent ( < RecordList /> , initialState , [ "/cases" ] ) ;
323
+ expect ( screen . getByTestId ( "filters" ) ) . toBeInTheDocument ( ) ;
329
324
} ) ;
330
325
331
326
describe ( "when offline" , ( ) => {
332
-
333
327
it ( "when a record is clicked it does not open the view modal" , ( ) => {
334
- mountedComponent ( < RecordList /> , initialState . setIn ( [ "application" , "online" ] , false ) , [ "/cases" ] )
335
- expect ( screen . getByTestId ( 'filters' ) ) . toBeInTheDocument ( )
328
+ mountedComponent ( < RecordList /> , initialState . setIn ( [ "application" , "online" ] , false ) , [ "/cases" ] ) ;
329
+ expect ( screen . queryAllByRole ( "presentation" ) ) . toHaveLength ( 0 ) ;
336
330
} ) ;
337
331
} ) ;
338
332
339
333
describe ( "when age is 0" , ( ) => {
340
334
it ( "renders a 0 in the cell " , ( ) => {
341
- mountedComponent ( < RecordList /> , initialState . setIn ( [ "application" , "online" ] , false ) , [ "/cases" ] )
342
- expect ( screen . getAllByText ( ' 0-0 messages.record_list.of 0' ) ) . toHaveLength ( 2 )
335
+ mountedComponent ( < RecordList /> , initialState . setIn ( [ "application" , "online" ] , false ) , [ "/cases" ] ) ;
336
+ expect ( screen . getAllByText ( " 0-0 messages.record_list.of 0" ) ) . toHaveLength ( 2 ) ;
343
337
} ) ;
344
338
} ) ;
345
339
} ) ;
0 commit comments