@@ -45,32 +45,15 @@ const kEuro = Buffer.from([0xe2, 0x82, 0xac]).toString();
45
45
assert . strictEqual ( tds . encoding , 'utf-8' ) ;
46
46
assert . strictEqual ( tds . fatal , false ) ;
47
47
assert . strictEqual ( tds . ignoreBOM , false ) ;
48
-
49
- assert . throws (
50
- ( ) => Reflect . get ( TextDecoderStream . prototype , 'encoding' , { } ) , {
51
- name : 'TypeError' ,
52
- message : / C a n n o t r e a d p r i v a t e m e m b e r / ,
53
- } ) ;
54
- assert . throws (
55
- ( ) => Reflect . get ( TextDecoderStream . prototype , 'fatal' , { } ) , {
56
- name : 'TypeError' ,
57
- message : / C a n n o t r e a d p r i v a t e m e m b e r / ,
58
- } ) ;
59
- assert . throws (
60
- ( ) => Reflect . get ( TextDecoderStream . prototype , 'ignoreBOM' , { } ) , {
61
- name : 'TypeError' ,
62
- message : / C a n n o t r e a d p r i v a t e m e m b e r / ,
63
- } ) ;
64
- assert . throws (
65
- ( ) => Reflect . get ( TextDecoderStream . prototype , 'readable' , { } ) , {
66
- name : 'TypeError' ,
67
- message : / C a n n o t r e a d p r i v a t e m e m b e r / ,
68
- } ) ;
69
- assert . throws (
70
- ( ) => Reflect . get ( TextDecoderStream . prototype , 'writable' , { } ) , {
71
- name : 'TypeError' ,
72
- message : / C a n n o t r e a d p r i v a t e m e m b e r / ,
73
- } ) ;
48
+ [ 'encoding' , 'fatal' , 'ignoreBOM' , 'readable' , 'writable' ] . forEach ( ( getter ) => {
49
+ assert . throws (
50
+ ( ) => Reflect . get ( TextDecoderStream . prototype , getter , { } ) , {
51
+ name : 'TypeError' ,
52
+ message : / C a n n o t r e a d p r i v a t e m e m b e r / ,
53
+ stack : new RegExp ( `at get ${ getter } ` )
54
+ }
55
+ ) ;
56
+ } ) ;
74
57
}
75
58
76
59
{
@@ -91,20 +74,13 @@ const kEuro = Buffer.from([0xe2, 0x82, 0xac]).toString();
91
74
] ) . then ( common . mustCall ( ) ) ;
92
75
93
76
assert . strictEqual ( tds . encoding , 'utf-8' ) ;
94
-
95
- assert . throws (
96
- ( ) => Reflect . get ( TextEncoderStream . prototype , 'encoding' , { } ) , {
97
- name : 'TypeError' ,
98
- message : / C a n n o t r e a d p r i v a t e m e m b e r / ,
99
- } ) ;
100
- assert . throws (
101
- ( ) => Reflect . get ( TextEncoderStream . prototype , 'readable' , { } ) , {
102
- name : 'TypeError' ,
103
- message : / C a n n o t r e a d p r i v a t e m e m b e r / ,
104
- } ) ;
105
- assert . throws (
106
- ( ) => Reflect . get ( TextEncoderStream . prototype , 'writable' , { } ) , {
107
- name : 'TypeError' ,
108
- message : / C a n n o t r e a d p r i v a t e m e m b e r / ,
109
- } ) ;
77
+ [ 'encoding' , 'readable' , 'writable' ] . forEach ( ( getter ) => {
78
+ assert . throws (
79
+ ( ) => Reflect . get ( TextDecoderStream . prototype , getter , { } ) , {
80
+ name : 'TypeError' ,
81
+ message : / C a n n o t r e a d p r i v a t e m e m b e r / ,
82
+ stack : new RegExp ( `at get ${ getter } ` )
83
+ }
84
+ ) ;
85
+ } ) ;
110
86
}
0 commit comments