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

Weird bug - Put and Post tests showing up as Get #25

Open
pretentiousgit opened this issue Aug 19, 2015 · 5 comments
Open

Weird bug - Put and Post tests showing up as Get #25

pretentiousgit opened this issue Aug 19, 2015 · 5 comments

Comments

@pretentiousgit
Copy link

The test for this looks like this:

    it('should update existing metadata', function(done){
        api.put('/api/participant/'+part2._id)
            .set('x-access-token', apiToken2)
            .send({
                metadata  : [{
                    key   : 'Phone',
                    value : '212-679-4251',
                    group : 'Dental' 
                },
                {
                    key   : 'Name',
                    value : 'Shauna',
                    group : 'Dental'
                }]
            })
            .expect(200)
            .then(function(data){
                expect(data.body.metadata).to.have.length(6)
                done();
            })
    })

And it generates the correct CURL but incorrect tagging and styling:
screen shot 2015-08-19 at 4 38 38 pm

The "it" block is nested within two "describe" blocks - the top one to group general objects, the second to group the verb on that object, in this case "participant CRUD" then "participant PUT." This is an occasional bug - it looks like it just turns up sometimes on large suites.

@rprieto
Copy link
Owner

rprieto commented Aug 20, 2015

Hi, thanks for the detailed report. Definitely a weird bug! Could you use the JSON renderer and post the corresponding section here?

Trying to figure out if it's a problem with the data model, or in the HTML rendering.

@pretentiousgit
Copy link
Author

Looks like it's in the data model - here, from the JSON docs, it thinks the method's a Get.

{
    "name": "should update existing metadata",
    "summary": "should update existing metadata",
    "hierarchy": [
        "Participant CRUD tests",
        "Participant PUT",
        "should update existing metadata"
    ],
    "request": {
        "headers": {
            "x-access-token": "ThisIsAToken",
            "content-type": "application/json",
            "content-length": 119
        },
        "method": "GET",
        "path": "/api/participant/",
        "data": {
            "metadata": []
        }
    }
}

@rprieto
Copy link
Owner

rprieto commented Aug 24, 2015

That's very odd.... I'll try to reproduce it locally.

@pretentiousgit
Copy link
Author

Would nesting a test affect it? Like:

api.put().set().send().then(function(data){
      expect(data.body).this.thing()
      expect(data.body).that.thing()
      api.put().set().send().then(function(data){
          expect(data.body).that.thing()
          done();
      })
})

@rprieto
Copy link
Owner

rprieto commented Aug 25, 2015

Potentially, as supersamples only normally expects 1 call per test (otherwise it wouldn't know which one to extract). But your example in the original message didn't have nesting did it?

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

2 participants