Browse Source

Add spec for remote function with toString property

Kevin Sawicki 8 years ago
parent
commit
648d3324fb
2 changed files with 8 additions and 1 deletions
  1. 4 1
      spec/api-ipc-spec.js
  2. 4 0
      spec/fixtures/module/to-string-non-function.js

+ 4 - 1
spec/api-ipc-spec.js

@@ -163,8 +163,11 @@ describe('ipc module', function () {
     })
 
     it('returns toString() of original function via toString()', function () {
-      var readText = remote.clipboard.readText
+      const {readText} = remote.clipboard
       assert(readText.toString().startsWith('function'))
+
+      var {functionWithToStringProperty} = remote.require(path.join(fixtures, 'module', 'to-string-non-function.js'))
+      assert.equal(functionWithToStringProperty.toString, 'hello')
     })
   })
 

+ 4 - 0
spec/fixtures/module/to-string-non-function.js

@@ -0,0 +1,4 @@
+function hello () {
+}
+hello.toString = 'hello'
+module.exports = {functionWithToStringProperty: hello}