Wait for fakeSearch to be defined in spec

This commit is contained in:
Nathan Sobo
2015-09-04 11:22:11 -06:00
parent 7a5e441987
commit 035429b7bc

View File

@@ -1122,11 +1122,16 @@ describe "Workspace", ->
it "can be cancelled when the object returned by scan() has its cancel() method invoked", ->
thenable = atom.workspace.scan /aaaa/, ->
expect(fakeSearch.cancelled).toBe(undefined)
thenable.cancel()
expect(fakeSearch.cancelled).toBe(true)
resultOfPromiseSearch = null
waitsFor 'fakeSearch to be defined', -> fakeSearch?
runs ->
expect(fakeSearch.cancelled).toBe(undefined)
thenable.cancel()
expect(fakeSearch.cancelled).toBe(true)
waitsForPromise ->
thenable.then (promiseResult) -> resultOfPromiseSearch = promiseResult