diff options
author | Matthieu Aubry <mattab@users.noreply.github.com> | 2017-04-26 09:52:46 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-26 09:52:46 +0300 |
commit | 317700513cc732bb2371edbe645555feadbbc545 (patch) | |
tree | efc28c578903563cd72d8436dbefcec32ab161c7 /tests/lib/mocha-3.1.0/test/http-meta.spec.js | |
parent | bc8222d451337185db343486319af6782b009148 (diff) | |
parent | 199e43ef5809d09803416db72ce0ace6c9a4d895 (diff) |
Merge pull request #11651 from piwik/3.x-dev3.0.4-b1
Release Piwik 3.0.4-b1
Diffstat (limited to 'tests/lib/mocha-3.1.0/test/http-meta.spec.js')
-rw-r--r-- | tests/lib/mocha-3.1.0/test/http-meta.spec.js | 61 |
1 files changed, 0 insertions, 61 deletions
diff --git a/tests/lib/mocha-3.1.0/test/http-meta.spec.js b/tests/lib/mocha-3.1.0/test/http-meta.spec.js deleted file mode 100644 index 5d1fb6750b..0000000000 --- a/tests/lib/mocha-3.1.0/test/http-meta.spec.js +++ /dev/null @@ -1,61 +0,0 @@ -var http = require('http'); - -var PORT = 8889; - -var server = http.createServer(function(req, res){ - var accept = req.headers.accept || '' - , json = ~accept.indexOf('json'); - - switch (req.url) { - case '/': - res.end('hello'); - break; - case '/users': - if (json) { - res.end('["tobi","loki","jane"]'); - } else { - res.end('tobi, loki, jane'); - } - break; - } -}); - - -function get(url, body, header) { - return function(done){ - http.get({ path: url, port: PORT, headers: header || {}}, function(res){ - var buf = ''; - res.should.have.property('statusCode', 200); - res.setEncoding('utf8'); - res.on('data', function(chunk){ buf += chunk }); - res.on('end', function(){ - buf.should.equal(body); - done(); - }); - }) - } -} - -describe('http requests', function () { - - before(function(done) { - server.listen(PORT, done); - }); - - after(function() { - server.close(); - }); - - describe('GET /', function () { - it('should respond with hello', - get('/', 'hello')) - }) - - describe('GET /users', function(){ - it('should respond with users', - get('/users', 'tobi, loki, jane')) - - it('should respond with users', - get('/users', '["tobi","loki","jane"]', { Accept: 'application/json' })) - }) -}) |