Skip to content

Callback being called multiple times in failing controller tests #327

Description

@agilekevin

In several of my tests for at least two different controllers, the callback provided to post is called many times if the test fails.

The console log below appears four times. The first one has a value and the next three are null. The first comparison to 200 fails. If I remove the assertions, the console log appears only once.

this.endpoint('/v1/users/').post( {"email":"foobar@gmail.com","username":"foobar","password":"foobar"}, (status, headers, body, json) => { console.log("[ JSON ]: ", json); expect(status).to.equal(200, JSON.stringify( json )); expect(json.meta.count).to.equal(1); done(); }

I don't see this behavior for another test that only does get requests.

I put in some console logs, and I can see that the endpoint_request.mock is only called once, but the result of the router.prepare and router.dispatch is that the callback is called four times.

I thought it might be a problem in my router.js, but it's pretty vanilla.

Is there some kind of retry logic happening here? Not sure where to look next.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions