[Pkg-javascript-commits] [node-stream-http] 98/208: Fix tests
Bastien Roucariès
rouca at moszumanska.debian.org
Sun Aug 13 13:39:32 UTC 2017
This is an automated email from the git hooks/post-receive script.
rouca pushed a commit to branch master
in repository node-stream-http.
commit 75817ba930279101ad6df0f15880ee365914208b
Author: John Hiesey <john at hiesey.com>
Date: Tue Sep 15 15:51:19 2015 -0700
Fix tests
---
test/browser/headers.js | 16 +++-------------
1 file changed, 3 insertions(+), 13 deletions(-)
diff --git a/test/browser/headers.js b/test/browser/headers.js
index 02e4ae8..99f8bf8 100644
--- a/test/browser/headers.js
+++ b/test/browser/headers.js
@@ -1,20 +1,10 @@
var Buffer = require('buffer').Buffer
var fs = require('fs')
-var keys = require('object-keys')
var test = require('tape')
var UAParser = require('ua-parser-js')
var http = require('../..')
-function indexOf (arr, item) {
- var len = arr.length
- for (var i = 0; i < len; i++) {
- if (arr[i] === item)
- return i
- }
- return -1
-}
-
test('headers', function (t) {
http.get({
path: '/testHeaders?Response-Header=bar&Response-Header-2=BAR2',
@@ -29,10 +19,10 @@ test('headers', function (t) {
if (lowerKey.indexOf('test-') === 0)
rawHeaders.push(lowerKey, res.rawHeaders[i + 1])
}
- var header1Pos = indexOf(rawHeaders, 'test-response-header')
+ var header1Pos = rawHeaders.indexOf('test-response-header')
t.ok(header1Pos >= 0, 'raw response header 1 present')
t.equal(rawHeaders[header1Pos + 1], 'bar', 'raw response header value 1')
- var header2Pos = indexOf(rawHeaders, 'test-response-header-2')
+ var header2Pos = rawHeaders.indexOf('test-response-header-2')
t.ok(header2Pos >= 0, 'raw response header 2 present')
t.equal(rawHeaders[header2Pos + 1], 'BAR2', 'raw response header value 2')
t.equal(rawHeaders.length, 4, 'correct number of raw headers')
@@ -46,7 +36,7 @@ test('headers', function (t) {
var body = JSON.parse(Buffer.concat(buffers).toString())
t.equal(body['test-request-header'], 'foo', 'request header 1')
t.equal(body['test-request-header-2'], 'FOO2', 'request header 2')
- t.equal(keys(body).length, 2, 'correct number of request headers')
+ t.equal(Object.keys(body).length, 2, 'correct number of request headers')
t.end()
})
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-stream-http.git
More information about the Pkg-javascript-commits
mailing list