Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tests] add tests for function proxies #53

Merged
merged 1 commit into from
May 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';

/* globals Proxy */
/* eslint no-magic-numbers: 1 */

var test = require('tape');
Expand Down Expand Up @@ -27,6 +28,19 @@ returnClass();
return3();
/* end for coverage */

var proxy;
if (typeof Proxy === 'function') {
try {
proxy = new Proxy(function () {}, {});
// for coverage
proxy();
String(proxy);
} catch (_) {
// Older engines throw a `TypeError` when `Function.prototype.toString` is called on a Proxy object.
proxy = null;
}
}

var invokeFunction = function invokeFunctionString(str) {
var result;
try {
Expand Down Expand Up @@ -159,3 +173,8 @@ test('`async function`s', { skip: asyncs.length === 0 }, function (t) {
});
t.end();
});

test('proxies of functions', { skip: !proxy }, function (t) {
t.ok(isCallable(proxy), 'proxies of functions are callable');
t.end();
});