mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-22 12:03:25 -04:00
(fix) explicitely set missing morphemes to null for template pronouns (nameself / emojiself)
necessary for requiredMorphemesPresent
This commit is contained in:
parent
ec4aac659a
commit
b6b2a8036d
@ -44,10 +44,8 @@ const buildPronounFromTemplate = (key, template) => {
|
||||
template.description,
|
||||
template.normative || false,
|
||||
buildDict(function*(morphemes) {
|
||||
for (const k in morphemes) {
|
||||
if (morphemes.hasOwnProperty(k)) {
|
||||
yield [k, buildMorphemeFromTemplate(key, morphemes[k])];
|
||||
}
|
||||
for (const m of MORPHEMES) {
|
||||
yield [m, Object.hasOwn(morphemes, m) ? buildMorphemeFromTemplate(key, morphemes[m]) : null];
|
||||
}
|
||||
}, template.morphemes),
|
||||
[template.plural || false],
|
||||
|
@ -130,6 +130,40 @@ describe('when configured that null pronouns are available', () => {
|
||||
expect(buildPronoun(pronouns, `:${name}`, translator).morphemes.possessive_pronoun).toBe(`${name}s`);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when some morphemes are not defined in template', () => {
|
||||
beforeEach(() => {
|
||||
global.config.pronouns.null = {
|
||||
morphemes: {
|
||||
pronoun_subject: '#',
|
||||
pronoun_object: '#',
|
||||
possessive_determiner: '#\'s',
|
||||
possessive_pronoun: '#\'s',
|
||||
},
|
||||
};
|
||||
});
|
||||
test('they become null', () => {
|
||||
const actual = expect(buildPronoun(pronouns, ':S', translator));
|
||||
actual.toBeDefined();
|
||||
actual.toEqual(new Pronoun(
|
||||
'S',
|
||||
'',
|
||||
false,
|
||||
{
|
||||
pronoun_subject: 'S',
|
||||
pronoun_object: 'S',
|
||||
possessive_determiner: 'S\'s',
|
||||
possessive_pronoun: 'S\'s',
|
||||
reflexive: null,
|
||||
},
|
||||
[false],
|
||||
[false],
|
||||
[],
|
||||
'__generator__',
|
||||
false,
|
||||
));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('when configured that slashes contain all morphemes', () => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user