|
@@ -1,4 +1,4 @@
|
|
|
-import { vi, describe, test, it, expect } from 'vitest'
|
|
|
|
|
|
|
+import { vi, describe, test, expect, beforeEach, afterEach } from 'vitest'
|
|
|
import ApiRequestService from '~/services/data/apiRequestService'
|
|
import ApiRequestService from '~/services/data/apiRequestService'
|
|
|
import ImageManager from '~/services/data/imageManager'
|
|
import ImageManager from '~/services/data/imageManager'
|
|
|
import 'blob-polyfill'
|
|
import 'blob-polyfill'
|
|
@@ -80,9 +80,7 @@ describe('get', () => {
|
|
|
expect(apiRequestService.get).toHaveBeenCalledWith('api/download/1', [
|
|
expect(apiRequestService.get).toHaveBeenCalledWith('api/download/1', [
|
|
|
'123456',
|
|
'123456',
|
|
|
])
|
|
])
|
|
|
- expect(console.error).toHaveBeenCalledWith(
|
|
|
|
|
- 'Error: image 1 not found',
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ expect(console.error).toHaveBeenCalledWith('Error: image 1 not found')
|
|
|
// @ts-ignore
|
|
// @ts-ignore
|
|
|
expect(imageManager.toBase64).toHaveBeenCalledTimes(0)
|
|
expect(imageManager.toBase64).toHaveBeenCalledTimes(0)
|
|
|
|
|
|
|
@@ -91,6 +89,8 @@ describe('get', () => {
|
|
|
|
|
|
|
|
test('no response, default image', async () => {
|
|
test('no response, default image', async () => {
|
|
|
const blobPart = vi.fn()
|
|
const blobPart = vi.fn()
|
|
|
|
|
+
|
|
|
|
|
+ // @ts-ignore
|
|
|
blobPart.size = 0
|
|
blobPart.size = 0
|
|
|
|
|
|
|
|
const response = vi.fn()
|
|
const response = vi.fn()
|
|
@@ -114,9 +114,7 @@ describe('get', () => {
|
|
|
expect(apiRequestService.get).toHaveBeenCalledWith('api/download/1', [
|
|
expect(apiRequestService.get).toHaveBeenCalledWith('api/download/1', [
|
|
|
'123456',
|
|
'123456',
|
|
|
])
|
|
])
|
|
|
- expect(console.error).toHaveBeenCalledWith(
|
|
|
|
|
- 'Error: image 1 is invalid',
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ expect(console.error).toHaveBeenCalledWith('Error: image 1 is invalid')
|
|
|
// @ts-ignore
|
|
// @ts-ignore
|
|
|
expect(imageManager.toBase64).toHaveBeenCalledTimes(0)
|
|
expect(imageManager.toBase64).toHaveBeenCalledTimes(0)
|
|
|
|
|
|