From 314071d79f83405cc4442905deef472d285361ea Mon Sep 17 00:00:00 2001 From: Shelley Vohr Date: Mon, 18 Jun 2018 08:12:54 -0700 Subject: [PATCH] feedback from review --- spec/api-desktop-capturer-spec.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/spec/api-desktop-capturer-spec.js b/spec/api-desktop-capturer-spec.js index 93e370b52a84..19f06182b070 100644 --- a/spec/api-desktop-capturer-spec.js +++ b/spec/api-desktop-capturer-spec.js @@ -26,7 +26,7 @@ describe('desktopCapturer', () => { types: ['window', 'screen'] }, (error, sources) => { expect(error).to.be.null() - expect(sources.length).to.not.equal(0) + expect(sources).to.be.an('array').that.is.not.empty() done() }) }) @@ -43,7 +43,7 @@ describe('desktopCapturer', () => { const callback = (error, sources) => { callCount++ expect(error).to.be.null() - expect(sources.length).to.not.equal(0) + expect(sources).to.be.an('array').that.is.not.empty() if (callCount === 2) done() } @@ -71,10 +71,10 @@ describe('desktopCapturer', () => { desktopCapturer.getSources({types: ['window']}, (error, sources) => { expect(error).to.be.null() - expect(sources.length).to.not.equal(0) - sources.forEach((source) => { - expect(source.display_id.length).to.equal(0) - }) + expect(sources).to.be.an('array').that.is.not.empty() + for (const {display_id: displayId} of sources) { + expect(displayId).to.be.a('string').and.be.empty() + } done() }) }) @@ -87,8 +87,7 @@ describe('desktopCapturer', () => { const displays = screen.getAllDisplays() desktopCapturer.getSources({types: ['screen']}, (error, sources) => { expect(error).to.be.null() - expect(sources.length).to.not.equal(0) - expect(sources.length).to.equal(displays.length) + expect(sources).to.be.an('array').of.length(displays.length) for (let i = 0; i < sources.length; i++) { expect(sources[i].display_id).to.equal(displays[i].id.toString())