mirror of https://github.com/Kylart/KawAnime.git
Setup chai with mocha
Changed test kawanime directory condition
This commit is contained in:
parent
6a6adeea7d
commit
b5e89c09b9
|
@ -1,6 +1,6 @@
|
||||||
import { app } from 'electron'
|
import { app } from 'electron'
|
||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
|
|
||||||
export default process.env.NODE_ENV !== 'KawAnime-test'
|
export default process.env.IS_TEST !== 'true'
|
||||||
? join(app.getPath('userData'), 'appFiles')
|
? join(app.getPath('userData'), 'appFiles')
|
||||||
: join(app.getPath('home'), '.KawAnime-test')
|
: join(app.getPath('home'), '.KawAnime-test')
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
// const test = require('ava')
|
const { Application } = require('spectron')
|
||||||
|
const electron = require('electron')
|
||||||
|
const chai = require('chai')
|
||||||
|
const chaiAsPromised = require('chai-as-promised')
|
||||||
|
|
||||||
// A simple test to verify a visible window is opened with a title
|
chai.should()
|
||||||
var Application = require('spectron').Application
|
chai.use(chaiAsPromised)
|
||||||
var electron = require('electron')
|
|
||||||
var assert = require('assert')
|
|
||||||
|
|
||||||
describe('Launch app', function () {
|
describe('Launch app', function () {
|
||||||
this.timeout(10000)
|
this.timeout(10000)
|
||||||
|
@ -17,13 +18,25 @@ describe('Launch app', function () {
|
||||||
return this.app.start()
|
return this.app.start()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
beforeEach(function () {
|
||||||
|
chaiAsPromised.transferPromiseness = this.app.transferPromiseness
|
||||||
|
})
|
||||||
|
|
||||||
after(async function () {
|
after(async function () {
|
||||||
this.app.stop()
|
this.app.stop()
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should be visible', async function () {
|
it('should be visible', async function () {
|
||||||
const isVisible = await this.app.browserWindow.isVisible()
|
return this.app.client
|
||||||
|
.getWindowCount()
|
||||||
assert.strictEqual(true, isVisible)
|
.should.eventually.have.at.least(1)
|
||||||
|
.browserWindow.isMinimized()
|
||||||
|
.should.eventually.be.false.browserWindow.isVisible()
|
||||||
|
.should.eventually.be.true.browserWindow.getBounds()
|
||||||
|
.should.eventually.have.property('width')
|
||||||
|
.and.be.above(0)
|
||||||
|
.browserWindow.getBounds()
|
||||||
|
.should.eventually.have.property('height')
|
||||||
|
.and.be.above(0)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue