d25d482dc2
Publish CLI Package / publish-npm (push) Waiting to run
Publish Python SDK / publish-pypi (push) Waiting to run
Publish TypeScript SDK / publish-npm (push) Waiting to run
CI / Migrate Dev DB (push) Has been skipped
CI / Detect Version (push) Has been cancelled
CI / Migrate DB (push) Has been cancelled
CI / Build Dev ECR (./docker/app.Dockerfile, ECR_APP) (push) Has been cancelled
CI / Build Dev ECR (./docker/db.Dockerfile, ECR_MIGRATIONS) (push) Has been cancelled
CI / Build Dev ECR (./docker/pii.Dockerfile, ECR_PII) (push) Has been cancelled
CI / Build Dev ECR (./docker/realtime.Dockerfile, ECR_REALTIME) (push) Has been cancelled
CI / Deploy Trigger.dev (Dev) (push) Has been cancelled
CI / Build AMD64 (./docker/app.Dockerfile, ECR_APP, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build AMD64 (./docker/db.Dockerfile, ECR_MIGRATIONS, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build AMD64 (./docker/pii.Dockerfile, ECR_PII, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build AMD64 (./docker/realtime.Dockerfile, ECR_REALTIME, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/app.Dockerfile, ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/db.Dockerfile, ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/pii.Dockerfile, ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Build ARM64 (GHCR Only) (./docker/realtime.Dockerfile, ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/migrations) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/pii) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/realtime) (push) Has been cancelled
CI / Create GHCR Manifests (ghcr.io/simstudioai/simstudio) (push) Has been cancelled
CI / Check Docs Changes (push) Has been cancelled
CI / Process Docs (push) Has been cancelled
CI / Create GitHub Release (push) Has been cancelled
CI / Test and Build (push) Has been cancelled
52 lines
1.8 KiB
TypeScript
52 lines
1.8 KiB
TypeScript
/**
|
|
* @vitest-environment node
|
|
*/
|
|
import { beforeEach, describe, expect, it, vi } from 'vitest'
|
|
|
|
const { orderByMock } = vi.hoisted(() => ({ orderByMock: vi.fn() }))
|
|
|
|
vi.mock('@sim/db', () => ({
|
|
db: { select: () => ({ from: () => ({ where: () => ({ orderBy: orderByMock }) }) }) },
|
|
}))
|
|
vi.mock('@sim/db/schema', () => ({
|
|
skill: { workspaceId: 'workspaceId', name: 'name', createdAt: 'createdAt' },
|
|
}))
|
|
vi.mock('@sim/logger', () => ({
|
|
createLogger: () => ({ error: vi.fn(), warn: vi.fn(), info: vi.fn(), debug: vi.fn() }),
|
|
}))
|
|
vi.mock('@sim/utils/id', () => ({ generateShortId: () => 'gen-id' }))
|
|
vi.mock('@/lib/core/utils/request', () => ({ generateRequestId: () => 'req-id' }))
|
|
vi.mock('drizzle-orm', () => ({
|
|
and: vi.fn(() => ({})),
|
|
desc: vi.fn(() => ({})),
|
|
eq: vi.fn(() => ({})),
|
|
ne: vi.fn(() => ({})),
|
|
}))
|
|
|
|
import { listSkills } from './operations'
|
|
|
|
describe('listSkills includeBuiltins', () => {
|
|
beforeEach(() => {
|
|
vi.clearAllMocks()
|
|
})
|
|
|
|
it('prepends builtin template skills by default', async () => {
|
|
orderByMock.mockResolvedValue([])
|
|
const result = await listSkills({ workspaceId: 'ws-1' })
|
|
expect(result.length).toBeGreaterThan(0)
|
|
expect(result.every((s) => s.id.startsWith('builtin-'))).toBe(true)
|
|
})
|
|
|
|
// The mothership skill registry passes includeBuiltins: false so it never sees
|
|
// the code-only template skills (it loads workspace skills via load_user_skill).
|
|
it('excludes builtin template skills when includeBuiltins is false', async () => {
|
|
orderByMock.mockResolvedValue([
|
|
{ id: 'sk-1', name: 'mine', description: 'd', content: 'c', workspaceId: 'ws-1' },
|
|
])
|
|
const result = await listSkills({ workspaceId: 'ws-1', includeBuiltins: false })
|
|
expect(result).toHaveLength(1)
|
|
expect(result[0].id).toBe('sk-1')
|
|
expect(result.some((s) => s.id.startsWith('builtin-'))).toBe(false)
|
|
})
|
|
})
|