mirror of
https://github.com/atom/atom.git
synced 2026-01-23 22:08:08 -05:00
Add DefaultDirectorySearcher spec
This commit is contained in:
31
spec/default-directory-searcher-spec.coffee
Normal file
31
spec/default-directory-searcher-spec.coffee
Normal file
@@ -0,0 +1,31 @@
|
||||
DefaultDirectorySearcher = require "../src/default-directory-searcher"
|
||||
path = require "path"
|
||||
fs = require 'fs-plus'
|
||||
temp = require "temp"
|
||||
|
||||
describe "DefaultDirectorySearcher", ->
|
||||
[searcher, dirPath] = []
|
||||
|
||||
beforeEach ->
|
||||
dirPath = path.resolve(__dirname, 'fixtures', 'dir')
|
||||
searcher = new DefaultDirectorySearcher
|
||||
|
||||
it "terminates the task after running a search", ->
|
||||
console.log searcher
|
||||
options =
|
||||
ignoreCase: false
|
||||
includeHidden: false
|
||||
excludeVcsIgnores: true
|
||||
inclusions: []
|
||||
globalExclusions: ['a-dir']
|
||||
didMatch: ->
|
||||
didError: ->
|
||||
didSearchPaths: ->
|
||||
searchPromise = searcher.search([{getPath: -> dirPath}], /abcdefg/, options)
|
||||
spyOn(searchPromise.directorySearch.task, 'terminate').andCallThrough()
|
||||
|
||||
waitsForPromise -> searchPromise
|
||||
|
||||
runs ->
|
||||
expect(searchPromise.directorySearch.task.terminate).toHaveBeenCalled()
|
||||
expect(searchPromise.directorySearch.task.childProcess).toBe null
|
||||
Reference in New Issue
Block a user