test: align board-channels and wiki-sync mocks with current source
board-channels: source renamed getSlackServiceNoVetting → getSlackAdminService. wiki-sync: syncWikiArticles now also calls fetchCollections; URLs starting with / are normalized to https://wiki.ghostguild.org.
This commit is contained in:
parent
e96d493024
commit
5fb2f18cab
2 changed files with 19 additions and 18 deletions
|
|
@ -1,6 +1,14 @@
|
|||
import { describe, it, expect, vi, beforeEach } from 'vitest'
|
||||
import { setResponseStatus } from 'h3'
|
||||
|
||||
import { requireAuth, requireAdmin } from '../../../server/utils/auth.js'
|
||||
import { validateBody } from '../../../server/utils/validateBody.js'
|
||||
import getHandler from '../../../server/api/board/channels.get.js'
|
||||
import postHandler from '../../../server/api/admin/board-channels.post.js'
|
||||
import patchHandler from '../../../server/api/admin/board-channels/[id].patch.js'
|
||||
import deleteHandler from '../../../server/api/admin/board-channels/[id].delete.js'
|
||||
import { createMockEvent } from '../helpers/createMockEvent.js'
|
||||
|
||||
vi.stubGlobal('setResponseStatus', setResponseStatus)
|
||||
|
||||
const { mockFind, mockFindOne, mockCreate, mockFindByIdAndUpdate, mockFindByIdAndDelete } = vi.hoisted(() => ({
|
||||
|
|
@ -44,19 +52,11 @@ const { mockCreateSlackChannel } = vi.hoisted(() => ({
|
|||
}))
|
||||
|
||||
vi.mock('../../../server/utils/slack.ts', () => ({
|
||||
getSlackServiceNoVetting: () => ({
|
||||
getSlackAdminService: () => ({
|
||||
createChannel: mockCreateSlackChannel,
|
||||
}),
|
||||
}))
|
||||
|
||||
import { requireAuth, requireAdmin } from '../../../server/utils/auth.js'
|
||||
import { validateBody } from '../../../server/utils/validateBody.js'
|
||||
import getHandler from '../../../server/api/board/channels.get.js'
|
||||
import postHandler from '../../../server/api/admin/board-channels.post.js'
|
||||
import patchHandler from '../../../server/api/admin/board-channels/[id].patch.js'
|
||||
import deleteHandler from '../../../server/api/admin/board-channels/[id].delete.js'
|
||||
import { createMockEvent } from '../helpers/createMockEvent.js'
|
||||
|
||||
describe('GET /api/board/channels', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue