2016-01-15 23:35:28 +03:00
|
|
|
DefaultDirectorySearcher = require '../src/default-directory-searcher'
|
|
|
|
Task = require '../src/task'
|
|
|
|
path = require 'path'
|
2015-07-29 03:34:29 +03:00
|
|
|
|
|
|
|
describe "DefaultDirectorySearcher", ->
|
|
|
|
[searcher, dirPath] = []
|
|
|
|
|
|
|
|
beforeEach ->
|
|
|
|
dirPath = path.resolve(__dirname, 'fixtures', 'dir')
|
|
|
|
searcher = new DefaultDirectorySearcher
|
|
|
|
|
|
|
|
it "terminates the task after running a search", ->
|
|
|
|
options =
|
|
|
|
ignoreCase: false
|
|
|
|
includeHidden: false
|
|
|
|
excludeVcsIgnores: true
|
|
|
|
inclusions: []
|
|
|
|
globalExclusions: ['a-dir']
|
|
|
|
didMatch: ->
|
|
|
|
didError: ->
|
|
|
|
didSearchPaths: ->
|
|
|
|
searchPromise = searcher.search([{getPath: -> dirPath}], /abcdefg/, options)
|
2015-07-29 21:48:49 +03:00
|
|
|
spyOn(Task::, 'terminate').andCallThrough()
|
2015-07-29 03:34:29 +03:00
|
|
|
|
|
|
|
waitsForPromise -> searchPromise
|
|
|
|
|
|
|
|
runs ->
|
2015-07-29 21:48:49 +03:00
|
|
|
expect(Task::terminate).toHaveBeenCalled()
|