Skip to content

Commit

Permalink
fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Kr0nox committed Dec 1, 2024
1 parent 34dcbbe commit 0c1f09e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions report-viewer/tests/unit/model/factories/OverviewFactory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand All @@ -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,
Expand Down Expand Up @@ -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)
})
})

0 comments on commit 0c1f09e

Please sign in to comment.