File tree Expand file tree Collapse file tree 2 files changed +11
-15
lines changed Expand file tree Collapse file tree 2 files changed +11
-15
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,6 @@ const {
2121
2222const {
2323 codes : {
24- ERR_INVALID_THIS ,
2524 ERR_MISSING_ARGS ,
2625 } ,
2726} = require ( 'internal/errors' ) ;
@@ -64,18 +63,10 @@ class File extends Blob {
6463 }
6564
6665 get name ( ) {
67- if ( ! this || ! ( #name in this ) ) {
68- throw new ERR_INVALID_THIS ( 'File' ) ;
69- }
70-
7166 return this . #name;
7267 }
7368
7469 get lastModified ( ) {
75- if ( ! this || ! ( #name in this ) ) {
76- throw new ERR_INVALID_THIS ( 'File' ) ;
77- }
78-
7970 return this . #lastModified;
8071 }
8172
Original file line number Diff line number Diff line change @@ -146,10 +146,15 @@ const { inspect } = require('util');
146146
147147{
148148 const getter = Object . getOwnPropertyDescriptor ( File . prototype , 'name' ) . get ;
149- assert . throws (
150- ( ) => getter . call ( undefined ) , // eslint-disable-line no-useless-call
151- {
152- code : 'ERR_INVALID_THIS' ,
153- }
154- ) ;
149+
150+ [
151+ undefined ,
152+ null ,
153+ true ,
154+ ] . forEach ( ( invalidThis ) => {
155+ assert . throws (
156+ ( ) => getter . call ( invalidThis ) ,
157+ TypeError
158+ ) ;
159+ } ) ;
155160}
You can’t perform that action at this time.
0 commit comments