Henry Oswald пре 11 година
родитељ
комит
35254be989
2 измењених фајлова са 6 додато и 3 уклоњено
  1. 1 0
      services/spelling/package.json
  2. 5 3
      services/spelling/test/unit/coffee/ASpellTests.coffee

+ 1 - 0
services/spelling/package.json

@@ -10,6 +10,7 @@
   "dependencies": {
   "dependencies": {
     "async": "0.1.22",
     "async": "0.1.22",
     "body-parser": "^1.12.0",
     "body-parser": "^1.12.0",
+    "coffee-script": "^1.9.1",
     "express": "^4.12.1",
     "express": "^4.12.1",
     "logger-sharelatex": "git+https://github.com/sharelatex/logger-sharelatex.git#v1.0.0",
     "logger-sharelatex": "git+https://github.com/sharelatex/logger-sharelatex.git#v1.0.0",
     "lru-cache": "^2.5.0",
     "lru-cache": "^2.5.0",

+ 5 - 3
services/spelling/test/unit/coffee/ASpellTests.coffee

@@ -1,10 +1,12 @@
 sinon = require 'sinon'
 sinon = require 'sinon'
 chai = require 'chai'
 chai = require 'chai'
 should = chai.should()
 should = chai.should()
+SandboxedModule = require('sandboxed-module')
+assert = require("chai").assert
 
 
 describe "ASpell", ->
 describe "ASpell", ->
 	beforeEach ->
 	beforeEach ->
-		@ASpell = require("../../../app/js/ASpell")
+		@ASpell = SandboxedModule.require "../../../app/js/ASpell", requires:{}
 
 
 	describe "a correctly spelled word", ->
 	describe "a correctly spelled word", ->
 		beforeEach (done) ->
 		beforeEach (done) ->
@@ -44,11 +46,11 @@ describe "ASpell", ->
 
 
 		it "should return a blank array", ->
 		it "should return a blank array", ->
 			@result.length.should.equal 1
 			@result.length.should.equal 1
-			@result[0].suggestions.should.deep.equal []
+			assert.deepEqual @result[0].suggestions, []
 
 
 	describe "when the request times out", ->
 	describe "when the request times out", ->
 		beforeEach (done) ->
 		beforeEach (done) ->
-			words = ("abcdefg" for i in [0..1000000])
+			words = ("abcdefg" for i in [0..1000])
 			@ASpell.ASPELL_TIMEOUT = 100
 			@ASpell.ASPELL_TIMEOUT = 100
 			@start = new Date()
 			@start = new Date()
 			@ASpell.checkWords "en", words, (error, @result) => done()
 			@ASpell.checkWords "en", words, (error, @result) => done()