pulsar/spec/default-directory-searcher-spec.js

43 lines
966 B
JavaScript
Raw Normal View History

2019-05-31 19:33:56 +03:00
const DefaultDirectorySearcher = require('../src/default-directory-searcher');
const Task = require('../src/task');
const path = require('path');
2019-05-31 19:33:56 +03:00
describe('DefaultDirectorySearcher', function() {
let searcher;
let dirPath;
2019-05-31 19:33:56 +03:00
beforeEach(function() {
dirPath = path.resolve(__dirname, 'fixtures', 'dir');
searcher = new DefaultDirectorySearcher();
});
2019-05-31 19:33:56 +03:00
it('terminates the task after running a search', async function() {
const options = {
ignoreCase: false,
includeHidden: false,
excludeVcsIgnores: true,
inclusions: [],
globalExclusions: ['a-dir'],
2019-05-31 19:33:56 +03:00
didMatch() {},
didError() {},
didSearchPaths() {}
};
2019-05-16 14:05:01 +03:00
2019-05-31 19:33:56 +03:00
spyOn(Task.prototype, 'terminate').andCallThrough();
2019-05-16 14:05:01 +03:00
await searcher.search(
[
{
2019-05-31 19:33:56 +03:00
getPath() {
return dirPath;
}
}
],
/abcdefg/,
options
2019-05-31 19:33:56 +03:00
);
2019-05-31 19:33:56 +03:00
expect(Task.prototype.terminate).toHaveBeenCalled();
});
});