Skip to content

Commit 88794ec

Browse files
author
James Halliday
committed
update test to scope properly
1 parent 3314ec5 commit 88794ec

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

test/request_url.js

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
1-
global.window = {
2-
location: {
1+
global.window = global;
2+
global.location = {
33
host: 'localhost:8081',
44
port: 8081,
55
protocol: 'http:'
6-
}
76
};
87

98
var noop = function() {};
10-
global.window.XMLHttpRequest = function() {
9+
global.XMLHttpRequest = function() {
1110
this.open = noop;
1211
this.send = noop;
1312
};
1413

15-
global.window.FormData = function () {};
16-
global.window.Blob = function () {};
17-
global.window.ArrayBuffer = function () {};
14+
global.FormData = function () {};
15+
global.Blob = function () {};
16+
global.ArrayBuffer = function () {};
1817

1918
var test = require('tape').test;
2019
var http = require('../index.js');
@@ -97,19 +96,19 @@ test('Test POST XHR2 types', function(t) {
9796

9897
var request = http.request({ url: url, method: 'POST' }, noop);
9998
request.xhr.send = function (data) {
100-
t.ok(data instanceof global.window.ArrayBuffer, 'data should be instanceof ArrayBuffer');
99+
t.ok(data instanceof global.ArrayBuffer, 'data should be instanceof ArrayBuffer');
101100
};
102-
request.end(new global.window.ArrayBuffer());
101+
request.end(new global.ArrayBuffer());
103102

104103
request = http.request({ url: url, method: 'POST' }, noop);
105104
request.xhr.send = function (data) {
106-
t.ok(data instanceof global.window.Blob, 'data should be instanceof Blob');
105+
t.ok(data instanceof global.Blob, 'data should be instanceof Blob');
107106
};
108-
request.end(new global.window.Blob());
107+
request.end(new global.Blob());
109108

110109
request = http.request({ url: url, method: 'POST' }, noop);
111110
request.xhr.send = function (data) {
112-
t.ok(data instanceof global.window.FormData, 'data should be instanceof FormData');
111+
t.ok(data instanceof global.FormData, 'data should be instanceof FormData');
113112
};
114-
request.end(new global.window.FormData());
113+
request.end(new global.FormData());
115114
});

0 commit comments

Comments
 (0)