Translate backstage.io/time-saved annotation into minutes saved and apply to create event

Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
This commit is contained in:
Eric Peterson
2024-03-11 15:08:44 +01:00
parent f34a9b178d
commit df99f629b1
9 changed files with 148 additions and 3 deletions
@@ -29,8 +29,9 @@ import {
} from '@backstage/plugin-scaffolder-react';
import { TemplateWizardPage } from './TemplateWizardPage';
import { rootRouteRef } from '../../routes';
import { CatalogApi, catalogApiRef } from '@backstage/plugin-catalog-react';
import { ANNOTATION_EDIT_URL } from '@backstage/catalog-model';
import { CatalogApi } from '@backstage/catalog-client';
import { catalogApiRef } from '@backstage/plugin-catalog-react';
jest.mock('react-router-dom', () => {
return {
@@ -59,6 +60,7 @@ const catalogApiMock: jest.Mocked<CatalogApi> = {
const analyticsMock = new MockAnalyticsApi();
const apis = TestApiRegistry.from(
[scaffolderApiRef, scaffolderApiMock],
[catalogApiRef, catalogApiMock],
[analyticsApiRef, analyticsMock],
[catalogApiRef, catalogApiMock],
);
@@ -70,6 +72,7 @@ const entityRefResponse = {
name: 'test',
annotations: {
[ANNOTATION_EDIT_URL]: 'http://localhost:3000',
'backstage.io/time-saved': 'PT2H',
},
},
spec: {
@@ -138,6 +141,7 @@ describe('TemplateWizardPage', () => {
action: 'create',
subject: 'expected-name',
context: { entityRef: 'template:default/test' },
value: 120,
});
});
describe('scaffolder page context menu', () => {