electron/spec/api-desktop-capturer-spec.js
2016-03-30 17:00:31 -07:00

27 lines
849 B
JavaScript

const assert = require('assert')
const desktopCapturer = require('electron').desktopCapturer
describe('desktopCapturer', function () {
it('should return a non-empty array of sources', function (done) {
desktopCapturer.getSources({
types: ['window', 'screen']
}, function (error, sources) {
assert.equal(error, null)
assert.notEqual(sources.length, 0)
done()
})
})
it('does not throw an error when called more than once (regression)', function (done) {
var callCount = 0
var callback = function (error, sources) {
callCount++
assert.equal(error, null)
assert.notEqual(sources.length, 0)
if (callCount === 2) done()
}
desktopCapturer.getSources({types: ['window', 'screen']}, callback)
desktopCapturer.getSources({types: ['window', 'screen']}, callback)
})
})