@@ -457,6 +457,43 @@ describe('ActivityService tests', () => {
457457 expect ( activityCreated7 . conversationId ) . toStrictEqual ( conversationCreated2 . id )
458458 } )
459459
460+ it ( 'Should keep old timestamp' , async ( ) => {
461+ const mockIRepositoryOptions = await SequelizeTestUtils . getTestIRepositoryOptions ( db )
462+ const memberService = new MemberService ( mockIRepositoryOptions )
463+ const activityService = new ActivityService ( mockIRepositoryOptions )
464+
465+ const cm = await memberService . upsert ( {
466+ username : {
467+ [ PlatformType . DISCORD ] : 'test' ,
468+ } ,
469+ platform : PlatformType . DISCORD ,
470+ } )
471+
472+ const activity1 = {
473+ type : 'message' ,
474+ timestamp : '2020-05-27T15:13:30Z' ,
475+ member : cm . id ,
476+ platform : PlatformType . DISCORD ,
477+ sourceId : 'sourceId#1' ,
478+ }
479+
480+ const activityCreated1 = await activityService . upsert ( activity1 )
481+
482+ const activity2 = {
483+ type : 'message' ,
484+ timestamp : '2022-05-27T15:13:30Z' ,
485+ member : cm . id ,
486+ platform : PlatformType . DISCORD ,
487+ sourceId : 'sourceId#1' ,
488+ body : 'What is love?' ,
489+ }
490+
491+ const activityCreated2 = await activityService . upsert ( activity2 )
492+
493+ expect ( activityCreated2 . timestamp ) . toStrictEqual ( activityCreated1 . timestamp )
494+ expect ( activityCreated2 . body ) . toBe ( activity2 . body )
495+ } )
496+
460497 it ( 'Should create various conversations successfully with given parent-child relationships of activities [descending timestamp order]' , async ( ) => {
461498 const mockIRepositoryOptions = await SequelizeTestUtils . getTestIRepositoryOptions ( db )
462499 const memberService = new MemberService ( mockIRepositoryOptions )
0 commit comments