18 lines
541 B
TypeScript
18 lines
541 B
TypeScript
import { describe, it } from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { singleWord } from '../src/social.controller.js';
|
|
|
|
describe('singleWord', () => {
|
|
it('strips @ and trims', () => {
|
|
assert.equal(singleWord('@nasa '), 'nasa');
|
|
});
|
|
|
|
it('rejects multi-word input', () => {
|
|
assert.throws(() => singleWord('two words'), /single-word/);
|
|
});
|
|
|
|
it('rejects empty input', () => {
|
|
assert.throws(() => singleWord(''), /single-word/);
|
|
assert.throws(() => singleWord(undefined), /single-word/);
|
|
});
|
|
});
|