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

Commit 66a0d3c

Browse files
committed
test: add onWillDeleteEntry, onEntryDeleted, finishRemoval emitter calls
1 parent 6c497af commit 66a0d3c

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

spec/tree-view-package-spec.coffee

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3159,8 +3159,15 @@ describe "TreeView", ->
31593159
expect(args.buttons).toEqual ['Permanently Delete ⚠️', 'Cancel']
31603160

31613161

3162-
it "calls removeSelectedEntries and removeSelectedPathsPermanently", ->
3162+
it "calls removeSelectedPathsPermanently, onWillDeleteEntry, onEntryDeleted, finishRemoval", ->
31633163
spyOn(atom, 'confirm').andCallFake (options, callback) -> callback(0)
3164+
onEntryDeletedSpy = jasmine.createSpy('onEntryDeleted')
3165+
treeView.onEntryDeleted(onEntryDeletedSpy)
3166+
3167+
onWillDeleteEntrySpy = jasmine.createSpy('onWillDeleteEntry')
3168+
treeView.onWillDeleteEntry(onWillDeleteEntrySpy)
3169+
3170+
finishRemovalSpy = spyOn(treeView, 'finishRemoval').andCallThrough()
31643171

31653172
removeSelectedPathsPermanentlySpy = spyOnAsyncAndCallThrough(treeView, 'removeSelectedPathsPermanently')
31663173
removeSelectedEntriesSpy = spyOn(treeView, 'removeSelectedEntries').andCallThrough()
@@ -3182,6 +3189,19 @@ describe "TreeView", ->
31823189
removeSelectedEntriesSpy.mostRecentCall.args[0] is true and
31833190
removeSelectedPathsPermanentlySpy.calledWith[0] is [filePath]
31843191

3192+
# The internal functionality of the followings are already tested in treeview:remove
3193+
waitsFor 'it calls onWillDeleteEntry', ->
3194+
onWillDeleteEntrySpy.callCount is 1 and
3195+
onWillDeleteEntrySpy.mostRecentCall.args[0] is {pathToDelete: filePath}
3196+
3197+
waitsFor 'it calls onEntryDeleted', ->
3198+
onEntryDeletedSpy.callCount is 1 and
3199+
onEntryDeletedSpy.mostRecentCall.args[0] is {pathToDelete: filePath}
3200+
3201+
waitsFor 'it calls finishRemoval', ->
3202+
finishRemovalSpy.callCount is 1 and
3203+
finishRemovalSpy.mostRecentCall.args[0] is removeSelectedPathsPermanentlySpy.calledWith[1][0]
3204+
31853205
describe "file system events", ->
31863206
temporaryFilePath = null
31873207

0 commit comments

Comments
 (0)