Skip to content

Commit

Permalink
Add a test to assert that each language has a valid label
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhwaneet Bhatt committed Mar 29, 2023
1 parent 373b511 commit d11cbcf
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions npm/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions test/unit/lib.test.js
Original file line number Diff line number Diff line change
@@ -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]);
});
});
});
});

0 comments on commit d11cbcf

Please sign in to comment.