mirror of
https://gitlab.com/PronounsPage/PronounsPage.git
synced 2025-09-23 04:34:15 -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.description,
|
||||||
template.normative || false,
|
template.normative || false,
|
||||||
buildDict(function*(morphemes) {
|
buildDict(function*(morphemes) {
|
||||||
for (const k in morphemes) {
|
for (const m of MORPHEMES) {
|
||||||
if (morphemes.hasOwnProperty(k)) {
|
yield [m, Object.hasOwn(morphemes, m) ? buildMorphemeFromTemplate(key, morphemes[m]) : null];
|
||||||
yield [k, buildMorphemeFromTemplate(key, morphemes[k])];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}, template.morphemes),
|
}, template.morphemes),
|
||||||
[template.plural || false],
|
[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`);
|
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', () => {
|
describe('when configured that slashes contain all morphemes', () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user