Add interactive SSH portfolio features
This commit is contained in:
@@ -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'));
|
||||
Reference in New Issue
Block a user