default-directory-searcher-spec.js 966 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. const DefaultDirectorySearcher = require('../src/default-directory-searcher');
  2. const Task = require('../src/task');
  3. const path = require('path');
  4. describe('DefaultDirectorySearcher', function() {
  5. let searcher;
  6. let dirPath;
  7. beforeEach(function() {
  8. dirPath = path.resolve(__dirname, 'fixtures', 'dir');
  9. searcher = new DefaultDirectorySearcher();
  10. });
  11. it('terminates the task after running a search', async function() {
  12. const options = {
  13. ignoreCase: false,
  14. includeHidden: false,
  15. excludeVcsIgnores: true,
  16. inclusions: [],
  17. globalExclusions: ['a-dir'],
  18. didMatch() {},
  19. didError() {},
  20. didSearchPaths() {}
  21. };
  22. spyOn(Task.prototype, 'terminate').andCallThrough();
  23. await searcher.search(
  24. [
  25. {
  26. getPath() {
  27. return dirPath;
  28. }
  29. }
  30. ],
  31. /abcdefg/,
  32. options
  33. );
  34. expect(Task.prototype.terminate).toHaveBeenCalled();
  35. });
  36. });