From 91dd47a6a182641d880b265244f8f2e2114a87a1 Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Fri, 12 Aug 2022 16:09:17 +0200 Subject: [PATCH] chore: update backend tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Patrik Oldsberg Co-authored-by: Fredrik Adelöw Signed-off-by: Johan Haals --- .../src/next/wiring/TestBackend.test.ts | 29 ++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/packages/backend-test-utils/src/next/wiring/TestBackend.test.ts b/packages/backend-test-utils/src/next/wiring/TestBackend.test.ts index 6b3f8e270f..488a258388 100644 --- a/packages/backend-test-utils/src/next/wiring/TestBackend.test.ts +++ b/packages/backend-test-utils/src/next/wiring/TestBackend.test.ts @@ -16,16 +16,25 @@ import { createBackendModule, + createExtensionPoint, createServiceFactory, createServiceRef, } from '@backstage/backend-plugin-api'; import { startTestBackend } from './TestBackend'; describe('TestBackend', () => { - it('should get a type error if service implementation does not match', () => { - const serviceRef = createServiceRef<{ a: string; b: string }>({ id: 'a' }); - const backend = startTestBackend({ + it('should get a type error if service implementation does not match', async () => { + type Obj = { a: string; b: string }; + const serviceRef = createServiceRef({ id: 'a' }); + const extensionPoint1 = createExtensionPoint({ id: 'b1' }); + const extensionPoint2 = createExtensionPoint({ id: 'b2' }); + const extensionPoint3 = createExtensionPoint({ id: 'b3' }); + const extensionPoint4 = createExtensionPoint({ id: 'b4' }); + const extensionPoint5 = createExtensionPoint({ id: 'b5' }); + await startTestBackend({ services: [ + // @ts-expect-error + [extensionPoint1, { a: 'a' }], [serviceRef, { a: 'a' }], [serviceRef, { a: 'a', b: 'b' }], // @ts-expect-error @@ -35,8 +44,20 @@ describe('TestBackend', () => { // @ts-expect-error [serviceRef, { a: 'a', b: 'b', c: 'c' }], ], + extensionPoints: [ + // @ts-expect-error + [serviceRef, { a: 'a' }], + [extensionPoint1, { a: 'a' }], + [extensionPoint2, { a: 'a', b: 'b' }], + // @ts-expect-error + [extensionPoint3, { c: 'c' }], + // @ts-expect-error + [extensionPoint4, { a: 'a', c: 'c' }], + // @ts-expect-error + [extensionPoint5, { a: 'a', b: 'b', c: 'c' }], + ], }); - expect(backend).toBeDefined(); + expect(1).toBe(1); }); it('should start the test backend', async () => {