jenkins-bot has submitted this change and it was merged.

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, 22 insertions(+), 2 deletions(-)

Approvals:
  KartikMistry: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/index.js b/index.js
index b5cb109..1b309e1 100644
--- a/index.js
+++ b/index.js
@@ -1,4 +1,5 @@
 module.exports = {
        Segmenter: require( './segmentation/CXSegmenter.js' ).CXSegmenter,
-       LinearDoc: require( './lineardoc/LinearDoc.js' )
+       LinearDoc: require( './lineardoc/LinearDoc.js' ),
+       Dictionary: require( './dictionary' )
 };
diff --git a/tests/dictionary/Dictionary.test.js 
b/tests/dictionary/Dictionary.test.js
new file mode 100644
index 0000000..23a43f1
--- /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 dee8011..17ee135 100644
--- a/tests/index.js
+++ b/tests/index.js
@@ -2,7 +2,8 @@
 var qunit = require( 'qunit' ),
        tests = [
                './tests/segmentation/CXSegmenter.test.js',
-               './tests/lineardoc/LinearDoc.test.js'
+               './tests/lineardoc/LinearDoc.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: merged
Gerrit-Change-Id: I9004d33a4507025776925f19baf53f6d25ebb74b
Gerrit-PatchSet: 6
Gerrit-Project: mediawiki/services/cxserver
Gerrit-Branch: master
Gerrit-Owner: Santhosh <[email protected]>
Gerrit-Reviewer: KartikMistry <[email protected]>
Gerrit-Reviewer: Nikerabbit <[email protected]>
Gerrit-Reviewer: Santhosh <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to