Skip to content

Commit b0325a8

Browse files
committed
(#17) Removed test code inside electron app
1 parent 7243b0e commit b0325a8

File tree

1 file changed

+1
-30
lines changed
  • test/window-integration-tests

1 file changed

+1
-30
lines changed

test/window-integration-tests/main.js

+1-30
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,6 @@
11
const {app, ipcMain, BrowserWindow} = require('electron')
2-
const libnut = require("../..");
32
const path = require('path');
4-
5-
const POS_X = 50;
6-
const POS_Y = 100;
7-
const WIDTH = 800;
8-
const HEIGTH = 600;
9-
10-
function test(description, assertion) {
11-
console.log(`${description}: ${assertion}`);
12-
if (!assertion) {
13-
app.exit(1);
14-
}
15-
}
3+
const { POS_X, POS_Y, WIDTH, HEIGTH } = require("./constants");
164

175
function createWindow() {
186
const mainWindow = new BrowserWindow({
@@ -25,23 +13,6 @@ function createWindow() {
2513
});
2614
mainWindow.loadFile(path.join(__dirname, "index.html"));
2715
mainWindow.setPosition(POS_X, POS_Y);
28-
29-
setTimeout(() => {
30-
const windowNames = libnut.getWindows().map(
31-
handle => libnut.getWindowTitle(handle)
32-
);
33-
test("list windows", windowNames.includes("libnut window test"));
34-
35-
const activeWindow = libnut.getActiveWindow();
36-
const activeWindowRect = libnut.getWindowRect(activeWindow);
37-
const activeWindowTitle = libnut.getWindowTitle(activeWindow);
38-
test("title", activeWindowTitle === "libnut window test");
39-
test("posX", activeWindowRect.x === POS_X);
40-
test("posY", activeWindowRect.y === POS_Y);
41-
test("width", activeWindowRect.width === WIDTH);
42-
test("height", activeWindowRect.height === HEIGTH);
43-
app.quit();
44-
}, 5000);
4516
}
4617

4718
ipcMain.on("main", (event, args) => {

0 commit comments

Comments
 (0)