Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: arrow function #17

Merged
merged 1 commit into from
Jul 25, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 14 additions & 14 deletions test/index.js
Original file line number Diff line number Diff line change
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