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

Issues with looping over HTTP endpoints? #21

Closed
selenium-tester opened this issue Mar 18, 2017 · 3 comments
Closed

Issues with looping over HTTP endpoints? #21

selenium-tester opened this issue Mar 18, 2017 · 3 comments
Assignees
Labels

Comments

@selenium-tester
Copy link

Thank you for the great module. I wish more JS frameworks had better support for this kind of testing natively.

I am trying out this module with some basic HTTP endpoint tests and running into some trouble:

Node: 6.10.0
OS: MacOS (Darwin) 10.12.3
Ava: 0.18.2
Got: 6.7.0
Unroll: 1.2.0

import test from 'ava';
import got from 'got';
import unroll from 'unroll';
import URLFactory from '../../helpers/lib/URLFactory';

unroll.use(test);

test('This test will correctly fail', async t =>
{
    await got('http://127.0.0.1:8000/account/')
        .then(response =>
        {
            console.log(response.body);

            t.is(response.statusCode, 400)
        });
});


unroll('This test for #description should also fail but does not', async function (t, testArgs)
{
    await got('http://127.0.0.1:8000' + testArgs.input) // This is the exact same URL
        .then(response =>
        {
            console.log(response.body); // Exact same console output

            t.is(response.statusCode, testArgs.moo); // Exact same assertion
        })
},
[
    ["description", "input", "moo"],
    ["/account", URLFactory.accountEndPoint(), 400]
]);

The first test using Ava directly fails as expected, and passes as expected if I change 400 to 200.

The test using Unroll always shows as passed, even though I am purposefully attempting to make it fail.

Initially I was using supertest, and I thought perhaps I had found a bug there, but I swapped out the library for got and can replicate the same behavior, so I'm wondering if maybe there is an issue with Unroll and the current version of Ava.

Thanks again for your hard work, and please let me know if you see anything I am missing.

@lawrencec
Copy link
Owner

Sorry for the delay, @selenium-tester, I've only just seen this. I'm hoping to have a bit of time of the next few days to take a look at this.

@lawrencec
Copy link
Owner

@selenium-tester Sorry for the delay in looking at this. This should be fixed in the latest release 1.2.2.

@selenium-tester
Copy link
Author

That is great, thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants