From e7bb724e5f213281970b10e456c7866a1c0e9c28 Mon Sep 17 00:00:00 2001 From: bill bittner Date: Thu, 21 Dec 2017 09:37:22 -0800 Subject: [PATCH 1/2] added an in-channel publish test --- test/end-to-end/end-to-end.tests.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/test/end-to-end/end-to-end.tests.js b/test/end-to-end/end-to-end.tests.js index d26d5853..5244cf35 100644 --- a/test/end-to-end/end-to-end.tests.js +++ b/test/end-to-end/end-to-end.tests.js @@ -88,9 +88,11 @@ describe('end-to-end', function () { const name = `test-publish-${date.getFullYear()}-${date.getMonth()}-${date.getDate()}-${date.getTime()}`; const filePath = './test/mock-data/bird.jpeg'; const fileName = 'byrd.jpeg'; + const channelName = '@testpublishchannel'; + const channelPassword = 'password'; describe(publishUrl, function () { - it(`should receive a status code 200 within ${publishTimeout}ms @usesLbc`, function (done) { + it(`non-channel publishes should receive a status code 200 within ${publishTimeout}ms @usesLbc`, function (done) { chai.request(host) .post(publishUrl) .type('form') @@ -104,6 +106,23 @@ describe('end-to-end', function () { }).timeout(publishTimeout); }); + describe(publishUrl, function () { + it(`channel publishes should receive a status code 200 within ${publishTimeout}ms @usesLbc`, function (done) { + chai.request(host) + .post(publishUrl) + .type('form') + .attach('file', fs.readFileSync(filePath), fileName) + .field('name', name) + .field('channelName', channelName) + .field('channelPassword', channelPassword) + .end(function (err, res) { + // expect(err).to.be.null; + expect(res).to.have.status(200); + done(); + }); + }).timeout(publishTimeout); + }); + }); From 00108aebb85fc5dbb601bd1a8a7eb21edc638918 Mon Sep 17 00:00:00 2001 From: bill bittner Date: Thu, 21 Dec 2017 09:46:46 -0800 Subject: [PATCH 2/2] moved test channel & password to config file --- config/speechConfig.js.example | 4 ++++ test/end-to-end/end-to-end.tests.js | 8 +++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/config/speechConfig.js.example b/config/speechConfig.js.example index 6782712e..904db832 100644 --- a/config/speechConfig.js.example +++ b/config/speechConfig.js.example @@ -31,4 +31,8 @@ module.exports = { defaultThumbnail : 'https://spee.ch/assets/img/video_thumb_default.png', defaultDescription: 'Open-source, decentralized image and video sharing.', }, + testing: { + testChannel : '@testpublishchannel', // a channel to make test publishes in + testChannelPassword: 'password', // password for the test channel + }, }; diff --git a/test/end-to-end/end-to-end.tests.js b/test/end-to-end/end-to-end.tests.js index 5244cf35..826eb4ca 100644 --- a/test/end-to-end/end-to-end.tests.js +++ b/test/end-to-end/end-to-end.tests.js @@ -1,7 +1,9 @@ const chai = require('chai'); const expect = chai.expect; const chaiHttp = require('chai-http'); -const { host } = require('../../config/speechConfig.js').site; +const { site, testing } = require('../../config/speechConfig.js'); +const { host } = site; +const { testChannel, testChannelPassword } = testing; const requestTimeout = 20000; const publishTimeout = 120000; const fs = require('fs'); @@ -88,8 +90,8 @@ describe('end-to-end', function () { const name = `test-publish-${date.getFullYear()}-${date.getMonth()}-${date.getDate()}-${date.getTime()}`; const filePath = './test/mock-data/bird.jpeg'; const fileName = 'byrd.jpeg'; - const channelName = '@testpublishchannel'; - const channelPassword = 'password'; + const channelName = testChannel; + const channelPassword = testChannelPassword; describe(publishUrl, function () { it(`non-channel publishes should receive a status code 200 within ${publishTimeout}ms @usesLbc`, function (done) {