Add spec for remote function with toString property
authorKevin Sawicki <kevinsawicki@gmail.com>
Fri, 17 Mar 2017 17:28:23 +0000 (10:28 -0700)
committerKevin Sawicki <kevinsawicki@gmail.com>
Fri, 17 Mar 2017 17:28:23 +0000 (10:28 -0700)
spec/api-ipc-spec.js
spec/fixtures/module/to-string-non-function.js [new file with mode: 0644]

index f86d065..47f2eef 100644 (file)
@@ -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')
     })
   })
 
diff --git a/spec/fixtures/module/to-string-non-function.js b/spec/fixtures/module/to-string-non-function.js
new file mode 100644 (file)
index 0000000..3e91921
--- /dev/null
@@ -0,0 +1,4 @@
+function hello () {
+}
+hello.toString = 'hello'
+module.exports = {functionWithToStringProperty: hello}