Skip to content

Commit 70b2d75

Browse files
committed
fix: Test
1 parent 241c386 commit 70b2d75

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

src/AI21.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,16 @@ export class AI21 extends APIClient {
4949
);
5050
}
5151

52+
if (apiKey === undefined) {
53+
throw new MissingAPIKeyError();
54+
}
55+
5256
super({
5357
baseURL,
5458
timeout,
5559
maxRetries,
5660
});
5761

58-
if (apiKey === undefined) {
59-
throw new MissingAPIKeyError();
60-
}
61-
6262
this.apiKey = apiKey;
6363
this.via = via ?? null;
6464
this.options = options;

tests/AI21.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe('AI21', () => {
1919
});
2020

2121
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);
2323
});
2424

2525
it('should throw AI21Error when browser is detected without dangerouslyAllowBrowser option', () => {

0 commit comments

Comments
 (0)