-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.test.js
More file actions
51 lines (44 loc) · 1.55 KB
/
Copy pathmain.test.js
File metadata and controls
51 lines (44 loc) · 1.55 KB
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
const gw = require("./main.js");
test("get all active windows", () => {
expect(gw.getAllWindows()).not.toBeNull();
expect(gw.getAllWindows()).not.toBeUndefined();
expect(gw.getAllWindows()) instanceof Array;
for (let window of gw.getAllWindows()) {
expect(window) instanceof gw.BaseWindow;
}
});
test("get all active window titles", () => {
expect(gw.getAllTitles()).not.toBeNull();
expect(gw.getAllTitles()).not.toBeUndefined();
expect(gw.getAllTitles()) instanceof Array;
for (let title of gw.getAllTitles()) {
expect(title) instanceof String;
}
});
test("get active window title", () => {
expect(gw.getActiveWindowTitle()).not.toBeNull();
expect(gw.getActiveWindowTitle()).not.toBeUndefined();
expect(gw.getActiveWindowTitle()) instanceof String;
});
test("get cursor position", () => {
expect(gw.getCursorPosition()).not.toBeNull();
expect(gw.getCursorPosition()).not.toBeUndefined();
expect(gw.getCursorPosition()) instanceof Object;
expect(gw.getCursorPosition().x) instanceof Number;
expect(gw.getCursorPosition().y) instanceof Number;
});
test("get active window", () => {
expect(gw.getActiveWindow()) instanceof gw.BaseWindow;
});
test("get window at position", () => {
expect(gw.getWindowsAt(0, 0)) instanceof Array;
for (let window of gw.getWindowsAt(0, 0)) {
expect(window) instanceof gw.BaseWindow;
}
});
test("get window by title", () => {
expect(gw.getWindowsWithTitle("chrome")) instanceof Array;
for (let window of gw.getWindowsWithTitle("chrome")) {
expect(window) instanceof gw.BaseWindow;
}
});