Add spec for changing remote object's properties.
authorCheng Zhao <zcbenz@gmail.com>
Wed, 14 Aug 2013 05:27:50 +0000 (13:27 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Wed, 14 Aug 2013 05:28:15 +0000 (13:28 +0800)
spec/api/ipc.coffee
spec/fixtures/module/property.js [new file with mode: 0644]

index 4860b96..5215da3 100644 (file)
@@ -4,6 +4,8 @@ path = require 'path'
 remote = require 'remote'
 
 describe 'ipc', ->
+  fixtures = path.join __dirname, '..', 'fixtures'
+
   describe 'remote.require', ->
     it 'should returns same object for the same module', ->
       dialog1 = remote.require 'dialog'
@@ -11,9 +13,18 @@ describe 'ipc', ->
       assert.equal dialog1, dialog2
 
     it 'should work when object contains id property', ->
-      a = remote.require path.join(__dirname, '..', 'fixtures', 'module', 'id.js')
+      a = remote.require path.join(fixtures, 'module', 'id.js')
       assert.equal a.id, 1127
 
+  describe 'remote object', ->
+    it 'can change its properties', ->
+      property = remote.require path.join(fixtures, 'module', 'property.js')
+      assert.equal property.property, 1127
+      property.property = 1007
+      assert.equal property.property, 1007
+      property2 = remote.require path.join(fixtures, 'module', 'property.js')
+      assert.equal property2.property, 1007
+
   describe 'ipc.send', ->
     it 'should work when sending an object containing id property', (done) ->
       obj = id: 1, name: 'ly'
diff --git a/spec/fixtures/module/property.js b/spec/fixtures/module/property.js
new file mode 100644 (file)
index 0000000..88e596f
--- /dev/null
@@ -0,0 +1 @@
+exports.property = 1127