Skip to content

Commit d11cbcf

Browse files
author
Dhwaneet Bhatt
committed
Add a test to assert that each language has a valid label
1 parent 373b511 commit d11cbcf

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

npm/test.sh

+3
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@ else
5959
# check for .gitignore, license.md, readme.md, .eslintrc and package.json
6060
mocha ./test/system/repository.test.js;
6161

62+
# runs test to see if the codegen interface is implemented correctly
63+
mocha ./test/unit/lib.test.js;
64+
6265
# Common structure and npm test for each codegen.
6366
echo -e "Running codegen-structure tests on all the codegens";
6467
for directory in codegens/*; do

test/unit/lib.test.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const expect = require('chai').expect,
2+
lib = require('../../lib'),
3+
labels = require('../../lib/assets/languageLabels.json');
4+
5+
describe('lib', function () {
6+
describe('getLanguageList', function () {
7+
it('should test that each language has a valid label', function () {
8+
const list = lib.getLanguageList();
9+
10+
expect(list).to.be.an('array');
11+
12+
list.forEach(function (lang) {
13+
expect(lang).to.have.property('key');
14+
expect(lang).to.have.property('label');
15+
expect(lang.label).to.equal(labels[lang.key]);
16+
});
17+
});
18+
});
19+
});

0 commit comments

Comments
 (0)