@@ -325,6 +325,7 @@ describe('RegistrarHome tests', async () => {
325325 ) . toContain ( 'Sent for updates (5)' )
326326 } )
327327 it ( 'renders all items returned from graphql query in ready for reivew' , async ( ) => {
328+ const TIME_STAMP = '1544188309380'
328329 Date . now = jest . fn ( ( ) => 1554055200000 )
329330 const graphqlMock = [
330331 {
@@ -353,8 +354,8 @@ describe('RegistrarHome tests', async () => {
353354 registeredLocationId :
354355 '308c35b4-04f8-4664-83f5-9790e790cde1' ,
355356 duplicates : null ,
356- createdAt : '2018-05-23T14:44:58+02:00' ,
357- modifiedAt : '2018-05-23T14:44:58+02:00'
357+ createdAt : TIME_STAMP ,
358+ modifiedAt : TIME_STAMP
358359 } ,
359360 dateOfBirth : '2010-10-10' ,
360361 childName : [
@@ -381,8 +382,8 @@ describe('RegistrarHome tests', async () => {
381382 duplicates : [ '308c35b4-04f8-4664-83f5-9790e790cd33' ] ,
382383 registeredLocationId :
383384 '308c35b4-04f8-4664-83f5-9790e790cde1' ,
384- createdAt : '2007-01-01' ,
385- modifiedAt : '2007-01-01'
385+ createdAt : TIME_STAMP ,
386+ modifiedAt : TIME_STAMP
386387 } ,
387388 dateOfBirth : null ,
388389 childName : null ,
@@ -421,19 +422,23 @@ describe('RegistrarHome tests', async () => {
421422 } )
422423 testComponent . component . update ( )
423424 const data = testComponent . component . find ( GridTable ) . prop ( 'content' )
425+ const EXPECTED_DATE_OF_APPLICATION = moment (
426+ moment ( TIME_STAMP , 'x' ) . format ( 'YYYY-MM-DD HH:mm:ss' ) ,
427+ 'YYYY-MM-DD HH:mm:ss'
428+ ) . fromNow ( )
424429
425430 expect ( data . length ) . toBe ( 2 )
426431 expect ( data [ 0 ] . id ) . toBe ( 'e302f7c5-ad87-4117-91c1-35eaf2ea7be8' )
427432 expect ( data [ 0 ] . event_time_elapsed ) . toBe ( '8 years ago' )
428- expect ( data [ 0 ] . application_time_elapsed ) . toBe ( '10 months ago' )
433+ expect ( data [ 0 ] . application_time_elapsed ) . toBe ( EXPECTED_DATE_OF_APPLICATION )
429434 expect ( data [ 0 ] . tracking_id ) . toBe ( 'BW0UTHR' )
430435 expect ( data [ 0 ] . event ) . toBe ( 'Birth' )
431436 expect ( data [ 0 ] . actions ) . toBeDefined ( )
432437
433438 testComponent . component . unmount ( )
434439 } )
435440 it ( 'renders all items returned from graphql query in rejected tab' , async ( ) => {
436- const TIME_STAMP = '2018-12-07T13:11:49.380Z '
441+ const TIME_STAMP = '1544188309380 '
437442 const graphqlMock = [
438443 {
439444 request : {
@@ -525,13 +530,13 @@ describe('RegistrarHome tests', async () => {
525530
526531 // wait for mocked data to load mockedProvider
527532 await new Promise ( resolve => {
528- setTimeout ( resolve , 100 )
533+ setTimeout ( resolve , 200 )
529534 } )
530535 testComponent . component . update ( )
531536 const data = testComponent . component . find ( GridTable ) . prop ( 'content' )
532537 const EXPECTED_DATE_OF_REJECTION = moment (
533- TIME_STAMP ,
534- 'YYYY-MM-DD'
538+ moment ( TIME_STAMP , 'x' ) . format ( 'YYYY-MM-DD HH:mm:ss' ) ,
539+ 'YYYY-MM-DD HH:mm:ss '
535540 ) . fromNow ( )
536541
537542 expect ( data . length ) . toBe ( 2 )
0 commit comments