Skip to content

Commit

Permalink
Merge pull request #58 from Turistforeningen/feat/endpoint-api
Browse files Browse the repository at this point in the history
Feat/endpoint api
  • Loading branch information
Håvard Ranum authored Sep 22, 2016
2 parents 29e1916 + f19f773 commit 4d2ee07
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ router.use((err, req, res, next) => { // eslint-disable-line no-unused-vars
res.status(err.code).json(err.toJSON());
});

app.use(`/api${process.env.VIRTUAL_PATH}`, router);
app.use(process.env.VIRTUAL_PATH, router);

/* istanbul ignore if */
Expand Down
13 changes: 13 additions & 0 deletions test/acceptance/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,17 @@ describe('GET /', () => {
});
})
));

it('returns API index for new endpoint /api', () => (
app.get(`/api${url}`)
.expect(200)
.expect(res => {
assert.equal(typeof res.body.checkin_new.rules, 'object');
assert.equal(typeof res.body.checkin_new.rules.max_distance, 'number');
assert.equal(typeof res.body.checkin_new.rules.quarantine, 'number');
Object.keys(res.body).forEach(key => {
assert.equal(typeof res.body[key].url, 'string');
});
})
));
});

0 comments on commit 4d2ee07

Please sign in to comment.