2018-09-13 16:10:51 +00:00
|
|
|
const { powerSaveBlocker } = require('electron').remote
|
2018-08-31 20:52:32 +00:00
|
|
|
const chai = require('chai')
|
|
|
|
const dirtyChai = require('dirty-chai')
|
|
|
|
|
2018-09-13 16:10:51 +00:00
|
|
|
const { expect } = chai
|
2018-08-31 20:52:32 +00:00
|
|
|
chai.use(dirtyChai)
|
2016-08-09 22:05:56 +00:00
|
|
|
|
|
|
|
describe('powerSaveBlocker module', () => {
|
|
|
|
it('can be started and stopped', () => {
|
2018-08-31 20:52:32 +00:00
|
|
|
expect(powerSaveBlocker.isStarted(-1)).to.be.false()
|
2016-08-09 22:05:56 +00:00
|
|
|
const id = powerSaveBlocker.start('prevent-app-suspension')
|
2018-08-31 20:52:32 +00:00
|
|
|
expect(id).to.to.be.a('number')
|
|
|
|
expect(powerSaveBlocker.isStarted(id)).to.be.true()
|
2016-08-09 22:05:56 +00:00
|
|
|
powerSaveBlocker.stop(id)
|
2018-08-31 20:52:32 +00:00
|
|
|
expect(powerSaveBlocker.isStarted(id)).to.be.false()
|
2016-08-09 22:05:56 +00:00
|
|
|
})
|
|
|
|
})
|