@@ -30,7 +30,9 @@ Deno.test("Secret key validation in Invidious companion config", async (t) => {
30
30
} catch ( error ) {
31
31
assert (
32
32
false ,
33
- `Key "${ key } " should be valid but config parsing failed: ${ error instanceof Error ? error . message : String ( error ) } ` ,
33
+ `Key "${ key } " should be valid but config parsing failed: ${
34
+ error instanceof Error ? error . message : String ( error )
35
+ } `,
34
36
) ;
35
37
}
36
38
}
@@ -63,12 +65,17 @@ Deno.test("Secret key validation in Invidious companion config", async (t) => {
63
65
} catch ( error ) {
64
66
// Verify it's a config parsing error with the right message
65
67
assert (
66
- error instanceof Error && error . message . includes ( "Failed to parse configuration" ) ,
67
- `Should get config parsing error, got: ${ error instanceof Error ? error . message : String ( error ) } ` ,
68
+ error instanceof Error &&
69
+ error . message . includes ( "Failed to parse configuration" ) ,
70
+ `Should get config parsing error, got: ${
71
+ error instanceof Error ? error . message : String ( error )
72
+ } `,
68
73
) ;
69
74
70
75
// Check that the error contains expected validation message content
71
- const errorStr = error instanceof Error ? error . toString ( ) : String ( error ) ;
76
+ const errorStr = error instanceof Error
77
+ ? error . toString ( )
78
+ : String ( error ) ;
72
79
assert (
73
80
errorStr . includes (
74
81
"SERVER_SECRET_KEY contains invalid characters" ,
@@ -103,12 +110,17 @@ Deno.test("Secret key validation in Invidious companion config", async (t) => {
103
110
} catch ( error ) {
104
111
// Verify it's a config parsing error
105
112
assert (
106
- error instanceof Error && error . message . includes ( "Failed to parse configuration" ) ,
107
- `Should get config parsing error, got: ${ error instanceof Error ? error . message : String ( error ) } ` ,
113
+ error instanceof Error &&
114
+ error . message . includes ( "Failed to parse configuration" ) ,
115
+ `Should get config parsing error, got: ${
116
+ error instanceof Error ? error . message : String ( error )
117
+ } `,
108
118
) ;
109
119
110
120
// Check that the error mentions length requirement
111
- const errorStr = error instanceof Error ? error . toString ( ) : String ( error ) ;
121
+ const errorStr = error instanceof Error
122
+ ? error . toString ( )
123
+ : String ( error ) ;
112
124
assert (
113
125
errorStr . includes ( "exactly 16 character" ) ||
114
126
errorStr . includes (
@@ -128,7 +140,9 @@ Deno.test("Secret key validation in Invidious companion config", async (t) => {
128
140
await parseConfig ( ) ;
129
141
assert ( false , "Should have failed with special character key" ) ;
130
142
} catch ( error ) {
131
- const errorStr = error instanceof Error ? error . toString ( ) : String ( error ) ;
143
+ const errorStr = error instanceof Error
144
+ ? error . toString ( )
145
+ : String ( error ) ;
132
146
133
147
// Check that the error message contains validation details
134
148
assert (
@@ -147,7 +161,9 @@ Deno.test("Secret key validation in Invidious companion config", async (t) => {
147
161
await parseConfig ( ) ;
148
162
assert ( false , "Should have failed with short key" ) ;
149
163
} catch ( error ) {
150
- const errorStr = error instanceof Error ? error . toString ( ) : String ( error ) ;
164
+ const errorStr = error instanceof Error
165
+ ? error . toString ( )
166
+ : String ( error ) ;
151
167
assert (
152
168
errorStr . includes ( "exactly 16 character" ) ||
153
169
errorStr . includes (
@@ -172,7 +188,9 @@ Deno.test("Secret key validation in Invidious companion config", async (t) => {
172
188
"Should have failed with short key containing special chars" ,
173
189
) ;
174
190
} catch ( error ) {
175
- const errorStr = error instanceof Error ? error . toString ( ) : String ( error ) ;
191
+ const errorStr = error instanceof Error
192
+ ? error . toString ( )
193
+ : String ( error ) ;
176
194
// Should get length error since it's checked first
177
195
assert (
178
196
errorStr . includes ( "exactly 16 character" ) ||
@@ -197,7 +215,9 @@ Deno.test("Secret key validation in Invidious companion config", async (t) => {
197
215
"Should have failed with missing/empty SERVER_SECRET_KEY" ,
198
216
) ;
199
217
} catch ( error ) {
200
- const errorStr = error instanceof Error ? error . toString ( ) : String ( error ) ;
218
+ const errorStr = error instanceof Error
219
+ ? error . toString ( )
220
+ : String ( error ) ;
201
221
assert (
202
222
errorStr . includes ( "exactly 16 character" ) ||
203
223
errorStr . includes (
0 commit comments