How to use the supertest.get function in supertest

To help you get started, we’ve selected a few supertest examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github arrowjs / ArrowjsCore / test / application.js View on Github external
it("Render view with application.render", function (done) {
            request.get("/applicationRender")
                .expect(200)
                .end(function (err, res) {
                    done();
                })
        })
    });
github backstopmedia / bleeding-edge-sample-app / test / server / routing_spec.js View on Github external
it("should render a 404 page for an invalid route", function(done){
      request.get('/not-found-route')
      .expect(404)
      .end(function (err, res) {
        var doc = cheerio.load(res.text);
        expect(doc("body").html()).toContain("The Page you were looking for isn't here!");
        done();
      });      
  });
});
github arrowjs / ArrowjsCore / test / application.js View on Github external
it('Logout with req.logout', function (done) {
            request.get("/logout")
                .expect(302, done);
        })
    });
github kissio / kiss.io / test / socket.io.js View on Github external
it('should allow request when origin defined as function and no origin is supplied', function(done) {
      var sockets = io({ origins: function(origin,callback){
        if (origin == '*') {
          return callback(null, true);
        }
        return callback(null, false);
      } }).listen('54021');
      request.get('http://localhost:54021/socket.io/default/')
       .query({ transport: 'polling' })
       .end(function (err, res) {
          expect(res.status).to.be(200);
          done();
        });
    });
github hpcloud / npm-lazy-mirror / test / runner.js View on Github external
it('returns a random module metadata', function(done) {
        request.get('/' + randomModule)
        .expect(200, done);
    });
});
github polonel / trudesk / test / api / users.js View on Github external
it('should return a user', function (done) {
    request
      .get('/api/v1/users/trudesk')
      .set('accesstoken', tdapikey)
      .set('Accept', 'application/json')
      .expect(function (res) {
        if (res.body.user.username !== 'trudesk') throw new Error('Invalid User')
      })
      .expect(200, done)
  })
github kissio / kiss.io / test / socket.io.js View on Github external
it('should allow request when origin defined as function and different is supplied', function(done) {
      var sockets = io({ origins: function(origin,callback){
        if (origin == 'http://foo.example') {
          return callback(null, true);
        }
        return callback(null, false);
      } }).listen('54017');
      request.get('http://localhost:54017/socket.io/default/')
       .set('origin', 'http://herp.derp')
       .query({ transport: 'polling' })
       .end(function (err, res) {
          expect(res.status).to.be(400);
          done();
        });
    });
github hpcloud / npm-lazy-mirror / test / runner.js View on Github external
it('404 response on non-existing tarball', function(done) {
        request.get('/multiparty/-/multiparty-2.222.0.tgz')
        .expect(404, done);
    });
});
github hpcloud / npm-lazy-mirror / test / runner.js View on Github external
it('respond with json', function(done) {
        request.get('/')
        .set('Accept', 'application/json')
        .expect(200)
        .expect(/registry/, done);
    });
});
github PencilCode / dynamic.io / test / socket.io.js View on Github external
it('should disallow request when origin defined and none specified', function(done) {
      var sockets = io({ origins: 'http://foo.example:*' }).listen('54013');
      request.get('http://localhost:54013/socket.io/default/')
       .query({ transport: 'polling' })
       .end(function (err, res) {
          expect(res.status).to.be(400);
          done();
        });
    });

supertest

SuperAgent driven library for testing HTTP servers

MIT
Latest version published 16 days ago

Package Health Score

91 / 100
Full package analysis