Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
test: fix the failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Apr 9, 2021
1 parent 42a03c6 commit 098a195
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 40 deletions.
32 changes: 0 additions & 32 deletions spec/async-helper.js

This file was deleted.

13 changes: 5 additions & 8 deletions spec/tree-view-package-spec.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -3169,7 +3169,7 @@ describe "TreeView", ->

finishRemovalSpy = spyOn(treeView, 'finishRemoval').andCallThrough()

removeSelectedPathsPermanentlySpy = spyOnAsyncAndCallThrough(treeView, 'removeSelectedPathsPermanently')
removeSelectedPathsPermanentlySpy = spyOn(treeView, 'removeSelectedPathsPermanently').andCallThrough()
removeSelectedEntriesSpy = spyOn(treeView, 'removeSelectedEntries').andCallThrough()

filePath = path.join(os.tmpdir(), 'non-project-file.txt')
Expand All @@ -3181,26 +3181,23 @@ describe "TreeView", ->
waitsForPromise ->
atom.commands.dispatch(treeView.element, 'tree-view:remove-permanently')

waitsFor ->
removeSelectedPathsPermanentlySpy.calledWith isnt undefined

waitsFor 'removeSelectedEntries amd removeSelectedPathsPermanently to be called', ->
removeSelectedEntriesSpy.callCount is 1 and
removeSelectedEntriesSpy.mostRecentCall.args[0] is true and
removeSelectedPathsPermanentlySpy.calledWith[0] is [filePath]
removeSelectedPathsPermanentlySpy.mostRecentCall.args[0][0] is filePath

# The internal functionality of the followings are already tested in treeview:remove
waitsFor 'it calls onWillDeleteEntry', ->
onWillDeleteEntrySpy.callCount is 1 and
onWillDeleteEntrySpy.mostRecentCall.args[0] is {pathToDelete: filePath}
onWillDeleteEntrySpy.mostRecentCall.args[0].pathToDelete is filePath

waitsFor 'it calls onEntryDeleted', ->
onEntryDeletedSpy.callCount is 1 and
onEntryDeletedSpy.mostRecentCall.args[0] is {pathToDelete: filePath}
onEntryDeletedSpy.mostRecentCall.args[0].pathToDelete is filePath

waitsFor 'it calls finishRemoval', ->
finishRemovalSpy.callCount is 1 and
finishRemovalSpy.mostRecentCall.args[0] is removeSelectedPathsPermanentlySpy.calledWith[1][0]
finishRemovalSpy.mostRecentCall.args[0] is removeSelectedPathsPermanentlySpy.mostRecentCall.args[1][0]

describe "file system events", ->
temporaryFilePath = null
Expand Down

0 comments on commit 098a195

Please sign in to comment.