Skip to content

Commit

Permalink
Add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eartharoid committed Apr 27, 2021
1 parent 1fb5b50 commit dee47e9
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 4 deletions.
19 changes: 16 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"@typescript-eslint/eslint-plugin": "^4.22.0",
"@typescript-eslint/parser": "^4.22.0",
"ava": "^3.15.0",
"eslint": "^7.25.0"
"eslint": "^7.25.0",
"lodash.isequal": "^4.5.0"
}
}
14 changes: 14 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@ const I18n = require('../dist');
const i18n = new I18n('original', locales);

const test = require('ava');
const isEqual = require('lodash.isequal');

test('default_locale', t => {
const expected = 'original';
const actual = i18n.default_locale;
t.is(actual, expected);
});

test('locales', t => {
const expected = ['original', 'translated'];
const actual = i18n.locales;
if (isEqual(actual, expected)) t.pass();
else t.fail();
});

test('getLocale', t => {
let locale = i18n.getLocale();
Expand Down

0 comments on commit dee47e9

Please sign in to comment.