         beforeEach ->
           dotFilePath = path.join(dirPath, ".dotfile")
           fs.writeFileSync(dotFilePath, "dot")
-          dirView.collapse()
-          dirView.expand()
+          dirView[0].collapse()
+          dirView[0].expand()
           dotFileView = treeView.find('.file:contains(.dotfile)')
 
           waitsForFileToOpen ->

              runs ->
                dirView = $(treeView.root.entries).find('.directory:contains(test-dir)')
                dirView[0].expand()
                expect(dirView.entries.children().length).toBe 0

          describe "when the directories along the new path don't exist", ->
            it "creates the target directory before moving the file", ->

          addDialog.cancel()
          root.click()
          root.removeClass('selected')
          expect(treeView.selectedEntry()).toBeNull()
          treeView.trigger "tree-view:add-file"
          addDialog = atom.workspaceView.find(".tree-view-dialog").view()

