Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

supertest

Package Overview
Dependencies
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

supertest - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

test/fixtures/test_cert.pem

5

History.md
0.3.0 / 2012-09-24
==================
* add `https.Server` support [fengmk2]
0.2.0 / 2012-08-29

@@ -3,0 +8,0 @@ ==================

6

lib/test.js

@@ -9,2 +9,3 @@

, http = require('http')
, https = require('https')
, assert = require('assert')

@@ -43,3 +44,4 @@ , Request = request.Request;

if (!addr) app.listen(portno);
this.url = 'http://127.0.0.1:' + portno + path;
var protocol = app instanceof https.Server ? 'https' : 'http';
this.url = protocol + '://127.0.0.1:' + portno + path;
}

@@ -79,3 +81,3 @@

// body
if (b && 'function' != typeof b) this._body = b;
if ('function' != typeof b) this._body = b;
return this;

@@ -82,0 +84,0 @@ }

{
"name": "supertest",
"version": "0.2.0",
"version": "0.3.0",
"description": "Super-agent driven library for testing HTTP servers",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -1,2 +0,1 @@

# SuperTest

@@ -21,3 +20,3 @@

```js
var request = require('./')
var request = require('supertest')
, express = require('express');

@@ -89,2 +88,10 @@

Perform the request and invoke `fn(err, res)`.
Perform the request and invoke `fn(err, res)`.
## Notes
Inspired by [api-easy](https://github.com/flatiron/api-easy) minus vows coupling.
## License
MIT
var request = require('..')
, https = require('https')
, fs = require('fs')
, path = require('path')
, express = require('express');

@@ -40,2 +43,24 @@

it('should work with a https server', function(done){
var app = express();
app.get('/', function(req, res){
res.send('hey');
});
var fixtures = path.join(__dirname, 'fixtures');
var server = https.createServer({
key: fs.readFileSync(path.join(fixtures, 'test_key.pem')),
cert: fs.readFileSync(path.join(fixtures, 'test_cert.pem'))
}, app);
request(server)
.get('/')
.end(function(err, res){
res.should.have.status(200);
res.text.should.equal('hey');
done();
});
})
it('should work with .send() etc', function(done){

@@ -97,3 +122,21 @@ var app = express();

.expect(200, 'foo', done)
})
});
describe("when the body argument is an empty string", function() {
it("should not quietly pass on failure", function(done) {
var app = express();
app.get('/', function(req, res){
res.send('foo');
});
request(app)
.get('/')
.expect(200, '')
.end(function(err, res){
err.message.should.equal('expected \'\' response body, got \'foo\'');
done();
});
});
});
})

@@ -236,2 +279,2 @@

})
})
})
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc