electron/spec/api-power-save-blocker-spec.js

18 lines
562 B
JavaScript
Raw Normal View History

2016-08-09 22:05:56 +00:00
const {powerSaveBlocker} = require('electron').remote
const chai = require('chai')
const dirtyChai = require('dirty-chai')
const {expect} = chai
chai.use(dirtyChai)
2016-08-09 22:05:56 +00:00
describe('powerSaveBlocker module', () => {
it('can be started and stopped', () => {
expect(powerSaveBlocker.isStarted(-1)).to.be.false()
2016-08-09 22:05:56 +00:00
const id = powerSaveBlocker.start('prevent-app-suspension')
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)
expect(powerSaveBlocker.isStarted(id)).to.be.false()
2016-08-09 22:05:56 +00:00
})
})