-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
58 lines (49 loc) · 1.3 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
const isAsync = require('./index.js');
const assert = require('assert');
describe('isAsync', () => {
describe('String', () => {
it('false', () => {
assert.equal(isAsync('Hello world'), false);
});
});
describe('Function', () => {
it('false', () => {
assert.equal(isAsync(function() {}), false);
});
});
describe('Async Function', () => {
it('true', () => {
assert.equal(isAsync(async function() {}), true);
});
});
describe('Class', () => {
it('false', () => {
assert.equal(isAsync(class {}), false);
});
});
describe('Arrow Function', () => {
it('false', () => {
assert.equal(isAsync(() => {}), false);
});
});
describe('Async Arrow Function', () => {
it('true', () => {
assert.equal(isAsync(async () => {}), true);
});
});
describe('Number', () => {
it('false', () => {
assert.equal(isAsync(123), false);
});
});
describe('Object', () => {
it('false', () => {
assert.equal(isAsync({}), false);
});
});
describe('Array', () => {
it('false', () => {
assert.equal(isAsync([]), false);
});
});
});