☕️ Classic, reliable, trusted test framework for Node.js and the browser
Added meta http example
Tj Holowaychukd5119268af52
diff --git a/test/unit/http.meta.js b/test/unit/http.meta.jsnew file mode 100644index 00000000..7af8657f--- /dev/null+++ b/test/unit/http.meta.js@@ -0,0 +1,40 @@++var http = require('http');++var server = http.createServer(function(req, res){+ switch (req.url) {+ case '/':+ res.end('hello');+ break;+ case '/users':+ res.end('tobi, loki, jane');+ break;+ }+})++server.listen(8889);++function get(url, body) {+ return function(done){+ http.get({ path: url, port: 8889 }, function(res){+ var buf = '';+ res.statusCode.should.equal(200);+ res.setEncoding('utf8');+ res.on('data', function(chunk){ buf += chunk });+ res.on('end', function(){+ buf.should.equal(body);+ done();+ });+ })+ }+}++describe('http', function(){+ describe('GET /', function(){+ it('should respond with hello', get('/', 'hello'))+ })++ describe('GET /users', function(){+ it('should respond with users', get('/users', 'tobi, loki, jane'))+ })+})\ No newline at end of file