From 0c1f09ef44271a9a7b6f78c8d0b64804bce99456 Mon Sep 17 00:00:00 2001 From: Alex | Kronox Date: Sun, 1 Dec 2024 10:50:15 +0100 Subject: [PATCH] fix unit tests --- .../tests/unit/model/factories/OverviewFactory.test.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/report-viewer/tests/unit/model/factories/OverviewFactory.test.ts b/report-viewer/tests/unit/model/factories/OverviewFactory.test.ts index d5f9fb21d..5f597df7c 100644 --- a/report-viewer/tests/unit/model/factories/OverviewFactory.test.ts +++ b/report-viewer/tests/unit/model/factories/OverviewFactory.test.ts @@ -7,6 +7,7 @@ import validNew from './ValidOverview.json' import outdated from './OutdatedOverview.json' import { setActivePinia, createPinia } from 'pinia' import { store } from '@/stores/store' +import { Version } from '@/model/Version' describe('Test JSON to Overview', () => { beforeAll(() => { @@ -21,7 +22,10 @@ describe('Test JSON to Overview', () => { it('Post 5.0', async () => { store().state.files['overview.json'] = JSON.stringify(validNew) - expect(await OverviewFactory.getOverview()).toEqual({ + const result = await OverviewFactory.getOverview() + expect(result.result).toBe('success') + + expect(result.overview).toEqual({ _submissionFolderPath: ['files'], _baseCodeFolderPath: '', _language: ParserLanguage.JAVA, @@ -126,6 +130,8 @@ describe('Test JSON to Overview', () => { describe('Outdated JSON to Overview', () => { it('Outdated version', async () => { store().state.files['overview.json'] = JSON.stringify(outdated) - expect(() => OverviewFactory.getOverview()).rejects.toThrowError() + const result = await OverviewFactory.getOverview() + expect(result.result).toBe('oldReport') + expect(result.version.compareTo(new Version(3,0,0))).toBe(0) }) })