Files
pbakaus_impeccable/tests/server/download-validation.test.js
T
Paul BakausandClaude Opus 4.6 f683f413c8 Rename frontend-design to impeccable, fold teach-impeccable into teach mode
Major skill consolidation for v2.0:

- Rename source/skills/frontend-design/ to source/skills/impeccable/
  with user-invocable: true and argument-hint: "[teach]"
- Fold teach-impeccable body into impeccable as "Teach Mode" section,
  activated via /impeccable teach
- Create deprecation shims:
  - frontend-design: redirects to /impeccable
  - teach-impeccable: redirects to /impeccable teach
- Update all 16 skill cross-references from {{command_prefix}}frontend-design
  to {{command_prefix}}impeccable and {{command_prefix}}teach-impeccable to
  {{command_prefix}}impeccable teach
- Update CLI sentinel detection to use 'impeccable' (with teach-impeccable
  as legacy fallback)
- Update build system readPatterns() path and EXCLUDED_FROM_SUGGESTIONS
- Update all public files (data.js, cheatsheet, index, viz, demos)
- Update all documentation (README, NOTICE, AGENTS, plugin.json)
- Update all test expectations

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 14:04:54 -07:00

47 lines
1.8 KiB
JavaScript

import { describe, expect, test } from 'bun:test';
import path from 'path';
import {
ALLOWED_BUNDLE_PROVIDERS,
ALLOWED_FILE_PROVIDERS,
isAllowedBundleProvider,
isAllowedFileProvider,
isAllowedProvider,
} from '../../server/lib/validation.js';
import { getFilePath, handleFileDownload } from '../../server/lib/api-handlers.js';
describe('download provider validation', () => {
test('allows opencode and pi as individual download providers', () => {
expect(ALLOWED_FILE_PROVIDERS).toContain('opencode');
expect(ALLOWED_FILE_PROVIDERS).toContain('pi');
expect(isAllowedFileProvider('opencode')).toBe(true);
expect(isAllowedFileProvider('pi')).toBe(true);
});
test('separates file downloads from bundle downloads', () => {
expect(ALLOWED_BUNDLE_PROVIDERS).toContain('universal');
expect(ALLOWED_BUNDLE_PROVIDERS).toContain('universal-prefixed');
expect(isAllowedBundleProvider('universal')).toBe(true);
expect(isAllowedProvider('universal')).toBe(true);
expect(isAllowedFileProvider('universal')).toBe(false);
});
});
describe('download file paths', () => {
test('maps opencode skills into the .opencode config directory', () => {
expect(getFilePath('skill', 'opencode', 'impeccable')).toBe(
path.join(process.cwd(), 'dist', 'opencode', '.opencode', 'skills', 'impeccable', 'SKILL.md')
);
});
test('maps pi commands into the .pi config directory', () => {
expect(getFilePath('command', 'pi', 'audit')).toBe(
path.join(process.cwd(), 'dist', 'pi', '.pi', 'skills', 'audit', 'SKILL.md')
);
});
test('rejects bundle-only providers on the individual download route', async () => {
const response = await handleFileDownload('skill', 'universal', 'impeccable');
expect(response.status).toBe(400);
});
});