mirror of
https://github.com/nexu-io/open-design.git
synced 2026-10-27 09:51:12 +01:00
* test(web): cover stored-mode ZIP encoder CRC and central directory * test(web): cover design-system audit repair-actions and chat-events dedup * test(web): cover @mention parsing and agent label normalization * test(web): cover error flattener, prompt-template categories, design-system sentinel * fix(web): set ZIP UTF-8 filename flag (bit 11) for non-ASCII names buildZip wrote UTF-8 filename bytes (TextEncoder) but left the general-purpose bit flag at 0 in both the local and central headers, so readers fall back to CP437 and mis-decode non-ASCII names like 日本.md. Set general-purpose bit 11 (0x0800, EFS) in both headers when the filename contains a non-ASCII byte; pure-ASCII archives are unchanged (ASCII == CP437 == UTF-8), matching how Python/Go zip encoders behave. Strengthen the UTF-8 test to assert the flag + filename in BOTH the local and central-directory headers (parsed via EOCD), and add a case asserting pure-ASCII names do not set the flag. Addresses review feedback on #2451.
26 lines
1.0 KiB
TypeScript
26 lines
1.0 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
|
|
import {
|
|
DESIGN_SYSTEM_WORKSPACE_PROMPT_PREFIX,
|
|
isDesignSystemWorkspacePrompt,
|
|
} from '../src/design-system-auto-prompt';
|
|
|
|
describe('isDesignSystemWorkspacePrompt', () => {
|
|
it('detects the sentinel prefix at the very start of the content', () => {
|
|
expect(isDesignSystemWorkspacePrompt(`${DESIGN_SYSTEM_WORKSPACE_PROMPT_PREFIX} Build a teal palette.`)).toBe(true);
|
|
});
|
|
|
|
it('still detects the prefix when the content has leading whitespace or newlines', () => {
|
|
expect(isDesignSystemWorkspacePrompt(`\n ${DESIGN_SYSTEM_WORKSPACE_PROMPT_PREFIX} extra detail`)).toBe(true);
|
|
});
|
|
|
|
it('rejects content that mentions the sentinel mid-string', () => {
|
|
expect(isDesignSystemWorkspacePrompt(`Hello! ${DESIGN_SYSTEM_WORKSPACE_PROMPT_PREFIX}`)).toBe(false);
|
|
});
|
|
|
|
it('rejects empty and unrelated prompts', () => {
|
|
expect(isDesignSystemWorkspacePrompt('')).toBe(false);
|
|
expect(isDesignSystemWorkspacePrompt('Design me a logo.')).toBe(false);
|
|
});
|
|
});
|