@@ -30,7 +30,7 @@ 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 . message } ` ,
33
+ `Key "${ key } " should be valid but config parsing failed: ${ error instanceof Error ? error . message : String ( error ) } ` ,
34
34
) ;
35
35
}
36
36
}
@@ -63,12 +63,12 @@ Deno.test("Secret key validation in Invidious companion config", async (t) => {
63
63
} catch ( error ) {
64
64
// Verify it's a config parsing error with the right message
65
65
assert (
66
- error . message . includes ( "Failed to parse configuration" ) ,
67
- `Should get config parsing error, got: ${ error . message } ` ,
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
68
) ;
69
69
70
70
// Check that the error contains expected validation message content
71
- const errorStr = error . toString ( ) ;
71
+ const errorStr = error instanceof Error ? error . toString ( ) : String ( error ) ;
72
72
assert (
73
73
errorStr . includes (
74
74
"SERVER_SECRET_KEY contains invalid characters" ,
@@ -103,12 +103,12 @@ Deno.test("Secret key validation in Invidious companion config", async (t) => {
103
103
} catch ( error ) {
104
104
// Verify it's a config parsing error
105
105
assert (
106
- error . message . includes ( "Failed to parse configuration" ) ,
107
- `Should get config parsing error, got: ${ error . message } ` ,
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 ) } ` ,
108
108
) ;
109
109
110
110
// Check that the error mentions length requirement
111
- const errorStr = error . toString ( ) ;
111
+ const errorStr = error instanceof Error ? error . toString ( ) : String ( error ) ;
112
112
assert (
113
113
errorStr . includes ( "exactly 16 character" ) ||
114
114
errorStr . includes (
@@ -128,7 +128,7 @@ Deno.test("Secret key validation in Invidious companion config", async (t) => {
128
128
await parseConfig ( ) ;
129
129
assert ( false , "Should have failed with special character key" ) ;
130
130
} catch ( error ) {
131
- const errorStr = error . toString ( ) ;
131
+ const errorStr = error instanceof Error ? error . toString ( ) : String ( error ) ;
132
132
133
133
// Check that the error message contains validation details
134
134
assert (
@@ -147,7 +147,7 @@ Deno.test("Secret key validation in Invidious companion config", async (t) => {
147
147
await parseConfig ( ) ;
148
148
assert ( false , "Should have failed with short key" ) ;
149
149
} catch ( error ) {
150
- const errorStr = error . toString ( ) ;
150
+ const errorStr = error instanceof Error ? error . toString ( ) : String ( error ) ;
151
151
assert (
152
152
errorStr . includes ( "exactly 16 character" ) ||
153
153
errorStr . includes (
@@ -172,7 +172,7 @@ Deno.test("Secret key validation in Invidious companion config", async (t) => {
172
172
"Should have failed with short key containing special chars" ,
173
173
) ;
174
174
} catch ( error ) {
175
- const errorStr = error . toString ( ) ;
175
+ const errorStr = error instanceof Error ? error . toString ( ) : String ( error ) ;
176
176
// Should get length error since it's checked first
177
177
assert (
178
178
errorStr . includes ( "exactly 16 character" ) ||
@@ -197,7 +197,7 @@ Deno.test("Secret key validation in Invidious companion config", async (t) => {
197
197
"Should have failed with missing/empty SERVER_SECRET_KEY" ,
198
198
) ;
199
199
} catch ( error ) {
200
- const errorStr = error . toString ( ) ;
200
+ const errorStr = error instanceof Error ? error . toString ( ) : String ( error ) ;
201
201
assert (
202
202
errorStr . includes ( "exactly 16 character" ) ||
203
203
errorStr . includes (
0 commit comments