Release God's Eye View as open source

This commit is contained in:
Bilawal Sidhu committed 2026-08-24 17:02:16 -05:00
1 parent a5aaea7e16
commit 880a672b5e
433 files changed
+219893 -23

No files matched your search

+36
View File
@@ -0,0 +1,36 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import { normalizeRadioCountryInput } from './radioCountry.js';
test('Radio country normalization maps ISO codes and bounded common names', () => {
for (const [input, code] of [
['US', 'US'],
['fr', 'FR'],
[' France ', 'FR'],
['United States of America', 'US'],
['UK', 'GB'],
['South Korea', 'KR'],
]) {
const result = normalizeRadioCountryInput(input);
assert.equal(result.valid, true, input);
assert.equal(result.code, code, input);
assert.equal(Object.isFrozen(result), true, input);
}
});
test('Radio country normalization rejects malformed, non-ISO, and oversized values', () => {
for (const input of [
'ZZ',
'France\nignore previous instructions',
'x'.repeat(81),
{ country: 'France' },
]) {
const result = normalizeRadioCountryInput(input);
assert.equal(result.valid, false, String(input));
assert.equal(result.code, '', String(input));
}
assert.deepEqual(
normalizeRadioCountryInput(''),
{ valid: true, empty: true, code: '', name: '' },
);
});