Skip to content

Commit

Permalink
fix(app): do not save empty app URL
Browse files Browse the repository at this point in the history
  • Loading branch information
Hans Kristian Flaatten committed Jul 22, 2016
1 parent bb4bb7c commit db3362c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 4 additions & 4 deletions apps/app/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ route.get('/new', (req, res) => {
route.post('/new', (req, res, next) => {
const app = req.api.apps.create({
name: req.body.name,
url: req.body.url,
url: req.body.url || undefined,
desc: req.body.desc,
active: req.api.apps.length < APPS_FREE,
approved: req.api.apps.length < APPS_FREE,
Expand Down Expand Up @@ -149,9 +149,9 @@ route.param('id', (req, res, next, id) => {
});

route.post('/:id', (req, res, next) => {
req.app.name = req.body.name;
req.app.url = req.body.url;
req.app.desc = req.body.desc;
req.app.set('name', req.body.name);
req.app.set('url', req.body.url || undefined);
req.app.set('desc', req.body.desc);

// Prod rate-limit change request
if (parseInt(req.body.limit_prod, 10) !== req.app.limit.prod) {
Expand Down
6 changes: 5 additions & 1 deletion test/acceptance/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ describe('POST /app/:id', () => {
.expect('x-app-message', 'app_not_found', done);
});

it.skip('returns error for non-owner app id');
it('returns error for non-owner app id');

it('returns error for missing app name', done => {
delete data.name;
Expand Down Expand Up @@ -146,6 +146,8 @@ describe('POST /app/:id', () => {
});
});

it('does not save empty app url');

it('saves new rate limits as request', done => {
data.limit_prod = 111;
data.limit_dev = 222;
Expand Down Expand Up @@ -212,6 +214,8 @@ describe('GET /app/new', () => {
.expect(/Registrer ny applikasjon/, done);
});

it('does not save empty app url');

it('warns about app approval limit', done => {
req.get(url)
.set('Cookie', process.env.USER_WITH_APPS_COOKIE)
Expand Down

0 comments on commit db3362c

Please sign in to comment.