Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: fix tests to match new documentation (#967) #1

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/application/use.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ describe('app.use(fn)', () => {
it('should catch thrown errors in non-async functions', () => {
const app = new Koa();

app.use(ctx => ctx.throw('Not Found', 404));
app.use(ctx => ctx.throw(404, 'Not Found'));

return request(app.listen())
.get('/')
Expand Down
4 changes: 2 additions & 2 deletions test/context/throw.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('ctx.throw(err, status)', () => {
const error = new Error('test');

try {
ctx.throw(error, 422);
ctx.throw(422, error);
} catch (err) {
assert.equal(err.status, 422);
assert.equal(err.message, 'test');
Expand Down Expand Up @@ -67,7 +67,7 @@ describe('ctx.throw(msg, status)', () => {
const ctx = context();

try {
ctx.throw('name required', 400);
ctx.throw(400, 'name required');
} catch (err) {
assert.equal(err.message, 'name required');
assert.equal(err.status, 400);
Expand Down