Add test for id property of remote object.

This commit is contained in:
Cheng Zhao 2013-07-26 15:53:00 +08:00
parent 47686b3233
commit 511b2a4422
3 changed files with 20 additions and 0 deletions

View file

@ -1,4 +1,6 @@
assert = require 'assert'
ipc = require 'ipc'
path = require 'path'
remote = require 'remote'
describe 'ipc', ->
@ -7,3 +9,15 @@ describe 'ipc', ->
dialog1 = remote.require 'dialog'
dialog2 = remote.require 'dialog'
assert.equal dialog1, dialog2
it 'should work when object contains id property', ->
a = remote.require path.join(__dirname, '..', 'fixtures', 'module', 'id.js')
assert.equal a.id, 1127
describe 'ipc.send', ->
it 'should work when sending an object containing id property', (done) ->
obj = id: 1, name: 'ly'
ipc.on 'message', (message) ->
assert.deepEqual message, obj
done()
ipc.send obj

1
spec/fixtures/module/id.js vendored Normal file
View file

@ -0,0 +1 @@
exports.id = 1127

View file

@ -1,8 +1,13 @@
var app = require('app');
var ipc = require('ipc');
var BrowserWindow = require('browser-window');
var window = null;
ipc.on('message', function() {
ipc.send.apply(this, arguments);
});
process.on('uncaughtException', function() {
window.openDevTools();
});