Skip to content

Commit de1e1aa

Browse files
committed
Fix flaky highlighting spec
Spec would previous fail if the random temp dir directory name contained any of the same character as 'sample.js'.
1 parent b444d75 commit de1e1aa

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

spec/fuzzy-finder-spec.coffee

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -743,16 +743,23 @@ describe 'FuzzyFinder', ->
743743
expect(secondaryMatches.last().text()).toBe 'js'
744744

745745
it "highlights matches in the directory and file name", ->
746+
spyOn(bufferView, 'setItems').andReturn [
747+
{
748+
filePath: '/test/root-dir1/sample.js'
749+
projectRelativePath: 'root-dir1/sample.js'
750+
}
751+
]
752+
746753
bufferView.filterEditorView.getModel().setText('root-dirsample')
747754
bufferView.populateList()
748755
resultView = bufferView.getSelectedItemView()
749756

750757
primaryMatches = resultView.find('.primary-line .character-match')
751-
secondaryMatches = resultView.find('.secondary-line .character-match')
752758
expect(primaryMatches.length).toBe 1
753759
expect(primaryMatches.last().text()).toBe 'sample'
754-
# Use `toBeGreaterThan` because dir may have some characters in it
755-
expect(secondaryMatches.length).toBeGreaterThan 1
760+
761+
secondaryMatches = resultView.find('.secondary-line .character-match')
762+
expect(secondaryMatches.length).toBe 2
756763
expect(secondaryMatches.first().text()).toBe 'root-dir'
757764
expect(secondaryMatches.last().text()).toBe 'sample'
758765

0 commit comments

Comments
 (0)