Santhosh has uploaded a new change for review. https://gerrit.wikimedia.org/r/135412
Change subject: Qunit tests for dictionary ...................................................................... Qunit tests for dictionary Contains basic tests for jsondict dictionary backend Change-Id: I9004d33a4507025776925f19baf53f6d25ebb74b --- M index.js A tests/dictionary/Dictionary.test.js M tests/index.js 3 files changed, 21 insertions(+), 1 deletion(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/cxserver refs/changes/12/135412/1 diff --git a/index.js b/index.js index 792f349..cf444b8 100644 --- a/index.js +++ b/index.js @@ -1,3 +1,4 @@ module.exports = { + Dictionary: require( './dictionary' ), Segmenter: require( './segmentation/CXSegmenter.js' ).CXSegmenter }; diff --git a/tests/dictionary/Dictionary.test.js b/tests/dictionary/Dictionary.test.js new file mode 100644 index 0000000..3cd0b5d --- /dev/null +++ b/tests/dictionary/Dictionary.test.js @@ -0,0 +1,18 @@ +QUnit.module( 'Dictioanary' ); + +QUnit.test( 'Dictionary tests', function ( assert ) { + QUnit.stop(); + CX.Dictionary.JsonDict.getTranslations( 'you', 'en', 'es' ).then( function ( result ) { + assert.strictEqual( result.source, 'you', + 'Result contains the given word' ); + assert.strictEqual( result.translations.length, 5, + 'Found 5 results' ); + QUnit.start(); + } ); + QUnit.stop(); + CX.Dictionary.JsonDict.getTranslations( 'this_word_does_not_exist', 'en', 'es' ).then( function ( result ) { + assert.strictEqual( result.translations.length, 0, + 'Found 0 results' ); + QUnit.start(); + } ); +} ); diff --git a/tests/index.js b/tests/index.js index 553b396..8d8ef0f 100644 --- a/tests/index.js +++ b/tests/index.js @@ -1,7 +1,8 @@ /*jshint node:true */ var qunit = require( 'qunit' ), tests = [ - './tests/segmentation/CXSegmenter.test.js' + './tests/segmentation/CXSegmenter.test.js', + './tests/dictionary/Dictionary.test.js' ]; qunit.setup( { -- To view, visit https://gerrit.wikimedia.org/r/135412 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I9004d33a4507025776925f19baf53f6d25ebb74b Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/services/cxserver Gerrit-Branch: master Gerrit-Owner: Santhosh <santhosh.thottin...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits