From 850519114cbb6ca6705bae5c75bd70d485f692af Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Mon, 22 Aug 2016 22:41:05 +1000 Subject: [PATCH] Update tests --- .travis.yml | 4 +-- circle.yml | 4 +-- docker-compose.yml | 4 +-- package.json | 8 ++--- test/electron/webSocketAPI_spec.js | 52 +++++++++++++++--------------- 5 files changed, 36 insertions(+), 36 deletions(-) diff --git a/.travis.yml b/.travis.yml index 84b17e71..ce05c66b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,8 +22,8 @@ script: - npm run test - if [[ $TRAVIS_PULL_REQUEST == "false" ]]; then ./sig/import.sh && npm run make:darwin && node ./sig/publish-mac.js; fi - if [[ $TRAVIS_PULL_REQUEST != "false" ]]; then npm run package:darwin; fi - - npm run test-unit - - npm run test-spec + - npm run test-electron + - npm run test-spectron notifications: webhooks: diff --git a/circle.yml b/circle.yml index 5f713fc4..3c291a50 100644 --- a/circle.yml +++ b/circle.yml @@ -34,8 +34,8 @@ test: parallel: true - case $CIRCLE_NODE_INDEX in 0) npm run make:deb:32 ;; 1) npm run make:deb:64 ;; 2) npm run make:rpm:32 ;; 3) npm run make:rpm:64 ;; esac: parallel: true - - npm run test-unit - - case $CIRCLE_NODE_INDEX in 0) npm -v ;; 1) npm run test-spec ;; 2) npm -v ;; 3) npm run test-spec ;; esac: + - npm run test-electron + - case $CIRCLE_NODE_INDEX in 0) npm -v ;; 1) npm run test-spectron ;; 2) npm -v ;; 3) npm run test-spectron ;; esac: parallel: true general: diff --git a/docker-compose.yml b/docker-compose.yml index 9ae6d72d..53bb6f0f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,7 +3,7 @@ version: '2' services: test-runner: build: . - command: npm run test-unit + command: npm run test-electron volumes: - .:/test-output environment: @@ -11,7 +11,7 @@ services: spec-runner: build: . - command: npm run test-spec + command: npm run test-spectron volumes: - .:/test-output environment: diff --git a/package.json b/package.json index 80337411..e37e07b9 100644 --- a/package.json +++ b/package.json @@ -25,10 +25,10 @@ "package:win": "gulp package:win", "postinstall": "node vendor/rebuild.js --instant", "test": "npm run lint", - "pretest-unit": "npm run build", - "pretest-spec": "npm run build", - "test-unit": "electron-mocha ./test/electron --recursive --compilers js:babel-core/register --timeout 10000 -R spec-xunit-file", - "test-spec": "mocha ./test/spectron --compilers js:babel-core/register -R spec-xunit-file --timeout 10000", + "pretest-electron": "npm run build", + "pretest-spectron": "npm run build", + "test-electron": "electron-mocha ./test/electron --recursive --compilers js:babel-core/register --timeout 10000 -R spec-xunit-file", + "test-spectron": "mocha ./test/spectron --compilers js:babel-core/register -R spec-xunit-file --timeout 10000", "prestart": "pre-flight && node vendor/mac_patch_dev.js", "start": "electron . --dev", "watch": "gulp watch" diff --git a/test/electron/webSocketAPI_spec.js b/test/electron/webSocketAPI_spec.js index 5fc8568f..d9a8057b 100644 --- a/test/electron/webSocketAPI_spec.js +++ b/test/electron/webSocketAPI_spec.js @@ -81,13 +81,13 @@ describe('WebSocketAPI', () => { spy.getCall(1).args[0].channel.should.be.equal('playState'); spy.getCall(2).args[0].channel.should.be.equal('shuffle'); spy.getCall(3).args[0].channel.should.be.equal('repeat'); - spy.getCall(4).args[0].channel.should.be.equal('playlists'); - spy.getCall(5).args[0].channel.should.be.equal('queue'); - spy.getCall(6).args[0].channel.should.be.equal('search-results'); - spy.getCall(7).args[0].channel.should.be.equal('library'); - spy.getCall(8).args[0].channel.should.be.equal('track'); - spy.getCall(9).args[0].channel.should.be.equal('time'); - spy.getCall(10).args[0].channel.should.be.equal('lyrics'); + spy.getCall(4).args[0].channel.should.be.equal('queue'); + spy.getCall(5).args[0].channel.should.be.equal('search-results'); + spy.getCall(6).args[0].channel.should.be.equal('track'); + spy.getCall(7).args[0].channel.should.be.equal('time'); + spy.getCall(8).args[0].channel.should.be.equal('lyrics'); + spy.getCall(9).args[0].channel.should.be.equal('playlists'); + spy.getCall(10).args[0].channel.should.be.equal('library'); done(); })); @@ -99,37 +99,37 @@ describe('WebSocketAPI', () => { spy.getCall(2).args[0].payload.should.be.equal('NO_SHUFFLE'); // repeat spy.getCall(3).args[0].payload.should.be.equal('NO_REPEAT'); - // playlists - spy.getCall(4).args[0].payload.should.be.deep.equal([]); // queue - spy.getCall(5).args[0].payload.should.be.deep.equal([]); + spy.getCall(4).args[0].payload.should.be.deep.equal([]); // search-results - spy.getCall(6).args[0].payload.should.be.deep.equal({ + spy.getCall(5).args[0].payload.should.be.deep.equal({ searchText: '', albums: [], artists: [], tracks: [], }); + // track + spy.getCall(6).args[0].payload.should.have.property('title'); + spy.getCall(6).args[0].payload.should.have.property('artist'); + spy.getCall(6).args[0].payload.should.have.property('album'); + expect(spy.getCall(6).args[0].payload.title).to.be.equal(null); + expect(spy.getCall(6).args[0].payload.artist).to.be.equal(null); + expect(spy.getCall(6).args[0].payload.album).to.be.equal(null); + // time + spy.getCall(7).args[0].payload.should.have.property('current'); + spy.getCall(7).args[0].payload.should.have.property('total'); + spy.getCall(7).args[0].payload.current.should.be.equal(0); + spy.getCall(7).args[0].payload.total.should.be.equal(0); + // lyrics + expect(spy.getCall(8).args[0].payload).to.be.equal(null); + // playlists + spy.getCall(9).args[0].payload.should.be.deep.equal([]); // library - spy.getCall(7).args[0].payload.should.be.deep.equal({ + spy.getCall(10).args[0].payload.should.be.deep.equal({ albums: [], artists: [], tracks: [], }); - // track - spy.getCall(8).args[0].payload.should.have.property('title'); - spy.getCall(8).args[0].payload.should.have.property('artist'); - spy.getCall(8).args[0].payload.should.have.property('album'); - expect(spy.getCall(8).args[0].payload.title).to.be.equal(null); - expect(spy.getCall(8).args[0].payload.artist).to.be.equal(null); - expect(spy.getCall(8).args[0].payload.album).to.be.equal(null); - // time - spy.getCall(9).args[0].payload.should.have.property('current'); - spy.getCall(9).args[0].payload.should.have.property('total'); - spy.getCall(9).args[0].payload.current.should.be.equal(0); - spy.getCall(9).args[0].payload.total.should.be.equal(0); - // lyrics - expect(spy.getCall(10).args[0].payload).to.be.equal(null); done(); }));