Move testing of deferred deserializers to atom-spec

This commit is contained in:
Nathan Sobo
2013-03-26 15:46:19 -06:00
parent 2fe057bd9b
commit a07cd87c2c
2 changed files with 10 additions and 20 deletions

View File

@@ -1,20 +0,0 @@
RootView = require 'root-view'
AtomPackage = require 'atom-package'
fs = require 'fs-utils'
describe "AtomPackage", ->
[packageMainModule, pack] = []
beforeEach ->
pack = new AtomPackage(fs.resolve(config.packageDirPaths..., 'package-with-activation-events'))
pack.load()
describe ".load()", ->
describe "if the package's metadata has a `deferredDeserializers` array", ->
it "requires the package's main module attempting to use deserializers named in the array", ->
expect(pack.mainModule).toBeNull()
object = deserialize(deserializer: 'Foo', data: "Hello")
expect(object.constructor.name).toBe 'Foo'
expect(object.data).toBe 'Hello'
expect(pack.mainModule).toBeDefined()
expect(pack.mainModule.activateCallCount).toBe 0

View File

@@ -8,6 +8,16 @@ describe "the `atom` global", ->
window.rootView = new RootView
describe "package lifecycle methods", ->
describe ".loadPackage(id)", ->
describe "when the package has deferred deserializers", ->
it "requires the package's main module if one of its deferred deserializers is referenced", ->
pack = atom.loadPackage('package-with-activation-events')
expect(pack.mainModule).toBeNull()
object = deserialize({deserializer: 'Foo', data: 5})
expect(pack.mainModule).toBeDefined()
expect(object.constructor.name).toBe 'Foo'
expect(object.data).toBe 5
describe ".activatePackage(id)", ->
describe "atom packages", ->
describe "when the package has a main module", ->