Skip to content

Commit

Permalink
Merge 24393e2 into 0252d1c
Browse files Browse the repository at this point in the history
  • Loading branch information
curbengh committed Jul 25, 2019
2 parents 0252d1c + 24393e2 commit cc74406
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions test/index.js
Expand Up @@ -2,7 +2,7 @@

const should = require('chai').should();

describe('i18n', function() {
describe('i18n', () => {
const Ctor = require('../lib/i18n');

const i18n = new Ctor({
Expand Down Expand Up @@ -37,7 +37,7 @@ describe('i18n', function() {
}
});

it('construCtor', function() {
it('construCtor', () => {
let i18n = new Ctor();
i18n.languages.should.eql(['default']);

Expand All @@ -54,7 +54,7 @@ describe('i18n', function() {
i18n.languages.should.eql(['zh-TW', 'en']);
});

it('set()', function() {
it('set()', () => {
const i18n = new Ctor();

i18n.set('en', {
Expand All @@ -76,23 +76,23 @@ describe('i18n', function() {
});
});

it('set() - lang must be a string', function() {
it('set() - lang must be a string', () => {
try {
i18n.set();
} catch (err) {
err.should.have.property('message', 'lang must be a string!');
}
});

it('set() - data is required', function() {
it('set() - data is required', () => {
try {
i18n.set('en');
} catch (err) {
err.should.have.property('message', 'data is required!');
}
});

it('get() - default languages', function() {
it('get() - default languages', () => {
const result = i18n.get();

result.should.eql({
Expand All @@ -106,7 +106,7 @@ describe('i18n', function() {
});
});

it('get() - custom languages', function() {
it('get() - custom languages', () => {
const result = i18n.get('en');

result.should.eql({
Expand All @@ -120,7 +120,7 @@ describe('i18n', function() {
});
});

it('remove()', function() {
it('remove()', () => {
const i18n = new Ctor();

i18n.set('en', {});
Expand All @@ -129,19 +129,19 @@ describe('i18n', function() {
should.not.exist(i18n.data.en);
});

it('remove() - lang must be a string', function() {
it('remove() - lang must be a string', () => {
try {
i18n.remove();
} catch (err) {
err.should.have.property('message', 'lang must be a string!');
}
});

it('list()', function() {
it('list()', () => {
i18n.list().should.have.members(['en', 'zh-TW']);
});

it('__() - default languages', function() {
it('__() - default languages', () => {
const __ = i18n.__();

__().should.eql('');
Expand All @@ -152,7 +152,7 @@ describe('i18n', function() {
__('Hello world').should.eql('Hello world');
});

it('__() - custom languages', function() {
it('__() - custom languages', () => {
const __ = i18n.__('en');

__('add').should.eql('Add');
Expand All @@ -161,7 +161,7 @@ describe('i18n', function() {
__('name', 'John', 'Doe').should.eql('My name is John Doe.');
});

it('_p() - default languages', function() {
it('_p() - default languages', () => {
const _p = i18n._p();

_p().should.eql('');
Expand All @@ -172,7 +172,7 @@ describe('i18n', function() {
_p('Hello world').should.eql('Hello world');
});

it('_p() - custom languages', function() {
it('_p() - custom languages', () => {
const _p = i18n._p('en');

_p('ok').should.eql('OK');
Expand Down

0 comments on commit cc74406

Please sign in to comment.