+path = require 'path'
+
 Keymap = require '../src/keymap'
 {$, $$, RootView} = require 'atom'
 

  describe ".determineSource", ->
    describe "for a package", ->
      it "returns '<package-name>'", ->
        expect(keymap.determineSource('~/.atom/packages/dummy/keymaps/a.cson')).toEqual 'dummy'

    describe "for a linked package", ->
      it "returns '<package-name>'", ->
        expect(keymap.determineSource('/Users/john/github/dummy/keymaps/a.cson')).toEqual 'dummy'

    describe "for a user defined keymap", ->
      it "returns 'User'", ->
        expect(keymap.determineSource('~/.atom/keymaps/a.cson')).toEqual 'User'

    describe "for a core keymap", ->
      it "returns 'Core'", ->
        expect(keymap.determineSource('/Applications/Atom.app/.../node_modules/dummy/keymaps/a.cson')).toEqual 'Core'

    describe "for a linked core keymap", ->
      it "returns 'Core'", ->
        expect(keymap.determineSource('/Users/john/github/atom/keymaps/a.cson')).toEqual 'Core'


  describe ".getAllKeyMappings", ->
    it "returns the all bindings", ->
      keymap.bindKeys path.join('~', '.atom', 'packages', 'dummy', 'keymaps', 'a.cson'), '.command-mode', 'k': 'c'

      mappings = keymap.getAllKeyMappings()
      expect(mappings.length).toBe 1
