forked from sindresorhus/get-windows
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
35 lines (29 loc) · 894 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
import {inspect} from 'node:util';
import test from 'ava';
import activeWindow 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 asserterGetOpenWindows(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('activeWindow.sync', t => {
asserter(t, activeWindow.sync());
});
test('activeWindow.getOpenWindows', async t => {
asserterGetOpenWindows(t, await activeWindow.getOpenWindows());
});
test('activeWindow.getOpenWindowsSync', t => {
asserterGetOpenWindows(t, activeWindow.getOpenWindowsSync());
});