FIx functions tests
MODIFY
shim/test/module/functions.js
shim/test/module/functions.js
import test from 'tape';
import { repairFunctions } from '../../src/functions';
-test('Function.prototype.constructor', t => {
- t.plan(4);
-
+test('repairFunctions', specs => {
repairFunctions();
+ specs.test('Function.prototype.constructor', t => {
+ t.plan(4);
+
// eslint-disable-next-line no-new-func
t.doesNotThrow(() => Function(''));
@@ -17,11 +18,9 @@ test('Function.prototype.constructor', t => {
t.throws(() => proto.constructor(''), TypeError);
});
-test('AsyncFunction.constructor', t => {
+ specs.test('AsyncFunction.constructor', t => {
t.plan(1);
- repairFunctions();
-
try {
const proto = Object.getPrototypeOf((0, eval)('(async function() {})'));
t.throws(() => proto.constructor(''), TypeError);
@@ -34,11 +33,9 @@ test('AsyncFunction.constructor', t => {
}
});
-test('GeneratorFunction.constructor', t => {
+ specs.test('GeneratorFunction.constructor', t => {
t.plan(1);
- repairFunctions();
-
try {
const proto = Object.getPrototypeOf((0, eval)('(function* () {})'));
t.throws(() => proto.constructor(''), TypeError);
@@ -51,11 +48,9 @@ test('GeneratorFunction.constructor', t => {
}
});
-test('AsyncGeneratorFunction.constructor', t => {
+ specs.test('AsyncGeneratorFunction.constructor', t => {
t.plan(1);
- repairFunctions();
-
try {
const proto = Object.getPrototypeOf((0, eval)('(async function* () {})'));
t.throws(() => proto.constructor(''), TypeError);
@@ -67,3 +62,4 @@ test('AsyncGeneratorFunction.constructor', t => {
}
}
});
+});

FIx functions tests