fix(tests): simplify tests

This commit is contained in:
Alexey Kasyanchuk
2018-06-30 01:54:38 +03:00
parent 72828b860f
commit 8dc7cfecf9
8 changed files with 28 additions and 72 deletions

View File

@ -1,7 +1,7 @@
import electron from "electron";
import { Application } from "spectron";
const beforeEach = function() {
const startApplication = function() {
this.timeout(30000);
this.app = new Application({
path: electron,
@ -13,7 +13,7 @@ const beforeEach = function() {
return this.app.start();
};
const afterEach = function() {
const stopApplication = function() {
this.timeout(30000);
if (this.app && this.app.isRunning()) {
return this.app.stop();
@ -21,7 +21,7 @@ const afterEach = function() {
return undefined;
};
export default {
beforeEach,
afterEach
export {
startApplication,
stopApplication
};

View File

@ -1,12 +0,0 @@
import { expect } from "chai";
import testUtils from "./utils";
describe("application launch", () => {
before(testUtils.beforeEach);
after(testUtils.afterEach);
it("index page loaded", async function() {
const { app } = this
await app.client.waitForExist('#index-window')
});
});

View File

@ -2,20 +2,10 @@ const expect = (is) => {
if(!is)
throw new Error('expected not done');
}
import testUtils from "./utils";
const {pool} = require('../src/background/mysql')
const forBigTable = require('../src/background/forBigTable')
describe("big table for check", () => {
before(testUtils.beforeEach);
after(testUtils.afterEach);
it("runned", async function() {
const { app } = this
await app.client.waitForExist('#index-window')
});
let sphinx;
it("init", function() {

13
tests/init.js Normal file
View File

@ -0,0 +1,13 @@
import {startApplication, stopApplication} from "../tests/application";
describe("application", () => {
before(startApplication);
after(stopApplication);
it("check start", async function() {
const { app } = this
await app.client.waitForExist('#index-window')
});
//TESTS
});

View File

@ -1,18 +1,9 @@
import { expect } from "chai";
import testUtils from "./utils";
const mysql = require('mysql')
const config = require('../src/background/config')
describe("sphinx", () => {
before(testUtils.beforeEach);
after(testUtils.afterEach);
it("runned", async function() {
const { app } = this
await app.client.waitForExist('#index-window')
});
let sphinx;
it("init", function() {