39 lines
1.9 KiB
TypeScript
39 lines
1.9 KiB
TypeScript
import assert from 'node:assert/strict';
|
|
import test from 'node:test';
|
|
import { assertPublicDomainDirectory, getPublicDomainVestibule, publicDomainDirectory, type PublicDomainVestibule } from './public-domain-directory.js';
|
|
|
|
test('the public vestibule directory fixes the five official names and order', () => {
|
|
assert.deepEqual(publicDomainDirectory.map(item => [item.directoryNumber, item.displayName]), [
|
|
['01', '光湖主域'],
|
|
['02', '光湖分域'],
|
|
['03', '光湖零域'],
|
|
['04', '光湖零感域'],
|
|
['05', '第五域 · 光湖本源域'],
|
|
]);
|
|
});
|
|
|
|
test('the first four domain themes remain owned and unpublished by their own teams', () => {
|
|
for (const item of publicDomainDirectory.slice(0, 4)) {
|
|
assert.equal(item.themeOwner, 'domain-team');
|
|
assert.equal(item.themeStatus, 'UNPUBLISHED');
|
|
assert.match(item.themeLabel, /对应|光湖/);
|
|
}
|
|
const fifth = getPublicDomainVestibule('fifth');
|
|
assert.equal(fifth.themeOwner, 'fifth-domain');
|
|
assert.equal(fifth.themeStatus, 'SELECTED_REFERENCE');
|
|
assert.match(fifth.themeLabel, /湖面映星/);
|
|
});
|
|
|
|
test('no public vestibule exposes private domain resources', () => {
|
|
assert.ok(publicDomainDirectory.every(item => item.privateResourcesExposed === false));
|
|
});
|
|
|
|
test('validation rejects a misspelled zero domain and shared enterprise theme override', () => {
|
|
const clone = publicDomainDirectory.map(item => ({ ...item })) as PublicDomainVestibule[];
|
|
clone[2] = { ...clone[2], displayName: '光湖灵域' };
|
|
assert.throws(() => assertPublicDomainDirectory(clone), /PUBLIC_DOMAIN_ZERO_NAME_INVALID/);
|
|
|
|
const themed = publicDomainDirectory.map(item => ({ ...item })) as PublicDomainVestibule[];
|
|
themed[0] = { ...themed[0], themeOwner: 'fifth-domain', themeStatus: 'SELECTED_REFERENCE' };
|
|
assert.throws(() => assertPublicDomainDirectory(themed), /ENTERPRISE_DOMAIN_THEME_OWNERSHIP_INVALID/);
|
|
});
|