dimanche 5 mars 2017

Supertest PUT-method

How do I test the PUT-method with SuperTest? All I get is "404 Not found" as response.

The request:

router.put('/', function (req, res) {
    res.type('json');

    FooResource(req.body, function () {
        res.send("{}");
    });
});

The test

describe("PUT /foo/fii", function () {

    it("Respond with 200", function (done) {

        request(app)
            .put('/')
            .set('Accept', 'application/json')
            .expect(200, done);

    });
});

Can you even test PUT-methods with the supertest? If you can, how do you do it?

Aucun commentaire:

Enregistrer un commentaire