File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -49,16 +49,16 @@ export class AI21 extends APIClient {
49
49
) ;
50
50
}
51
51
52
+ if ( apiKey === undefined ) {
53
+ throw new MissingAPIKeyError ( ) ;
54
+ }
55
+
52
56
super ( {
53
57
baseURL,
54
58
timeout,
55
59
maxRetries,
56
60
} ) ;
57
61
58
- if ( apiKey === undefined ) {
59
- throw new MissingAPIKeyError ( ) ;
60
- }
61
-
62
62
this . apiKey = apiKey ;
63
63
this . via = via ?? null ;
64
64
this . options = options ;
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ describe('AI21', () => {
19
19
} ) ;
20
20
21
21
it ( 'should throw MissingAPIKeyError when no API key provided' , ( ) => {
22
- expect ( ( ) => new AI21 ( { apiKey : undefined } as ClientOptions ) ) . toThrow ( MissingAPIKeyError ) ;
22
+ expect ( ( ) => new AI21 ( { apiKey : undefined , dangerouslyAllowBrowser : true } as ClientOptions ) ) . toThrow ( MissingAPIKeyError ) ;
23
23
} ) ;
24
24
25
25
it ( 'should throw AI21Error when browser is detected without dangerouslyAllowBrowser option' , ( ) => {
You can’t perform that action at this time.
0 commit comments