From 9af905d5d4be8700f4476793cfc2d50b457effbf Mon Sep 17 00:00:00 2001 From: iris Date: Mon, 12 Dec 2022 15:09:48 +0800 Subject: [PATCH] update test case Signed-off-by: iris --- .changeset/lucky-singers-worry.md | 2 +- .../src/stitching/Stitcher.test.ts | 18 ------------------ 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/.changeset/lucky-singers-worry.md b/.changeset/lucky-singers-worry.md index abe581fbc3..4707a57525 100644 --- a/.changeset/lucky-singers-worry.md +++ b/.changeset/lucky-singers-worry.md @@ -2,4 +2,4 @@ '@backstage/plugin-catalog-backend': major --- -Track the last time the final entity changed with new timestamp "last updated at" data in final entities database, which gets updated with the time when final entity is updated. And it's displayed in metadata annotation. +Track the last time the final entity changed with new timestamp "last updated at" data in final entities database, which gets updated with the time when final entity is updated. diff --git a/plugins/catalog-backend/src/stitching/Stitcher.test.ts b/plugins/catalog-backend/src/stitching/Stitcher.test.ts index a13467e9bd..31a8e04392 100644 --- a/plugins/catalog-backend/src/stitching/Stitcher.test.ts +++ b/plugins/catalog-backend/src/stitching/Stitcher.test.ts @@ -17,7 +17,6 @@ import { getVoidLogger } from '@backstage/backend-common'; import { TestDatabases } from '@backstage/backend-test-utils'; import { Entity } from '@backstage/catalog-model'; -import { DateTime } from 'luxon'; import { applyDatabaseMigrations } from '../database/migrations'; import { DbFinalEntitiesRow, @@ -43,7 +42,6 @@ describe('Stitcher', () => { const stitcher = new Stitcher(db, logger); let entities: DbFinalEntitiesRow[]; let entity: Entity; - const timeBeforeStitch = DateTime.now(); await db('refresh_state').insert([ { @@ -114,13 +112,6 @@ describe('Stitcher', () => { expect(entity.metadata.etag).toEqual(entities[0].hash); const last_updated_at = entities[0].last_updated_at; expect(last_updated_at).not.toBeNull(); - const lastUpdatedAt = DateTime.fromMillis( - last_updated_at ? +last_updated_at : 0, - ); - const msAfterStitch = lastUpdatedAt - .diff(timeBeforeStitch, 'milliseconds') - .toObject(); - expect(msAfterStitch.milliseconds).toBeGreaterThan(0); const firstHash = entities[0].hash; const search = await db('search'); @@ -190,7 +181,6 @@ describe('Stitcher', () => { }, ]); - const timeBeforeRestitch = DateTime.now(); await stitcher.stitch(new Set(['k:ns/n'])); entities = await db('final_entities'); @@ -224,14 +214,6 @@ describe('Stitcher', () => { expect(entities[0].hash).not.toEqual(firstHash); expect(entities[0].hash).toEqual(entity.metadata.etag); expect(entity.metadata.etag).toEqual(entities[0].hash); - const last_updated_at_after_restitch = entities[0].last_updated_at; - expect(last_updated_at_after_restitch).not.toBeNull(); - const msAfterRestitch = DateTime.fromMillis( - last_updated_at_after_restitch ? +last_updated_at_after_restitch : 0, - ) - .diff(timeBeforeRestitch, 'milliseconds') - .toObject(); - expect(msAfterRestitch.milliseconds).toBeGreaterThan(0); expect(await db('search')).toEqual( expect.arrayContaining([