diff --git a/npm/test.sh b/npm/test.sh index a2757b4a0..6b340c5d0 100755 --- a/npm/test.sh +++ b/npm/test.sh @@ -59,6 +59,9 @@ else # check for .gitignore, license.md, readme.md, .eslintrc and package.json mocha ./test/system/repository.test.js; + # runs test to see if the codegen interface is implemented correctly + mocha ./test/unit/lib.test.js; + # Common structure and npm test for each codegen. echo -e "Running codegen-structure tests on all the codegens"; for directory in codegens/*; do diff --git a/test/unit/lib.test.js b/test/unit/lib.test.js new file mode 100644 index 000000000..77ad8c314 --- /dev/null +++ b/test/unit/lib.test.js @@ -0,0 +1,19 @@ +const expect = require('chai').expect, + lib = require('../../lib'), + labels = require('../../lib/assets/languageLabels.json'); + +describe('lib', function () { + describe('getLanguageList', function () { + it('should test that each language has a valid label', function () { + const list = lib.getLanguageList(); + + expect(list).to.be.an('array'); + + list.forEach(function (lang) { + expect(lang).to.have.property('key'); + expect(lang).to.have.property('label'); + expect(lang.label).to.equal(labels[lang.key]); + }); + }); + }); +});