summaryrefslogtreecommitdiffstats
path: root/lib/output/website/__tests__/i18n.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/output/website/__tests__/i18n.js')
-rw-r--r--lib/output/website/__tests__/i18n.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/lib/output/website/__tests__/i18n.js b/lib/output/website/__tests__/i18n.js
new file mode 100644
index 0000000..fd610fb
--- /dev/null
+++ b/lib/output/website/__tests__/i18n.js
@@ -0,0 +1,38 @@
+var createMockOutput = require('../../__tests__/createMock');
+var prepareI18n = require('../prepareI18n');
+var createTemplateEngine = require('../createTemplateEngine');
+
+var WebsiteGenerator = require('../');
+
+describe('i18n', function() {
+ it('should correctly use english as default language', function() {
+ return createMockOutput(WebsiteGenerator, {
+ 'README.md': 'Hello World'
+ })
+ .then(function(output) {
+ return prepareI18n(output);
+ })
+ .then(function(output) {
+ var engine = createTemplateEngine(output, 'README.md');
+ var t = engine.getFilters().get('t');
+
+ expect(t('SUMMARY_INTRODUCTION')).toEqual('Introduction');
+ });
+ });
+
+ it('should correctly use language from book.json', function() {
+ return createMockOutput(WebsiteGenerator, {
+ 'README.md': 'Hello World',
+ 'book.json': JSON.stringify({ language: 'fr' })
+ })
+ .then(function(output) {
+ return prepareI18n(output);
+ })
+ .then(function(output) {
+ var engine = createTemplateEngine(output, 'README.md');
+ var t = engine.getFilters().get('t');
+
+ expect(t('GITBOOK_LINK')).toEqual('PubliƩ avec GitBook');
+ });
+ });
+});