Artur Paikin 9 роки тому
батько
коміт
8d3f4c1be2
2 змінених файлів з 11 додано та 2 видалено
  1. 1 0
      package.json
  2. 10 2
      test/core.spec.js

+ 1 - 0
package.json

@@ -14,6 +14,7 @@
     "server": "browser-sync start --config .browsersync.js",
     "test:phantom": "zuul test/spec/upload.js --phantom",
     "test": "bin/test",
+    "test:unit": "./node_modules/.bin/babel-node test/core.spec.js",
     "watch": "nodemon --watch src --ext scss,js -x \"npm run build && node website/update.js\"",
     "watch:css": "nodemon --watch src --ext scss -x \"npm run build && node website/update.js\"",
     "watch:examples": "cd website && node build-examples.js watch",

+ 10 - 2
test/core.spec.js

@@ -1,14 +1,22 @@
 var test = require('tape');
 var Core = require('../src/core/index.js');
 
-const core = new Core();
-
 test('core object', function (t) {
+  const core = new Core();
   t.equal(typeof core, 'object', 'new Core() should return an object');
   t.end();
 });
 
 test('core type', function (t) {
+  const core = new Core();
   t.equal(core.type, 'core', 'core.type should equal core');
   t.end();
 });
+
+test('translation', function (t) {
+  const russianDict = require('../src/locale/ru_RU.json');
+  const core = new Core({locale: russianDict});
+
+  t.equal(core.translate('Choose a file'), 'Выберите файл', 'should return translated string');
+  t.end();
+});