From d0aec7d68941ee2350bbe93a158ad58c53ec4e92 Mon Sep 17 00:00:00 2001 From: Oliver Sand Date: Mon, 15 Feb 2021 15:32:58 +0100 Subject: [PATCH] Make test run on Windows? Signed-off-by: Oliver Sand oliver.sand@sda-se.com --- .../processors/FileReaderProcessor.test.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/plugins/catalog-backend/src/ingestion/processors/FileReaderProcessor.test.ts b/plugins/catalog-backend/src/ingestion/processors/FileReaderProcessor.test.ts index 8ea165dcb8..3e2c62f7f0 100644 --- a/plugins/catalog-backend/src/ingestion/processors/FileReaderProcessor.test.ts +++ b/plugins/catalog-backend/src/ingestion/processors/FileReaderProcessor.test.ts @@ -20,16 +20,22 @@ import { CatalogProcessorErrorResult, CatalogProcessorResult, } from './types'; +import path from 'path'; describe('FileReaderProcessor', () => { - const fixturesRoot = - 'src/ingestion/processors/__fixtures__/fileReaderProcessor'; + const fixturesRoot = path.join( + 'src', + 'ingestion', + 'processors', + '__fixtures__', + 'fileReaderProcessor', + ); it('should load from file', async () => { const processor = new FileReaderProcessor(); const spec = { type: 'file', - target: `${fixturesRoot}/component.yaml`, + target: `${path.join(fixturesRoot, 'component.yaml')}`, }; const generated = (await new Promise(emit => @@ -45,7 +51,7 @@ describe('FileReaderProcessor', () => { const processor = new FileReaderProcessor(); const spec = { type: 'file', - target: `${fixturesRoot}/missing.yaml`, + target: `${path.join(fixturesRoot, 'missing.yaml')}`, }; const generated = (await new Promise(emit => @@ -56,7 +62,7 @@ describe('FileReaderProcessor', () => { expect(generated.location).toBe(spec); expect(generated.error.name).toBe('NotFoundError'); expect(generated.error.message).toBe( - `file ${fixturesRoot}/missing.yaml does not exist`, + `file ${path.join(fixturesRoot, 'missing.yaml')} does not exist`, ); }); @@ -66,7 +72,7 @@ describe('FileReaderProcessor', () => { const emit = jest.fn(); await processor.readLocation( - { type: 'file', target: `${fixturesRoot}/**/*.yaml` }, + { type: 'file', target: `${path.join(fixturesRoot, '**', '*.yaml')}` }, false, emit, );