Skip to content

Commit

Permalink
Fix pluralisation tests
Browse files Browse the repository at this point in the history
  • Loading branch information
msfstef authored May 10, 2021
1 parent 83693a3 commit e707dee
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions test/lib/translate.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,26 +30,26 @@ describe('translate', () => {
});

it('should pluralise for none/one/many pluralisation keys', () => {
expect(translate('foo.bar', undefined, { foo: { none: 'none', one: 'one', many: 'many' } }, undefined, 0)).to.equal('none');
expect(translate('foo.bar', undefined, { foo: { none: 'none', one: 'one', many: 'many' } }, undefined, 1)).to.equal('one');
expect(translate('foo.bar', undefined, { foo: { none: 'none', one: 'one', many: 'many' } }, undefined, 2)).to.equal('many');
expect(translate('foo.bar', undefined, { foo: { none: 'none', one: 'one', many: 'many' } }, undefined, 100)).to.equal('many');
expect(translate('foo.bar', undefined, { foo: { bar: { none: 'none', one: 'one', many: 'many' } } }, undefined, 0)).to.equal('none');
expect(translate('foo.bar', undefined, { foo: { bar: { none: 'none', one: 'one', many: 'many' } } }, undefined, 1)).to.equal('one');
expect(translate('foo.bar', undefined, { foo: { bar: { none: 'none', one: 'one', many: 'many' } } }, undefined, 2)).to.equal('many');
expect(translate('foo.bar', undefined, { foo: { bar: { none: 'none', one: 'one', many: 'many' } } }, undefined, 100)).to.equal('many');
});

it('should pluralise for zero/one/other pluralisation keys', () => {
expect(translate('foo.bar', undefined, { foo: { zero: 'zero', one: 'one', other: 'other' } }, undefined, 0)).to.equal('zero');
expect(translate('foo.bar', undefined, { foo: { zero: 'zero', one: 'one', other: 'other' } }, undefined, 1)).to.equal('one');
expect(translate('foo.bar', undefined, { foo: { zero: 'zero', one: 'one', other: 'other' } }, undefined, 2)).to.equal('other');
expect(translate('foo.bar', undefined, { foo: { zero: 'zero', one: 'one', other: 'other' } }, undefined, 100)).to.equal('other');
expect(translate('foo.bar', undefined, { foo: { bar: { zero: 'zero', one: 'one', other: 'other' } } }, undefined, 0)).to.equal('zero');
expect(translate('foo.bar', undefined, { foo: { bar: { zero: 'zero', one: 'one', other: 'other' } } }, undefined, 1)).to.equal('one');
expect(translate('foo.bar', undefined, { foo: { bar: { zero: 'zero', one: 'one', other: 'other' } } }, undefined, 2)).to.equal('other');
expect(translate('foo.bar', undefined, { foo: { bar: { zero: 'zero', one: 'one', other: 'other' } } }, undefined, 100)).to.equal('other');
});

it('should pluralise for singular/plural pluralisation keys', () => {
// assume 0 is a plural form if using the singular/plural pluralisation convention
expect(translate('foo.bar', undefined, { foo: { singular: 'singular', plural: 'plural' } }, undefined, 0)).to.equal('plural');
expect(translate('foo.bar', undefined, { foo: { bar: { singular: 'singular', plural: 'plural' } } }, undefined, 0)).to.equal('plural');

expect(translate('foo.bar', undefined, { foo: { singular: 'singular', plural: 'plural' } }, undefined, 1)).to.equal('singular');
expect(translate('foo.bar', undefined, { foo: { singular: 'singular', plural: 'plural' } }, undefined, 2)).to.equal('plural');
expect(translate('foo.bar', undefined, { foo: { singular: 'singular', plural: 'plural' } }, undefined, 100)).to.equal('plural');
expect(translate('foo.bar', undefined, { foo: { bar: { singular: 'singular', plural: 'plural' } } }, undefined, 1)).to.equal('singular');
expect(translate('foo.bar', undefined, { foo: { bar: { singular: 'singular', plural: 'plural' } } }, undefined, 2)).to.equal('plural');
expect(translate('foo.bar', undefined, { foo: { bar: { singular: 'singular', plural: 'plural' } } }, undefined, 100)).to.equal('plural');
});


Expand Down

0 comments on commit e707dee

Please sign in to comment.