From 064d950f87f86b10f205f8ddfc0487e4aafcda50 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Tue, 7 Jun 2016 16:00:02 -0700 Subject: [PATCH] add new tests for field validation --- src/routes/test/apps-test.js | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/routes/test/apps-test.js b/src/routes/test/apps-test.js index 01f2cd0aa..028d8e4a7 100644 --- a/src/routes/test/apps-test.js +++ b/src/routes/test/apps-test.js @@ -229,6 +229,39 @@ describe('Apps', function () { }); }); + it('app install fails - null manifest', function (done) { + superagent.post(SERVER_URL + '/api/v1/apps/install') + .query({ access_token: token }) + .send({ manifest: null, password: PASSWORD }) + .end(function (err, res) { + expect(res.statusCode).to.equal(400); + expect(res.body.message).to.eql('appStoreId or manifest is required'); + done(); + }); + }); + + it('app install fails - bad manifest format', function (done) { + superagent.post(SERVER_URL + '/api/v1/apps/install') + .query({ access_token: token }) + .send({ manifest: 'epic', password: PASSWORD }) + .end(function (err, res) { + expect(res.statusCode).to.equal(400); + expect(res.body.message).to.eql('manifest must be an object'); + done(); + }); + }); + + it('app install fails - empty appStoreId format', function (done) { + superagent.post(SERVER_URL + '/api/v1/apps/install') + .query({ access_token: token }) + .send({ manifest: null, appStoreId: '', password: PASSWORD }) + .end(function (err, res) { + expect(res.statusCode).to.equal(400); + expect(res.body.message).to.eql('appStoreId or manifest is required'); + done(); + }); + }); + it('app install fails - invalid json', function (done) { superagent.post(SERVER_URL + '/api/v1/apps/install') .query({ access_token: token })