test: add note controller case (#939)

This commit is contained in:
2023-01-17 19:10:53 +08:00
committed by GitHub
parent 7adff99a14
commit 02a08ad9f3
31 changed files with 937 additions and 161 deletions

View File

@@ -1,20 +0,0 @@
// @ts-nocheck
import { beforeAll } from 'vitest'
import 'zx/globals'
import consola from 'consola'
beforeAll(async () => {
await import('zx/globals')
global.isDev = true
global.cwd = process.cwd()
global.consola = consola
})
beforeEach(() => {
global.isDev = true
global.cwd = process.cwd()
global.consola = consola
})

View File

@@ -0,0 +1,37 @@
// @ts-nocheck
import { beforeAll } from 'vitest'
import 'zx/globals'
import consola from 'consola'
import { dbHelper } from 'test/helper/db-mock.helper'
import { redisHelper } from 'test/helper/redis-mock.helper'
import { registerJSONGlobal } from '~/global/json.global'
beforeAll(async () => {
await import('zx/globals')
global.isDev = true
global.cwd = process.cwd()
global.consola = consola
registerJSONGlobal()
})
afterAll(async () => {
await dbHelper.clear()
await dbHelper.close()
await (await redisHelper).close()
})
beforeAll(async () => {
await dbHelper.connect()
await redisHelper
})
beforeEach(() => {
global.isDev = true
global.cwd = process.cwd()
global.consola = consola
})