2020-03-19 17:07:20 +03:00
|
|
|
const should = require('should');
|
2020-03-30 18:26:47 +03:00
|
|
|
const settingsCache = require('../../../core/server/services/settings/cache');
|
|
|
|
const helpers = require('../../../core/frontend/helpers');
|
2020-04-08 18:56:37 +03:00
|
|
|
const proxy = require('../../../core/frontend/services/proxy');
|
2018-01-09 16:50:57 +03:00
|
|
|
|
|
|
|
describe('{{lang}} helper', function () {
|
|
|
|
beforeEach(function () {
|
2020-06-22 13:27:05 +03:00
|
|
|
settingsCache.set('lang', {value: 'en'});
|
2021-03-05 16:35:31 +03:00
|
|
|
proxy.themeI18n._loadLocale();
|
2018-01-09 16:50:57 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(function () {
|
|
|
|
settingsCache.shutdown();
|
2021-03-05 16:35:31 +03:00
|
|
|
proxy.themeI18n._loadLocale();
|
2018-01-09 16:50:57 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
it('returns correct language tag', function () {
|
2020-04-29 18:44:27 +03:00
|
|
|
let expected = proxy.themeI18n.locale();
|
|
|
|
let rendered = helpers.lang.call();
|
2018-01-09 16:50:57 +03:00
|
|
|
|
|
|
|
should.exist(rendered);
|
|
|
|
rendered.string.should.equal(expected);
|
|
|
|
});
|
|
|
|
});
|