Просмотр исходного кода

added test for a 200 status on unsupported language

GitOrigin-RevId: 802dc736969bbc48aa3beb9eb90b17dfdb59fff2
mserranom 7 лет назад
Родитель
Сommit
b3501a40e3
1 измененных файлов с 12 добавлено и 3 удалено
  1. 12 3
      services/web/test/unit/src/Spelling/SpellingControllerTests.js

+ 12 - 3
services/web/test/unit/src/Spelling/SpellingControllerTests.js

@@ -56,9 +56,8 @@ describe('SpellingController', function() {
       headers: { Host: SPELLING_HOST }
     }
 
-    this.res = {
-      send: sinon.stub()
-    }
+    this.res = {}
+    this.res.send = sinon.stub()
     this.res.status = sinon.stub().returns(this.res)
     this.res.end = sinon.stub()
     this.res.json = sinon.stub()
@@ -103,6 +102,16 @@ describe('SpellingController', function() {
       it('should not send a request to the spelling host', function() {
         this.request.called.should.equal(false)
       })
+
+      it('should return an empty misspellings array', function() {
+        this.res.send
+          .calledWith(JSON.stringify({ misspellings: [] }))
+          .should.equal(true)
+      })
+
+      it('should return a 200 status', function() {
+        this.res.status.calledWith(200).should.equal(true)
+      })
     })
   })
 })