From 392e71fa7fbfea1bc652ca28fe72e135dc04c253 Mon Sep 17 00:00:00 2001 From: Dustin Brewer Date: Thu, 9 Mar 2023 23:22:54 +0000 Subject: [PATCH] Correcting Entity in tests Signed-off-by: Dustin Brewer --- plugins/firehydrant/src/components/hooks.test.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/plugins/firehydrant/src/components/hooks.test.ts b/plugins/firehydrant/src/components/hooks.test.ts index 4278911ebb..2fbf1e2d57 100644 --- a/plugins/firehydrant/src/components/hooks.test.ts +++ b/plugins/firehydrant/src/components/hooks.test.ts @@ -19,7 +19,11 @@ import { isFireHydrantAvailable, getFireHydrantServiceName } from './hooks'; describe('firehydrant-hooks-isFireHydrantAvailable', () => { it('should find an annotation', () => { const e: Entity = { + apiVersion: 'backstage.io/v1alpha1', + kind: 'Component', metadata: { + namespace: 'default', + name: 'test-fh-name', annotations: { 'firehydrant.com/service-name': 'test-fh-name', }, @@ -30,7 +34,12 @@ describe('firehydrant-hooks-isFireHydrantAvailable', () => { it('should not find an annotation', () => { const e: Entity = { - metadata: {}, + apiVersion: 'backstage.io/v1alpha1', + kind: 'Component', + metadata: { + namespace: 'default', + name: 'test-fh-name', + }, }; expect(isFireHydrantAvailable(e)).toEqual(false); }); @@ -40,6 +49,7 @@ describe('firehydrant-hooks-getFireHydrantServiceName', () => { it('should return annotation service name', () => { const expected = 'test-fh-name'; const e: Entity = { + apiVersion: 'backstage.io/v1alpha1', kind: 'Component', metadata: { namespace: 'default', @@ -55,6 +65,7 @@ describe('firehydrant-hooks-getFireHydrantServiceName', () => { it('should return generated service name', () => { const expected = 'Component:default/test-fh-name'; const e: Entity = { + apiVersion: 'backstage.io/v1alpha1', kind: 'Component', metadata: { namespace: 'default',