Skip to content

Commit decc98c

Browse files
authored
fix(test/fetch): <getter>.call will always throw (nodejs#1438)
1 parent 1ae6d79 commit decc98c

File tree

3 files changed

+25
-25
lines changed

3 files changed

+25
-25
lines changed

test/fetch/file.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ test('args validation', (t) => {
77
t.plan(14)
88

99
t.throws(() => {
10-
File.prototype.name.call(null)
10+
File.prototype.name.toString()
1111
}, TypeError)
1212
t.throws(() => {
13-
File.prototype.lastModified.call(null)
13+
File.prototype.lastModified.toString()
1414
}, TypeError)
1515
t.doesNotThrow(() => {
1616
File.prototype[Symbol.toStringTag].charAt(0)
@@ -29,16 +29,16 @@ test('args validation', (t) => {
2929
FileLike.prototype.text.call(null)
3030
}, TypeError)
3131
t.throws(() => {
32-
FileLike.prototype.size.call(null)
32+
FileLike.prototype.size.toString()
3333
}, TypeError)
3434
t.throws(() => {
35-
FileLike.prototype.type.call(null)
35+
FileLike.prototype.type.toString()
3636
}, TypeError)
3737
t.throws(() => {
38-
FileLike.prototype.name.call(null)
38+
FileLike.prototype.name.toString()
3939
}, TypeError)
4040
t.throws(() => {
41-
FileLike.prototype.lastModified.call(null)
41+
FileLike.prototype.lastModified.toString()
4242
}, TypeError)
4343
t.doesNotThrow(() => {
4444
FileLike.prototype[Symbol.toStringTag].charAt(0)

test/fetch/request.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -98,51 +98,51 @@ test('arg validation', (t) => {
9898
}, TypeError)
9999

100100
t.throws(() => {
101-
Request.prototype.destination.call(null)
101+
Request.prototype.destination.toString()
102102
}, TypeError)
103103

104104
t.throws(() => {
105-
Request.prototype.referrer.call(null)
105+
Request.prototype.referrer.toString()
106106
}, TypeError)
107107

108108
t.throws(() => {
109-
Request.prototype.referrerPolicy.call(null)
109+
Request.prototype.referrerPolicy.toString()
110110
}, TypeError)
111111

112112
t.throws(() => {
113-
Request.prototype.mode.call(null)
113+
Request.prototype.mode.toString()
114114
}, TypeError)
115115

116116
t.throws(() => {
117-
Request.prototype.credentials.call(null)
117+
Request.prototype.credentials.toString()
118118
}, TypeError)
119119

120120
t.throws(() => {
121-
Request.prototype.cache.call(null)
121+
Request.prototype.cache.toString()
122122
}, TypeError)
123123

124124
t.throws(() => {
125-
Request.prototype.redirect.call(null)
125+
Request.prototype.redirect.toString()
126126
}, TypeError)
127127

128128
t.throws(() => {
129-
Request.prototype.integrity.call(null)
129+
Request.prototype.integrity.toString()
130130
}, TypeError)
131131

132132
t.throws(() => {
133-
Request.prototype.keepalive.call(null)
133+
Request.prototype.keepalive.toString()
134134
}, TypeError)
135135

136136
t.throws(() => {
137-
Request.prototype.isReloadNavigation.call(null)
137+
Request.prototype.isReloadNavigation.toString()
138138
}, TypeError)
139139

140140
t.throws(() => {
141-
Request.prototype.isHistoryNavigation.call(null)
141+
Request.prototype.isHistoryNavigation.toString()
142142
}, TypeError)
143143

144144
t.throws(() => {
145-
Request.prototype.signal.call(null)
145+
Request.prototype.signal.toString()
146146
}, TypeError)
147147

148148
t.throws(() => {

test/fetch/response.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -50,31 +50,31 @@ test('arg validation', (t) => {
5050
}, TypeError)
5151

5252
t.throws(() => {
53-
Response.prototype.type.call(null)
53+
Response.prototype.type.toString()
5454
}, TypeError)
5555

5656
t.throws(() => {
57-
Response.prototype.url.call(null)
57+
Response.prototype.url.toString()
5858
}, TypeError)
5959

6060
t.throws(() => {
61-
Response.prototype.redirected.call(null)
61+
Response.prototype.redirected.toString()
6262
}, TypeError)
6363

6464
t.throws(() => {
65-
Response.prototype.status.call(null)
65+
Response.prototype.status.toString()
6666
}, TypeError)
6767

6868
t.throws(() => {
69-
Response.prototype.ok.call(null)
69+
Response.prototype.ok.toString()
7070
}, TypeError)
7171

7272
t.throws(() => {
73-
Response.prototype.statusText.call(null)
73+
Response.prototype.statusText.toString()
7474
}, TypeError)
7575

7676
t.throws(() => {
77-
Response.prototype.headers.call(null)
77+
Response.prototype.headers.toString()
7878
}, TypeError)
7979

8080
t.throws(() => {

0 commit comments

Comments
 (0)