more test cleanup

This commit is contained in:
David Frank 2016-03-19 15:33:13 +08:00
parent 4624f41385
commit c3a4e96a61
1 changed files with 14 additions and 15 deletions

View File

@ -738,25 +738,24 @@ describe('node-fetch', function() {
it('should allow iterating through all headers', function() {
var headers = new Headers({
a: 1,
b: [2, 3],
a: 1
, b: [2, 3]
, c: [4]
});
expect(headers).to.have.property('forEach');
var result = [];
headers.forEach(function(val, key) {
result.push([key, val]);
});
var myHeaders = [];
function callback(value, name) {
myHeaders.push([name, value]);
}
expected = [
["a", "1"],
["b", "2"],
["b", "3"]
["a", "1"]
, ["b", "2"]
, ["b", "3"]
, ["c", "4"]
];
expect(headers.forEach).to.be.defined;
headers.forEach(callback, headers);
expect(myHeaders).to.be.deep.equal(expected);
expect(result).to.be.deep.equal(expected);
});
it('should allow deleting header', function() {