update test case

Signed-off-by: iris <hellocomplex007@gmail.com>
This commit is contained in:
iris
2022-12-12 15:09:48 +08:00
parent 1003f52b19
commit 9af905d5d4
2 changed files with 1 additions and 19 deletions
+1 -1
View File
@@ -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.
@@ -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<DbRefreshStateRow>('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<DbSearchRow>('search');
@@ -190,7 +181,6 @@ describe('Stitcher', () => {
},
]);
const timeBeforeRestitch = DateTime.now();
await stitcher.stitch(new Set(['k:ns/n']));
entities = await db<DbFinalEntitiesRow>('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<DbSearchRow>('search')).toEqual(
expect.arrayContaining([