fix up the aspell tests

This commit is contained in:
Henry Oswald 2015-03-03 14:25:54 +00:00
parent 72ce615641
commit 35254be989
2 changed files with 6 additions and 3 deletions

View file

@ -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",

View file

@ -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()