From 07a4b9bb415166f9ad622fd80b57d2f55771f5c8 Mon Sep 17 00:00:00 2001 From: Wesley Finck Date: Thu, 12 Mar 2026 09:59:34 -0700 Subject: [PATCH] fix unit test for time sorting --- .../tests/application/GetConnectionsUseCase.test.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/modules/cards/tests/application/GetConnectionsUseCase.test.ts b/src/modules/cards/tests/application/GetConnectionsUseCase.test.ts index 33887924..e6ce4f35 100644 --- a/src/modules/cards/tests/application/GetConnectionsUseCase.test.ts +++ b/src/modules/cards/tests/application/GetConnectionsUseCase.test.ts @@ -112,7 +112,10 @@ describe('GetConnectionsUseCase', () => { await cardRepository.save(card2); await cardRepository.save(card3); - // Create connections from curator1 + // Create connections from curator1 with explicit timestamps to ensure stable ordering + const baseTime = new Date('2024-01-01T00:00:00Z'); + const laterTime = new Date('2024-01-02T00:00:00Z'); + const source1 = UrlOrCardId.createFromUrl( URL.create(url1).unwrap(), ).unwrap(); @@ -124,6 +127,8 @@ describe('GetConnectionsUseCase', () => { target: target1, type: ConnectionType.create(ConnectionTypeEnum.SUPPORTS).unwrap(), curatorId: curator1, + createdAt: baseTime, + updatedAt: baseTime, }).unwrap(); const source2 = UrlOrCardId.createFromUrl( @@ -138,6 +143,8 @@ describe('GetConnectionsUseCase', () => { type: ConnectionType.create(ConnectionTypeEnum.RELATED).unwrap(), note: ConnectionNote.create('Test note').unwrap(), curatorId: curator1, + createdAt: laterTime, + updatedAt: laterTime, }).unwrap(); await connectionRepository.save(connection1); -- 2.51.2