mirror of
https://github.com/EKKOLearnAI/hermes-web-ui.git
synced 2026-05-25 13:30:14 +00:00
89f0127da6
* feat: add read-only plugins page * fix: align plugins page i18n and header
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
|
|
|
const listMock = vi.fn(async (ctx: any) => {
|
|
ctx.body = { plugins: [], warnings: [], metadata: {} }
|
|
})
|
|
|
|
vi.mock('../../packages/server/src/controllers/hermes/plugins', () => ({
|
|
list: listMock,
|
|
}))
|
|
|
|
describe('plugin routes', () => {
|
|
beforeEach(() => {
|
|
vi.resetModules()
|
|
listMock.mockClear()
|
|
})
|
|
|
|
it('registers the plugins inventory route', async () => {
|
|
const { pluginRoutes } = await import('../../packages/server/src/routes/hermes/plugins')
|
|
const paths = pluginRoutes.stack.map((entry: any) => entry.path)
|
|
|
|
expect(paths).toEqual(expect.arrayContaining(['/api/hermes/plugins']))
|
|
})
|
|
|
|
it('delegates plugin listing to the controller', async () => {
|
|
const { pluginRoutes } = await import('../../packages/server/src/routes/hermes/plugins')
|
|
const layer = pluginRoutes.stack.find((entry: any) => entry.path === '/api/hermes/plugins')
|
|
const ctx: any = { body: null, params: {}, query: {} }
|
|
|
|
await layer.stack[0](ctx)
|
|
|
|
expect(listMock).toHaveBeenCalledWith(ctx)
|
|
expect(ctx.body).toEqual({ plugins: [], warnings: [], metadata: {} })
|
|
})
|
|
})
|