cmorten / superoak

HTTP assertions for Oak made easy via SuperDeno. 🐿 🦕
https://cmorten.github.io/superoak/
MIT License
121 stars 8 forks source link

callback function parameters are displaced. #10

Closed ahgilak closed 3 years ago

ahgilak commented 3 years ago

Issue

Setup:

Callback function parameters are displaced.

Details

I want to use callback function like below but the test fails because res is undefined.

Deno.test("test", async () => {
  const req = await superoak(app);
  await req.post("/").expect((err, res) => {
    expect(res.body.message).toEqual("Hello Deno!");
  });
});

Callback described as CallbackHandler(err: any, res: IResponse): void in typescript autocomplete, but actually the first argument contains response value so it should be CallbackHandler(res: IResponse, err: any): void.

asos-craigmorten commented 3 years ago

@ahgilak thanks for flagging this!

Would this be something that you would be willing to be a put in a pull request to fix? No worries if not! I will endeavour to find some time to take a look 😄

cmorten commented 3 years ago

The issue lies upstream with https://github.com/asos-craigmorten/superdeno which has 🤞 just been fixed, should drop in my PR with an update to dependency versions!