1
0
mirror of https://github.com/stolksdorf/homebrewery.git synced 2025-12-22 02:11:29 +00:00

Added tests for admin routes, lookup is working

This commit is contained in:
Scott Tolksdorf
2017-01-10 14:44:48 -05:00
parent cd2eb5fdce
commit e77532acef
3 changed files with 96 additions and 13 deletions

View File

@@ -105,8 +105,8 @@ describe('Middleware', () => {
it('should detect when you use the admin key', () => {
app.use(mw.admin);
app.use(requestHandler)
return request(app).get(`/?admin_key=${config.get('admin:key')}`)
.send()
return request(app).get('/')
.query({ admin_key : config.get('admin:key') })
.expect(200)
.then((res) => {
const req = res.body;
@@ -118,7 +118,8 @@ describe('Middleware', () => {
app.use(mw.adminOnly);
app.get(requestHandler);
app.use(Error.expressHandler);
return request(app).get(`/?admin_key=BADKEY`)
return request(app).get('/')
.query({ admin_key : 'BADUSER' })
.send()
.expect(401);
});