fix(character-dictionary): add surname honorifics for Japanese localized aliases (#87)

This commit is contained in:
2026-05-25 20:12:27 -07:00
committed by GitHub
parent 78be72e32f
commit 639e331f24
5 changed files with 68 additions and 2 deletions
@@ -0,0 +1,38 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import { buildNameTerms } from './term-building';
import type { CharacterRecord } from './types';
function characterRecord(overrides: Partial<CharacterRecord>): CharacterRecord {
return {
id: 136073,
role: 'primary',
firstNameHint: 'Chi-Yul',
fullName: 'Chi-Yul Song',
lastNameHint: 'Song',
nativeName: '송치율',
alternativeNames: [],
bloodType: '',
birthday: null,
description: '',
imageUrl: null,
age: '',
sex: '',
voiceActors: [],
...overrides,
};
}
test('buildNameTerms adds surname honorifics from Japanese localized aliases', () => {
const terms = buildNameTerms(
characterRecord({
alternativeNames: ['Isao Mabuchi (馬渕勲)', 'Chi-Yeol (송치열)'],
}),
);
assert.ok(terms.includes('馬渕勲'));
assert.ok(terms.includes('馬渕勲さん'));
assert.ok(terms.includes('馬渕'));
assert.ok(terms.includes('馬渕さん'));
assert.ok(!terms.includes('송치'));
});