Migrate from koa-route to koa-router
This commit is contained in:
parent
8474cca94c
commit
a4bf3dd51d
17 changed files with 206 additions and 291 deletions
|
@ -1,6 +1,6 @@
|
|||
import assert from 'assert';
|
||||
import { agent } from 'supertest';
|
||||
import app from '../../api/app';
|
||||
import app from '../../app';
|
||||
|
||||
const request = agent(app.listen());
|
||||
|
||||
|
@ -11,7 +11,7 @@ describe('hostr-api file', function() {
|
|||
describe('when GET /file', function() {
|
||||
it('should receive a list of file objects', function(done) {
|
||||
request
|
||||
.get('/file')
|
||||
.get('/api/file')
|
||||
.auth('test@hostr.co', 'test-password')
|
||||
.expect(200)
|
||||
.expect(function(response) {
|
||||
|
@ -25,7 +25,7 @@ describe('hostr-api file', function() {
|
|||
it('should receive a new file object', function(done) {
|
||||
this.timeout(30000);
|
||||
request
|
||||
.post('/file')
|
||||
.post('/api/file')
|
||||
.attach('file', 'test/fixtures/utah-arches.jpg')
|
||||
.auth('test@hostr.co', 'test-password')
|
||||
.expect(201)
|
||||
|
@ -40,7 +40,7 @@ describe('hostr-api file', function() {
|
|||
describe('when GET /file/:id', function() {
|
||||
it('should receive the file object', function(done) {
|
||||
request
|
||||
.get('/file/' + id)
|
||||
.get('/api/file/' + id)
|
||||
.expect(200)
|
||||
.expect(function(response) {
|
||||
assert(response.body.name === 'utah-arches.jpg');
|
||||
|
@ -52,16 +52,16 @@ describe('hostr-api file', function() {
|
|||
describe('when DELETE /file/:id', function() {
|
||||
it('should delete the file object', function(done) {
|
||||
request
|
||||
.delete('/file/' + id)
|
||||
.delete('/api/file/' + id)
|
||||
.auth('test@hostr.co', 'test-password')
|
||||
.expect(200, done);
|
||||
.expect(204, done);
|
||||
});
|
||||
});
|
||||
|
||||
describe('when GET deleted /file/:id', function() {
|
||||
it('should not receive the file object', function(done) {
|
||||
request
|
||||
.get('/file/' + id)
|
||||
.get('/api/file/' + id)
|
||||
.expect(404, done);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue