Skip to content

Commit

Permalink
Fix flaky test due to date comparison
Browse files Browse the repository at this point in the history
  • Loading branch information
farnoux committed Dec 18, 2024
1 parent 566d093 commit 03200e7
Showing 1 changed file with 9 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { INestApplication } from '@nestjs/common';
import { DateTime } from 'luxon';
import { default as request } from 'supertest';
import { getTestApp } from '../../../test/app-utils';
import { getAuthToken } from '../../../test/auth-utils';
Expand Down Expand Up @@ -251,22 +250,18 @@ describe('Referentiels scoring routes', () => {
snapshots: [
{
auditId: null,
createdAt:
getReferentielScoresCourantResponseType.snapshot!.createdAt,
createdAt: expect.toEqualDate(
getReferentielScoresCourantResponseType.snapshot!.createdAt
),
createdBy: null,
modifiedBy: getReferentielScoresCourantResponseType.snapshot
?.modifiedBy as string,
date: expect.stringContaining(
DateTime.fromISO(getReferentielScoresCourantResponseType.date, {
zone: 'utc',
}).toSQL({
includeOffset: false,
includeOffsetSpace: false,
includeZone: false,
}) as string
date: expect.toEqualDate(
getReferentielScoresCourantResponseType.date
),
modifiedAt: expect.toEqualDate(
getReferentielScoresCourantResponseType.snapshot!.modifiedAt
),
modifiedAt:
getReferentielScoresCourantResponseType.snapshot!.modifiedAt,
nom: 'Score courant',
pointFait: 0.36,
pointPasFait: 0.03,
Expand Down Expand Up @@ -306,14 +301,7 @@ describe('Referentiels scoring routes', () => {
typesJalon: [ScoreJalon.DATE_PERSONNALISEE],
snapshots: [
{
date: expect.stringContaining(
DateTime.fromISO(getReferentielScoresResponseType.date, {
zone: 'utc',
}).toSQL({
includeOffset: false,
includeOffsetSpace: false,
}) as string
),
date: expect.toEqualDate(getReferentielScoresResponseType.date),
nom: 'test à accent',
ref: 'user-test-a-accent',
typeJalon: ScoreJalon.DATE_PERSONNALISEE,
Expand Down

0 comments on commit 03200e7

Please sign in to comment.