mirror of
https://github.com/atom/atom.git
synced 2026-01-23 05:48:10 -05:00
Move testing of deferred deserializers to atom-spec
This commit is contained in:
@@ -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
|
||||
@@ -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", ->
|
||||
|
||||
Reference in New Issue
Block a user