translation.js -> translations.js

kept confusing my why i can't find this file! this is in line
with the rest of our code
This commit is contained in:
Girish Ramakrishnan
2024-07-05 12:45:23 +02:00
parent bf51a60986
commit bcf497b460
8 changed files with 27 additions and 27 deletions

View File

@@ -5,38 +5,38 @@
'use strict';
const expect = require('expect.js'),
translation = require('../translation.js');
translations = require('../translations.js');
describe('translation', function () {
describe('translate', function () {
it('nonexisting token', function () {
const assets = { translations: {}, fallback: {} };
const out = translation.translate('Foo {{ bar }}', assets);
const out = translations.translate('Foo {{ bar }}', assets);
expect(out).to.contain('{{ bar }}');
});
it('existing token', function () {
const assets = { translations: { bar: 'here' }, fallback: {} };
const out = translation.translate('Foo {{ bar }}', assets);
const out = translations.translate('Foo {{ bar }}', assets);
expect(out).to.contain('here');
});
it('existing token as fallback', function () {
const assets = { translations: {}, fallback: { bar: 'here' } };
const out = translation.translate('Foo {{ bar }}', assets);
const out = translations.translate('Foo {{ bar }}', assets);
expect(out).to.contain('here');
});
it('existing token deep', function () {
const assets = { translations: { bar: { baz: { foo: 'here' }}}, fallback: {} };
const out = translation.translate('Foo {{ bar.baz.foo }}', assets);
const out = translations.translate('Foo {{ bar.baz.foo }}', assets);
expect(out).to.contain('here');
});
it('existing token deep as fallback', function () {
const assets = { translations: { bar: '' }, fallback: { bar: { baz: { foo: 'here' } } } };
const out = translation.translate('Foo {{ bar.baz.foo }}', assets);
const out = translations.translate('Foo {{ bar.baz.foo }}', assets);
expect(out).to.contain('here');
});
@@ -57,7 +57,7 @@ describe('translation', function () {
};
const input = 'Hello {{ something.missing.there}} and some more {{here}} and {{ there }} with odd spacing {{foo }} lots of{{ bar }}';
const out = translation.translate(input, assets);
const out = translations.translate(input, assets);
expect(out).to.contain('1');
expect(out).to.contain('2');
expect(out).to.contain('3');