source: frontend/node_modules/async-function/test/index.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 1.0 KB
Line 
1'use strict';
2
3var test = require('tape');
4var getProto = require('get-proto');
5var semver = require('semver');
6
7var getAsyncFunction = require('../');
8
9test('getAsyncFunction', function (t) {
10 var result = getAsyncFunction();
11
12 /* eslint-env browser */
13 if (typeof window === 'undefined' && typeof process !== 'undefined') {
14 t.equal(
15 !!result,
16 semver.satisfies(process.version, '>= 7.6'),
17 'result is present or absent as expected for node ' + process.version
18 );
19 }
20
21 t.test('exists', { skip: !result }, function (st) {
22 if (result && getProto) { // TS can't infer `skip`, or that getProto definitely exists if AsyncFunction exists
23 st.equal(typeof result, 'function', 'is a function');
24 st.equal(getProto(result), Function, 'extends Function');
25
26 return result('a', 'return a')(42).then(function (a) {
27 st.equal(a, 42, 'returns an async function');
28 });
29 }
30 return st.fail('should never get here');
31 });
32
33 t.test('does not exist', { skip: !!result }, function (st) {
34 st.equal(result, false, 'is false');
35
36 st.end();
37 });
38
39 t.end();
40});
Note: See TracBrowser for help on using the repository browser.