Add interactive SSH portfolio features

This commit is contained in:
2026-07-27 11:08:12 +09:00
parent eac572dcaf
commit 604080749b
32 changed files with 1356 additions and 31 deletions
+15
View File
@@ -0,0 +1,15 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { safeName, validatePost } from '../src/content-policy.js';
test('bulletin posts normalize whitespace and reject terminal controls', () => {
assert.deepEqual(validatePost(' hello world '), { ok: true, value: 'hello world' });
assert.match(validatePost('hello\u001b[2J').reason, /unsupported/);
});
test('bulletin posts reject emoji and excessive length', () => {
assert.match(validatePost('hello 😀').reason, /Emoji/);
assert.match(validatePost('x'.repeat(181)).reason, /limited/);
});
test('names are reduced to safe display characters', () => assert.equal(safeName('\u001b[31m bob!!'), '31mbob'));