Skip to content

Commit

Permalink
fix: Test
Browse files Browse the repository at this point in the history
  • Loading branch information
asafgardin committed Nov 15, 2024
1 parent cf5aa90 commit c8fd303
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions src/AI21.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,16 @@ export class AI21 extends APIClient {
);
}

if (apiKey === undefined) {
throw new MissingAPIKeyError();
}

super({
baseURL,
timeout,
maxRetries,
});

if (apiKey === undefined) {
throw new MissingAPIKeyError();
}

this.apiKey = apiKey;
this.via = via ?? null;
this.options = options;
Expand Down
2 changes: 1 addition & 1 deletion tests/AI21.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe('AI21', () => {
});

it('should throw MissingAPIKeyError when no API key provided', () => {
expect(() => new AI21({apiKey: undefined} as ClientOptions)).toThrow(MissingAPIKeyError);
expect(() => new AI21({apiKey: undefined, dangerouslyAllowBrowser: true} as ClientOptions)).toThrow(MissingAPIKeyError);
});

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

0 comments on commit c8fd303

Please sign in to comment.