constness
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
/* jslint node:true */
|
||||
/* global it:false */
|
||||
/* global describe:false */
|
||||
/* global before:false */
|
||||
|
||||
'use strict';
|
||||
|
||||
@@ -12,32 +11,32 @@ describe('translation', function () {
|
||||
|
||||
describe('translate', function () {
|
||||
it('nonexisting token', function () {
|
||||
var out = translation.translate('Foo {{ bar }}', {}, {});
|
||||
const out = translation.translate('Foo {{ bar }}', {}, {});
|
||||
expect(out).to.contain('{{ bar }}');
|
||||
});
|
||||
|
||||
it('existing token', function () {
|
||||
var out = translation.translate('Foo {{ bar }}', { bar: 'here' }, {});
|
||||
const out = translation.translate('Foo {{ bar }}', { bar: 'here' }, {});
|
||||
expect(out).to.contain('here');
|
||||
});
|
||||
|
||||
it('existing token as fallback', function () {
|
||||
var out = translation.translate('Foo {{ bar }}', {}, { bar: 'here' });
|
||||
const out = translation.translate('Foo {{ bar }}', {}, { bar: 'here' });
|
||||
expect(out).to.contain('here');
|
||||
});
|
||||
|
||||
it('existing token deep', function () {
|
||||
var out = translation.translate('Foo {{ bar.baz.foo }}', { bar: { baz: { foo: 'here' }}}, {});
|
||||
const out = translation.translate('Foo {{ bar.baz.foo }}', { bar: { baz: { foo: 'here' }}}, {});
|
||||
expect(out).to.contain('here');
|
||||
});
|
||||
|
||||
it('existing token deep as fallback', function () {
|
||||
var out = translation.translate('Foo {{ bar.baz.foo }}', { bar: '' }, { bar: { baz: { foo: 'here' }}});
|
||||
const out = translation.translate('Foo {{ bar.baz.foo }}', { bar: '' }, { bar: { baz: { foo: 'here' }}});
|
||||
expect(out).to.contain('here');
|
||||
});
|
||||
|
||||
it('with whitespace tokens', function () {
|
||||
var obj = {
|
||||
const obj = {
|
||||
something: {
|
||||
missing: {
|
||||
there: '1'
|
||||
@@ -48,9 +47,9 @@ describe('translation', function () {
|
||||
foo: '4',
|
||||
bar: '5'
|
||||
};
|
||||
var input = 'Hello {{ something.missing.there}} and some more {{here}} and {{ there }} with odd spacing {{foo }} lots of{{ bar }}';
|
||||
const input = 'Hello {{ something.missing.there}} and some more {{here}} and {{ there }} with odd spacing {{foo }} lots of{{ bar }}';
|
||||
|
||||
var out = translation.translate(input, obj, {});
|
||||
const out = translation.translate(input, obj, {});
|
||||
expect(out).to.contain('1');
|
||||
expect(out).to.contain('2');
|
||||
expect(out).to.contain('3');
|
||||
|
||||
Reference in New Issue
Block a user