constness

This commit is contained in:
Girish Ramakrishnan
2022-04-14 17:41:41 -05:00
parent 05d7a7f496
commit 01ce251596
5 changed files with 87 additions and 87 deletions

View File

@@ -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');