Updated the test system
This commit is contained in:
26
test/pluralize.test.js
Normal file
26
test/pluralize.test.js
Normal file
@ -0,0 +1,26 @@
|
||||
const expect = require('expect');
|
||||
const {pluralize} = require('./_30s.js');
|
||||
|
||||
test('pluralize is a Function', () => {
|
||||
expect(pluralize).toBeInstanceOf(Function);
|
||||
});
|
||||
test('Produces the plural of the word', () => {
|
||||
expect(pluralize(0, 'apple')).toBe('apples');
|
||||
});
|
||||
test('Produces the singular of the word', () => {
|
||||
expect(pluralize(1, 'apple')).toBe('apple');
|
||||
});
|
||||
test('Produces the plural of the word', () => {
|
||||
expect(pluralize(2, 'apple')).toBe('apples');
|
||||
});
|
||||
test('Prodices the defined plural of the word', () => {
|
||||
expect(pluralize(2, 'person', 'people')).toBe('people');
|
||||
});
|
||||
const PLURALS = {
|
||||
person: 'people',
|
||||
radius: 'radii'
|
||||
};
|
||||
const autoPluralize = pluralize(PLURALS);
|
||||
test('Works with a dictionary', () => {
|
||||
expect(autoPluralize(2, 'person')).toBe('people');
|
||||
});
|
||||
Reference in New Issue
Block a user