@@ -5,7 +5,6 @@ import makeRouter from "@/router";
5
5
import { createTestingPinia } from "@pinia/testing" ;
6
6
import { MessageStore } from "@/stores/MessageStore" ;
7
7
import { MessageStatus } from "@/resources/Message" ;
8
- import { toLocalDateTimeString } from "@/composables/formatUtils" ;
9
8
10
9
//Defines a domain-specific language (DSL) for interacting with the system under test (sut)
11
10
interface componentDSL {
@@ -15,7 +14,7 @@ interface componentDSL {
15
14
16
15
//Defines a domain-specific language (DSL) for checking assertions against the system under test (sut)
17
16
interface componentDSLAssertions {
18
- thereAreTheFollowingSagaChangesInThisOrder ( sagaUpdates : { expectedRenderedLocalTime : string } [ ] ) : void ;
17
+ thereAreTheFollowingSagaChangesInThisOrder ( sagaUpdates : { expectedTime : Date } [ ] ) : void ;
19
18
displayedSagaGuidIs ( sagaId : string ) : void ;
20
19
displayedSagaNameIs ( humanizedSagaName : string ) : void ;
21
20
linkIsShown ( arg0 : { withText : string ; withHref : string } ) : void ;
@@ -138,14 +137,14 @@ describe("Feature: 3 Visual Representation of Saga Timeline", () => {
138
137
//so that the reader of this test can see the preconditions at play
139
138
//and understand the test better without having to jump around
140
139
141
- const startTimeA = new Date ( "2025-03-28T03:04:08.3819211Z " ) ;
142
- const finishTimeA1 = new Date ( "2025-03-28T03:04:08.3836Z " ) ;
143
- const startTimeB = new Date ( "2025-03-28T03:04:07.5416262Z " ) ;
144
- const finishTimeB1 = new Date ( "2025-03-28T03:04:07.5509712Z " ) ;
145
- const startTimeC = new Date ( "2025-03-28T03:04:06.3088353Z " ) ;
146
- const finishTimeC1 = new Date ( "2025-03-28T03:04:06.3218175Z " ) ;
147
- const startTimeD = new Date ( "2025-03-28T03:04:05.3332078Z " ) ;
148
- const finishTimeD1 = new Date ( "2025-03-28T03:04:05.3799483Z " ) ;
140
+ const startTimeA = new Date ( "2025-03-28T03:04:08.000Z " ) ;
141
+ const finishTimeA1 = new Date ( "2025-03-28T03:04:08.000Z " ) ;
142
+ const startTimeB = new Date ( "2025-03-28T03:04:07.000Z " ) ;
143
+ const finishTimeB1 = new Date ( "2025-03-28T03:04:07.000Z " ) ;
144
+ const startTimeC = new Date ( "2025-03-28T03:04:06.000Z " ) ;
145
+ const finishTimeC1 = new Date ( "2025-03-28T03:04:06.000Z " ) ;
146
+ const startTimeD = new Date ( "2025-03-28T03:04:05.000Z " ) ;
147
+ const finishTimeD1 = new Date ( "2025-03-28T03:04:05.000Z " ) ;
149
148
150
149
sampleSagaHistory . changes [ 0 ] . start_time = startTimeA ;
151
150
sampleSagaHistory . changes [ 0 ] . finish_time = finishTimeA1 ;
@@ -171,16 +170,16 @@ describe("Feature: 3 Visual Representation of Saga Timeline", () => {
171
170
//assert
172
171
componentDriver . assert . thereAreTheFollowingSagaChangesInThisOrder ( [
173
172
{
174
- expectedRenderedLocalTime : toLocalDateTimeString ( startTimeD ) ,
173
+ expectedTime : startTimeD ,
175
174
} ,
176
175
{
177
- expectedRenderedLocalTime : toLocalDateTimeString ( startTimeC ) ,
176
+ expectedTime : startTimeC ,
178
177
} ,
179
178
{
180
- expectedRenderedLocalTime : toLocalDateTimeString ( startTimeB ) ,
179
+ expectedTime : startTimeB ,
181
180
} ,
182
181
{
183
- expectedRenderedLocalTime : toLocalDateTimeString ( startTimeA ) ,
182
+ expectedTime : startTimeA ,
184
183
} ,
185
184
] ) ;
186
185
} ) ;
@@ -212,14 +211,14 @@ describe("Feature: 3 Visual Representation of Saga Timeline", () => {
212
211
// but set them again explicitly here
213
212
//so that the reader of this test can see the preconditions at play
214
213
//and understand the test better without having to jump around
215
- const startTimeA = new Date ( "2025-03-28T03:04:08.3819211Z " ) ;
216
- const finishTimeA1 = new Date ( "2025-03-28T03:04:08.3836Z " ) ;
217
- const startTimeB = new Date ( "2025-03-28T03:04:07.5416262Z " ) ;
218
- const finishTimeB1 = new Date ( "2025-03-28T03:04:07.5509712Z " ) ;
219
- const startTimeC = new Date ( "2025-03-28T03:04:06.3088353Z " ) ;
220
- const finishTimeC1 = new Date ( "2025-03-28T03:04:06.3218175Z " ) ;
221
- const startTimeD = new Date ( "2025-03-28T03:04:05.3332078Z " ) ;
222
- const finishTimeD1 = new Date ( "2025-03-28T03:04:05.3799483Z " ) ;
214
+ const startTimeA = new Date ( "2025-03-28T03:04:08.000Z " ) ;
215
+ const finishTimeA1 = new Date ( "2025-03-28T03:04:08.000Z " ) ;
216
+ const startTimeB = new Date ( "2025-03-28T03:04:07.000Z " ) ;
217
+ const finishTimeB1 = new Date ( "2025-03-28T03:04:07.000Z " ) ;
218
+ const startTimeC = new Date ( "2025-03-28T03:04:06.000Z " ) ;
219
+ const finishTimeC1 = new Date ( "2025-03-28T03:04:06.000Z " ) ;
220
+ const startTimeD = new Date ( "2025-03-28T03:04:05.000Z " ) ;
221
+ const finishTimeD1 = new Date ( "2025-03-28T03:04:05.000Z " ) ;
223
222
224
223
sampleSagaHistory . changes [ 0 ] . start_time = startTimeA ;
225
224
sampleSagaHistory . changes [ 0 ] . finish_time = finishTimeA1 ;
@@ -243,16 +242,16 @@ describe("Feature: 3 Visual Representation of Saga Timeline", () => {
243
242
244
243
componentDriver . assert . thereAreTheFollowingSagaChangesInThisOrder ( [
245
244
{
246
- expectedRenderedLocalTime : toLocalDateTimeString ( startTimeD ) ,
245
+ expectedTime : startTimeD ,
247
246
} ,
248
247
{
249
- expectedRenderedLocalTime : toLocalDateTimeString ( startTimeC ) ,
248
+ expectedTime : startTimeC ,
250
249
} ,
251
250
{
252
- expectedRenderedLocalTime : toLocalDateTimeString ( startTimeB ) ,
251
+ expectedTime : startTimeB ,
253
252
} ,
254
253
{
255
- expectedRenderedLocalTime : toLocalDateTimeString ( startTimeA ) ,
254
+ expectedTime : startTimeA ,
256
255
} ,
257
256
] ) ;
258
257
} ) ;
@@ -336,7 +335,7 @@ function rendercomponent({ initialState = {} }: { initialState?: { MessageStore?
336
335
expect ( sagaGuid ) . toBeInTheDocument ( ) ;
337
336
expect ( sagaGuid ) . toHaveTextContent ( guid ) ;
338
337
} ,
339
- thereAreTheFollowingSagaChangesInThisOrder : function ( sagaUpdates : { expectedRenderedLocalTime : string } [ ] ) : void {
338
+ thereAreTheFollowingSagaChangesInThisOrder : function ( sagaUpdates : { expectedTime : Date } [ ] ) : void {
340
339
//Retrive the main parent component that contains the saga changes
341
340
const sagaChangesContainer = screen . getByRole ( "table" , { name : / s a g a - s e q u e n c e - l i s t / i } ) ;
342
341
@@ -350,8 +349,16 @@ function rendercomponent({ initialState = {} }: { initialState?: { MessageStore?
350
349
351
350
const sagaUpdatesTimestampsValues = sagaUpdatesTimestamps . map ( ( item ) => item . innerHTML ) ;
352
351
353
- // //check if the values are in the same order as the sagaUpdates array passed to this function
354
- expect ( sagaUpdatesTimestampsValues ) . toEqual ( sagaUpdates . map ( ( item ) => item . expectedRenderedLocalTime ) ) ;
352
+ // Parse the rendered timestamp strings back to Date objects for comparison
353
+ const parsedDatesFromUI = sagaUpdatesTimestampsValues . map ( ( timestampString ) => {
354
+ // Parse the retrieved timestamp string back to a Date
355
+ return new Date ( timestampString ) ;
356
+ } ) ;
357
+
358
+ const expectedDates = sagaUpdates . map ( ( item ) => item . expectedTime ) ;
359
+
360
+ // Compare the dates directly
361
+ expect ( parsedDatesFromUI ) . toEqual ( expectedDates ) ;
355
362
} ,
356
363
} ,
357
364
} ;
0 commit comments