mirror of
https://github.com/gotson/komga.git
synced 2026-05-08 04:22:28 +02:00
tests
This commit is contained in:
parent
20e75b8987
commit
7576df903c
1 changed files with 5 additions and 8 deletions
|
|
@ -2,8 +2,8 @@ import { afterAll, afterEach, beforeAll, beforeEach, expect, test } from 'vitest
|
|||
import { server } from '@/mocks/api/node'
|
||||
import { useActuatorInfo } from '@/colada/queries/actuator-info'
|
||||
import { createMockColada } from '@/mocks/pinia-colada'
|
||||
import { http, HttpResponse } from 'msw'
|
||||
import { baseUrl } from '@/mocks/api/handlers/base'
|
||||
import { http } from 'msw'
|
||||
import { baseUrl, response401Unauthorized } from '@/mocks/api/handlers/base'
|
||||
import { VueWrapper } from '@vue/test-utils'
|
||||
|
||||
let mock: VueWrapper
|
||||
|
|
@ -26,15 +26,12 @@ test('when getting actuator-info then values are correct', async () => {
|
|||
})
|
||||
|
||||
test('when failing to get actuator-info then values are undefined', async () => {
|
||||
server.use(
|
||||
http.get(baseUrl + 'actuator/info', () => {
|
||||
return HttpResponse.json({ error: 'Unauthorized' }, { status: 401 })
|
||||
}),
|
||||
)
|
||||
server.use(http.get(baseUrl + 'actuator/info', response401Unauthorized))
|
||||
|
||||
const { buildVersion, commitId, refresh } = useActuatorInfo()
|
||||
const { buildVersion, commitId, refresh, error } = useActuatorInfo()
|
||||
|
||||
await refresh()
|
||||
expect(buildVersion.value).toBeUndefined()
|
||||
expect(commitId.value).toBeUndefined()
|
||||
expect(error.value).not.toBeUndefined()
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue