-
-
Notifications
You must be signed in to change notification settings - Fork 169
/
test.js
40 lines (34 loc) · 876 Bytes
/
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
import {inspect} from 'node:util';
import test from 'ava';
import {
activeWindow,
activeWindowSync,
openWindows,
openWindowsSync,
} from './index.js';
function asserter(t, result) {
t.log(inspect(result));
t.is(typeof result, 'object');
t.is(typeof result.title, 'string');
t.is(typeof result.id, 'number');
t.is(typeof result.owner, 'object');
t.is(typeof result.owner.name, 'string');
}
function asserterOpenWindows(t, result) {
t.log(inspect(result));
t.is(typeof result, 'object');
t.is(typeof result.length, 'number');
asserter(t, result[0]);
}
test('activeWindow', async t => {
asserter(t, await activeWindow());
});
test('activeWindowSync', t => {
asserter(t, activeWindowSync());
});
test('openWindows', async t => {
asserterOpenWindows(t, await openWindows());
});
test('openWindowsSync', t => {
asserterOpenWindows(t, openWindowsSync());
});