API-v4 route added: 'api/v4/faq' fixes #11801 (#11905)

* feat(api-v4): new /faq route added

* refactor(server): change of function name in libs/content.js
This commit is contained in:
Denys Dorokhov
2020-04-14 23:14:53 +03:00
committed by GitHub
parent 551abf292c
commit 186b929e59
8 changed files with 181 additions and 10 deletions

View File

@@ -8,9 +8,9 @@ describe('contentLib', () => {
});
});
describe('getLocalizedContent', () => {
describe('getLocalizedContentResponse', () => {
it('clones, not modify, the original content data', () => {
contentLib.getLocalizedContent();
contentLib.getLocalizedContentResponse();
expect(typeof content.backgrounds.backgrounds062014.beach.text).to.equal('function');
});
});

View File

@@ -0,0 +1,22 @@
import faq from '../../../../website/common/script/content/faq';
import common from '../../../../website/common';
import { localizeContentData } from '../../../../website/server/libs/content';
const { i18n } = common;
describe('localizeContentData', () => {
it('Should take a an object with localization identifiers and '
+ 'return an object with actual translations in English', () => {
const faqInEnglish = localizeContentData(faq, 'en');
expect(faqInEnglish).to.have.property('stillNeedHelp');
expect(faqInEnglish.stillNeedHelp.ios).to.equal(i18n.t('iosFaqStillNeedHelp', 'en'));
});
it('Should take an object with localization identifiers and '
+ 'return an object with actual translations in German', () => {
const faqInEnglish = localizeContentData(faq, 'de');
expect(faqInEnglish).to.have.property('stillNeedHelp');
expect(faqInEnglish.stillNeedHelp.ios).to.equal(i18n.t('iosFaqStillNeedHelp', 'de'));
});
});