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

Extend mocha to enable response re-use in multiple tests #52

Closed
steff-mueller opened this issue Mar 9, 2013 · 1 comment
Closed

Extend mocha to enable response re-use in multiple tests #52

steff-mueller opened this issue Mar 9, 2013 · 1 comment

Comments

@steff-mueller
Copy link
Contributor

I would love to have a short syntax to re-use the response of the previous request in another test case:

describe('ServiceStack hello', function(){
    it.seq('Get some data', function(data, done){
        request('http://localhost')
        .get('/hello')
        .set('Accept', 'application/json')
        .expect({Id: 5})
        .expect(200, done);
    });

    it.seq('Should have data', function(data, done){
        request('http://localhost')
        .get('/hello/' + data.Id) //Use data from previous request
        .set('Accept', 'application/json')
        .expect(200, done);
    });
});

... á la https://github.com/Arxisos/trestle

What do you think about that? Does it make sense to integrate that into supertest or mocha?

@steff-mueller
Copy link
Contributor Author

Ok, I extended https://github.com/Arxisos/trestle and now I don't think anymore that it is a good idea to provide such an easy way to have state in tests.

Therefore I don't propose a PR anymore. The ones who really need state (for acceptance/integration tests) should use a library like mine or implement something themselves.

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

No branches or pull requests

1 participant