 
       alpha2DirPath = path.join(rootDirPath, "alpha2")
 
+      symlinkToAlphaDirPath = path.join(rootDirPath, "symalpha")
+
       fs.writeFileSync(alphaFilePath, "doesn't matter")
       fs.writeFileSync(zetaFilePath, "doesn't matter")
 


      beforeEach ->
        LocalStorage.clear()

      describe "when attempting to paste a directory into itself", ->
        beforeEach ->
          atom.notifications.clear()

        operations =
          "copy": "copied"
          "cut": "cut"

        for operation, text of operations
          describe "when #{text}", ->
            it "shows a warning notification and does not paste", ->
              # /dir-1/ -> /dir-1/
              LocalStorage["tree-view:#{operation}Path"] = JSON.stringify([dirPath])
              newPath = path.join(dirPath, path.basename(dirPath))
              dirView.dispatchEvent(new MouseEvent('click', {bubbles: true, detail: 1}))
              expect(-> atom.commands.dispatch(treeView.element, "tree-view:paste")).not.toThrow()
              expect(fs.existsSync(newPath)).toBe false
              expect(atom.notifications.getNotifications()[0].getMessage()).toContain 'Cannot paste a folder into itself'
              atom.notifications.clear()

              nestedPath = path.join(dirPath, 'nested')
              fs.makeTreeSync(nestedPath)

              # /dir-1/ -> /dir-1/nested
              LocalStorage["tree-view:#{operation}Path"] = JSON.stringify([dirPath])
              newPath = path.join(nestedPath, path.basename(dirPath))
              dirView.expand()
              nestedView = dirView.querySelector('.directory')
              nestedView.dispatchEvent(new MouseEvent('click', {bubbles: true, detail: 1}))
              expect(-> atom.commands.dispatch(treeView.element, "tree-view:paste")).not.toThrow()
              expect(fs.existsSync(newPath)).toBe false
              expect(atom.notifications.getNotifications()[0].getMessage()).toContain 'Cannot paste a folder into itself'
              atom.notifications.clear()
              dirView.collapse()

              # /dir-1/ -> /dir-2/
              LocalStorage["tree-view:#{operation}Path"] = JSON.stringify([dirPath])
              newPath = path.join(dirPath2, path.basename(dirPath))
              dirView2.dispatchEvent(new MouseEvent('click', {bubbles: true, detail: 1}))
              expect(-> atom.commands.dispatch(treeView.element, "tree-view:paste")).not.toThrow()
              expect(fs.existsSync(newPath)).toBe true
              expect(atom.notifications.getNotifications()[0]).toBeUndefined()

      describe "when pasting entries which don't exist anymore", ->
        it "skips the entry which doesn't exist", ->

        expect(etaDir.querySelector('.entries').children.length).toBe 0

        expect(atom.notifications.getNotifications()[0].getMessage()).toContain 'Cannot move a folder into itself'

      it "shows a warning notification and does not move the directory if it would result in recursive copying (symlink)", ->
        # Dragging alphaDir onto symalpha, which is a symlink to alphaDir
        alphaDir = findDirectoryContainingText(treeView.roots[0], 'alpha')
        alphaDir.expand()

        symlinkDir = treeView.roots[0].entries.children[3]
        symlinkDir.expand()

        [dragStartEvent, dragEnterEvent, dropEvent] =
          eventHelpers.buildInternalDragEvents(alphaDir, symlinkDir.querySelector('.header'), symlinkDir)
        treeView.onDragStart(dragStartEvent)
        treeView.onDrop(dropEvent)
        expect(symlinkDir.children.length).toBe 2
        symlinkDir.expand()
        expect(symlinkDir.querySelector('.entries').children.length).toBe 2

        expect(atom.notifications.getNotifications()[0].getMessage()).toContain 'Cannot move a folder into itself'

      it "moves successfully when dragging a directory onto a sibling directory that starts with the same letter", ->
        # Dragging alpha onto alpha2, which is a sibling of alpha's
        alphaDir = findDirectoryContainingText(treeView.roots[0], 'alpha')
        alphaDir.expand()

        alpha2Dir = findDirectoryContainingText(treeView.roots[0], 'alpha2')
        [dragStartEvent, dragEnterEvent, dropEvent] =
          eventHelpers.buildInternalDragEvents(alphaDir, alpha2Dir.querySelector('.header'), alpha2Dir)
        treeView.onDragStart(dragStartEvent)
        treeView.onDrop(dropEvent)
        expect(alpha2Dir.children.length).toBe 2
        alpha2Dir.expand()
        expect(alpha2Dir.querySelector('.entries').children.length).toBe 1

        expect(atom.notifications.getNotifications()[0]).toBeUndefined()

      it "moves successfully when dragging a symlink into its target directory", ->
        # Dragging alphaDir onto symalpha, which is a symlink to alphaDir
        alphaDir = findDirectoryContainingText(treeView.roots[0], 'alpha')
        alphaDir.expand()

        symlinkDir = treeView.roots[0].entries.children[3]
        symlinkDir.expand()

        [dragStartEvent, dragEnterEvent, dropEvent] =
          eventHelpers.buildInternalDragEvents(symlinkDir, alphaDir.querySelector('.header'), alphaDir)
        treeView.onDragStart(dragStartEvent)
        treeView.onDrop(dropEvent)
        expect(alphaDir.children.length).toBe 2
        alphaDir.reload()
        expect(alphaDir.querySelector('.entries').children.length).toBe 3

        expect(atom.notifications.getNotifications()[0]).toBeUndefined()

