From edbf1f847bea36d637f55c9e31b033d0c31dbf4c Mon Sep 17 00:00:00 2001 From: "David P. Steelman" Date: Thu, 20 Oct 2022 11:49:02 -0400 Subject: [PATCH] Issue 1920 - "data-service.decorator.spec.ts" tests fails intermittently Replaced the timestamp (intended to produce unique "testType" instances) with UUID, because intermittent failures are occurring when tests are running quickly enough that the "new Data().getTime()" function is returning the same timestamp for multiple tests. --- src/app/core/data/base/data-service.decorator.spec.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/app/core/data/base/data-service.decorator.spec.ts b/src/app/core/data/base/data-service.decorator.spec.ts index ec4c1c8f6f..e09c531a56 100644 --- a/src/app/core/data/base/data-service.decorator.spec.ts +++ b/src/app/core/data/base/data-service.decorator.spec.ts @@ -10,6 +10,7 @@ import { ResourceType } from '../../shared/resource-type'; import { BaseDataService } from './base-data.service'; import { HALDataService } from './hal-data-service.interface'; import { dataService, getDataServiceFor } from './data-service.decorator'; +import { v4 as uuidv4 } from 'uuid'; class TestService extends BaseDataService { } @@ -28,7 +29,7 @@ let testType; describe('@dataService/getDataServiceFor', () => { beforeEach(() => { - testType = new ResourceType('testType-' + new Date().getTime()); + testType = new ResourceType(`testType-${uuidv4()}`); }); it('should register a resourcetype for a dataservice', () => {