2020-03-19 14:07:20 +00:00
|
|
|
const should = require('should');
|
2021-10-06 10:52:46 +01:00
|
|
|
const lang = require('../../../../core/frontend/helpers/lang');
|
2018-01-09 14:50:57 +01:00
|
|
|
|
|
|
|
describe('{{lang}} helper', function () {
|
2021-05-04 16:49:35 +01:00
|
|
|
it('returns correct language tag', function () {
|
|
|
|
const locales = [
|
|
|
|
'en',
|
|
|
|
'en-gb',
|
|
|
|
'de'
|
|
|
|
];
|
2018-01-09 14:50:57 +01:00
|
|
|
|
2021-05-04 16:49:35 +01:00
|
|
|
locales.forEach((locale) => {
|
|
|
|
const context = {
|
|
|
|
hash: {},
|
|
|
|
data: {
|
|
|
|
site: {
|
|
|
|
locale
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
2018-01-09 14:50:57 +01:00
|
|
|
|
2021-10-04 16:30:54 +01:00
|
|
|
let rendered = lang.call({}, context);
|
2018-01-09 14:50:57 +01:00
|
|
|
|
2021-05-04 16:49:35 +01:00
|
|
|
should.exist(rendered);
|
|
|
|
rendered.string.should.equal(locale);
|
|
|
|
});
|
2018-01-09 14:50:57 +01:00
|
|
|
});
|
|
|
|
});
|