wishforge-ide/apps/ide/policy/test/drafts.test.cjs
eust-w 0ef99b1e6d style: add Prettier and EditorConfig, format the codebase
Adds prettier 3.9.8 (exact) with a shared config (single quotes,
120 columns, trailing commas), .prettierignore, .editorconfig and the
`format` / `format:check` scripts, then formats all TypeScript,
JavaScript, CSS, JSON and YAML sources.

Purely mechanical: no behaviour change. Typecheck passes, the vitest
suite and the 74 IDE node tests produce the same results as before
(socket-binding tests still cannot run inside this sandbox).
Previously the longest source line was ~3000 characters; reviewing the
following semantic changes now produces readable diffs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 13:32:43 +08:00

13 lines
537 B
JavaScript

const test = require('node:test');
const assert = require('node:assert/strict');
const { DraftStore } = require('../drafts.cjs');
test('draft quota rejects oversized ASCII and multibyte content before touching IndexedDB', () => {
const store = new DraftStore({
open() {
throw new Error('storage should not be opened');
},
});
assert.throws(() => store.put({ text: 'a'.repeat(2 * 1024 * 1024 + 1), baseText: '' }), /2 MiB/);
assert.throws(() => store.put({ text: '中'.repeat(800000), baseText: '' }), /2 MiB/);
});