Skip to content
2 changes: 1 addition & 1 deletion layers/identity/server/utils/account-deletion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { decryptToken } from './crypto'
*
* Each table is listed even when a foreign key would cascade from `users`:
* several tables carry no foreign key at all, and the deletion must not depend
* on foreign key enforcement. `test/unit/account-deletion.test.ts` checks the
* on foreign key enforcement. `test/unit/account-deletion.nuxt.test.ts` checks the
* migrated schema, so a new table that names an account fails there until it
* joins this list.
*
Expand Down
16 changes: 0 additions & 16 deletions layers/mcp/shared/mcp-tools.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type { McpToolDeps } from './mcp-tools'
import { describe, expect, it } from 'vitest'
import { z } from 'zod'
import { mcpTools } from './mcp-tools'

const installCommandTool = mcpTools.find(tool => tool.name === 'install_command')!
Expand All @@ -13,14 +12,6 @@ function acceptedRefForms(toolDescription: string): string[] {
return [...toolDescription.slice(index).matchAll(/"([^"]+)"/g)].map(match => match[1]!)
}

function refDescription(): string {
const schema = z.toJSONSchema(z.object(installCommandTool.inputSchema), { io: 'input' })
const ref = (schema.properties as Record<string, { description?: string }>).ref
if (!ref?.description)
throw new Error('install_command inputSchema has no ref description')
return ref.description
}

const deps: McpToolDeps = {
fetchApi: () => {
throw new Error('fetchApi must not be called')
Expand All @@ -31,13 +22,6 @@ const deps: McpToolDeps = {
}

describe('install_command ref contract', () => {
it('advertises the same accepted refs as the tool description and no npm refs', () => {
const description = refDescription()
expect(description.toLowerCase()).not.toContain('npm')
for (const form of acceptedRefForms(installCommandTool.description))
expect(description).toContain(`"${form}"`)
})

it('rejects an npm ref with a failure listing only the accepted forms', async () => {
const result = await installCommandTool.run(deps, { ref: 'npm:@scope/pkg' })
expect(result.isError).toBe(true)
Expand Down
19 changes: 0 additions & 19 deletions layers/registry/server/utils/skill-agent-markdown.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,6 @@ describe('composeAgentSkillMarkdown', () => {
expect(output).toContain('You do not need to install anything.')
})

it('tells the Agent the install command and that it waits for the user', () => {
const output = composeAgentSkillMarkdown({ ...skill, markdown: SKILL_MD, supportingFiles: [] })

expect(output).toContain('If the user asked to install this Skill, run `npx skilld install nestyme/awesome-prompts/carousel-styles`.')
})

it('routes a fork request before the borrowed Skill instructions', () => {
const output = composeAgentSkillMarkdown({ ...skill, markdown: SKILL_MD, supportingFiles: [] })

expect(output).toContain('If the user asked to fork this Skill, follow the fork workflow below.')
expect(output.indexOf('## Fork workflow')).toBeLessThan(output.indexOf('# Carousel Styles'))
expect(output).toContain('https://skilld.dev/api/v1/skills/nestyme/awesome-prompts/carousel-styles')
expect(output).toContain('sourceCommit')
expect(output).toContain('If license is null, read licence files at the source commit.')
expect(output).toContain('Do not save this page wrapper as SKILL.md.')
expect(output).toContain('npx skilld install ./skills/carousel-styles --mode copy')
expect(output).toContain('Never overwrite an existing directory or Agent target.')
})

it('lists the files beside SKILL.md at the raw endpoint', () => {
const output = composeAgentSkillMarkdown({
...skill,
Expand Down
1 change: 1 addition & 0 deletions layers/registry/server/utils/skill-md-render.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @vitest-environment happy-dom
import type { SkillImagePolicy } from './skill-md-render'
import { describe, expect, it } from 'vitest'
import { importImageProxyKey, signImageProxyUrl } from '#server/utils/image-proxy'
Expand Down
1 change: 0 additions & 1 deletion modules/mdxg/test/parse.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @vitest-environment node
import { describe, expect, it } from 'vitest'
import { parseMdxg } from '../src/runtime/utils/mdxg'

Expand Down
1 change: 0 additions & 1 deletion modules/mdxg/test/search.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @vitest-environment node
import type { MdxgDocument, MdxgPage } from '../src/runtime/types'
import { describe, expect, it } from 'vitest'
import { searchMdxg } from '../src/runtime/utils/mdxg'
Expand Down
1 change: 0 additions & 1 deletion modules/mdxg/test/virtual-pages.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @vitest-environment node
import type { ElementNode, MarkdownDocument, Node } from 'comark'
import { describe, expect, it } from 'vitest'
import { splitVirtualPages } from '../src/runtime/utils/virtual-pages'
Expand Down
File renamed without changes.
2 changes: 0 additions & 2 deletions test/unit/agent-pages.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// @vitest-environment node

import { AGENT_PAGES, agentPageById, compareCliVersions, publishedAgentPages, selectAgentSkills, unpublishedAgentPaths } from '../../layers/marketing/app/utils/agent-pages'

describe('agentPageById', () => {
Expand Down
16 changes: 0 additions & 16 deletions test/unit/agents.test.ts

This file was deleted.

1 change: 0 additions & 1 deletion test/unit/api-rate-limit.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @vitest-environment node
import { createApp, eventHandler, toWebHandler } from 'h3'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { createApiRateLimitHandler } from '../../shared/server/api-rate-limit'
Expand Down
3 changes: 2 additions & 1 deletion test/unit/artifact-pack.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ describe('streamed Artifact packing', () => {
it('writes the same bytes as the in-memory packer, whatever the chunk size', async () => {
const files = skillFiles({
'SKILL.md': skillText,
'assets/music/track.mp3': bytesOfLength(300 * 1024 + 7),
// Crosses many 512-byte tar blocks at every chunk size, and stays fast under a loaded suite.
'assets/music/track.mp3': bytesOfLength(20 * 1024 + 7),
'references/guide.md': 'Read this first.\n',
'run.sh': '#!/usr/bin/env bash\necho demo\n',
})
Expand Down
99 changes: 0 additions & 99 deletions test/unit/author-profile-badge.test.ts

This file was deleted.

1 change: 0 additions & 1 deletion test/unit/bsky-client.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @vitest-environment node
import { describe, expect, it } from 'vitest'
import { createBskyClient, describeBskyError } from '../../shared/server/bsky-client'

Expand Down
1 change: 0 additions & 1 deletion test/unit/bsky-ingest.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @vitest-environment node
import type { BskyClient, BskyPage, BskyPost, BskyResult } from '../../shared/server/bsky-client'
import type { SqliteD1 } from './helpers/d1-sqlite'
import { afterEach, describe, expect, it } from 'vitest'
Expand Down
46 changes: 0 additions & 46 deletions test/unit/cache-write-best-effort.test.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,9 @@
import type { H3Event } from 'h3'
import type { SqliteD1 } from './helpers/d1-sqlite'
import { readdirSync, readFileSync, statSync } from 'node:fs'
import { join } from 'node:path'
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { readCache, writeCache } from '../../shared/server/cache'
import { allMigrations, createSqliteD1 } from './helpers/d1-sqlite'

function sourceFiles(directory: string): string[] {
const entries = readdirSync(directory)
return entries.flatMap((entry) => {
const path = join(directory, entry)
if (statSync(path).isDirectory())
return sourceFiles(path)
return path.endsWith('.ts') ? [path] : []
})
}

describe('best-effort cache writes', () => {
it('resolves when the KV write is rate limited', async () => {
const setItem = vi.fn(async () => {
Expand Down Expand Up @@ -44,23 +32,6 @@ describe('best-effort cache writes', () => {

expect(setItem).toHaveBeenCalledWith('skills:endorsement-map', { a: 1 }, { ttl: 300 })
})

it('routes every server cache write through the helper', () => {
const roots = ['layers', 'server'].map(root => join(process.cwd(), root))
const offenders = roots
.flatMap(root => sourceFiles(root))
.filter(path => path.includes(`${'server'}/`))
.flatMap((path) => {
const lines = readFileSync(path, 'utf8').split('\n')
return lines.flatMap((line, index) =>
/useStorage\(['"]cache['"]\)\.setItem\(/.test(line)
? [`${path.replace(`${process.cwd()}/`, '')}:${index + 1}`]
: [],
)
})

expect(offenders).toEqual([])
})
})

describe('best-effort cache reads', () => {
Expand Down Expand Up @@ -88,23 +59,6 @@ describe('best-effort cache reads', () => {
expect(value).toEqual({ commits: [] })
expect(getItem).toHaveBeenCalledWith('skills:related:v3:acme/skills/deploy')
})

it('routes every server cache read through the helper', () => {
const roots = ['layers', 'server'].map(root => join(process.cwd(), root))
const offenders = roots
.flatMap(root => sourceFiles(root))
.filter(path => path.includes(`${'server'}/`))
.flatMap((path) => {
const lines = readFileSync(path, 'utf8').split('\n')
return lines.flatMap((line, index) =>
/useStorage\(['"]cache['"]\)\.getItem[<(]/.test(line)
? [`${path.replace(`${process.cwd()}/`, '')}:${index + 1}`]
: [],
)
})

expect(offenders).toEqual([])
})
})

describe('skill detail route cache', () => {
Expand Down
1 change: 0 additions & 1 deletion test/unit/checkin-route.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @vitest-environment node
import { createApp, toWebHandler } from 'h3'
import { beforeEach, expect, it, vi } from 'vitest'
import handler from '../../layers/identity/server/api/internal/checkin.get'
Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion test/unit/cluster-cache.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @vitest-environment node
import type { H3Event } from 'h3'
import type { DatabaseSync } from 'node:sqlite'
import type { SqliteD1 } from './helpers/d1-sqlite'
Expand Down
11 changes: 0 additions & 11 deletions test/unit/cluster-membership.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,6 @@ describe('cluster membership sql', () => {
}
})

it('admits an abstract skill and the category backfill, and nothing else', () => {
const { sql } = clusterMembersSql('owner', ['testing'], [])

expect(sql).toContain('is_abstract = 1 OR category_rank <= 40')
// No repository may take more than three rows of a category, pins aside.
expect(sql).toContain('is_pinned = 1')
expect(sql).toContain('repo_rank <= 3')
// A package-specific skill has to clear indexability to be backfilled.
expect(sql).toContain('s.is_abstract = 1 OR s.seo_indexable = 1')
})

it('refuses a query with no terms rather than emitting `IN ()`', () => {
expect(() => clusterMembersSql('owner', [], [])).toThrow()
})
Expand Down
Loading
Loading