|
1 | 1 | // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. |
2 | 2 |
|
3 | | -import { APIPromise } from '@kernel/sdk/core/api-promise'; |
| 3 | +import { APIPromise } from '@onkernel/sdk/core/api-promise'; |
4 | 4 |
|
5 | 5 | import util from 'node:util'; |
6 | | -import Kernel from '@kernel/sdk'; |
7 | | -import { APIUserAbortError } from '@kernel/sdk'; |
| 6 | +import Kernel from '@onkernel/sdk'; |
| 7 | +import { APIUserAbortError } from '@onkernel/sdk'; |
8 | 8 | const defaultFetch = fetch; |
9 | 9 |
|
10 | 10 | describe('instantiate client', () => { |
@@ -329,20 +329,22 @@ describe('instantiate client', () => { |
329 | 329 | process.env['KERNEL_BASE_URL'] = ' '; // blank |
330 | 330 | const client = new Kernel({ apiKey: 'My API Key' }); |
331 | 331 | expect(client.baseURL).toEqual('https://api.onkernel.com/'); |
332 | | - expect(client.baseURL).toEqual('https://api.onkernel.com/'); |
333 | | -}); |
| 332 | + }); |
334 | 333 |
|
335 | | -test('blank env variable', () => { |
336 | | -process.env['KERNEL_BASE_URL'] = ' '; // blank |
337 | | -const client = new Kernel({ apiKey: 'My API Key' }); |
338 | | - expect(client.baseURL).toEqual('https://api.onkernel.com/'); |
339 | | -}); |
| 334 | + test('env variable with environment', () => { |
| 335 | + process.env['KERNEL_BASE_URL'] = 'https://example.com/from_env'; |
340 | 336 |
|
341 | | -test('env variable with environment', () => { |
342 | | -@@ -345,7 +345,7 @@ describe('instantiate client', () => { |
343 | | -baseURL: null, |
344 | | -environment: 'production', |
345 | | -}); |
| 337 | + expect( |
| 338 | + () => new Kernel({ apiKey: 'My API Key', environment: 'production' }), |
| 339 | + ).toThrowErrorMatchingInlineSnapshot( |
| 340 | + `"Ambiguous URL; The \`baseURL\` option (or KERNEL_BASE_URL env var) and the \`environment\` option are given. If you want to use the environment you must pass baseURL: null"`, |
| 341 | + ); |
| 342 | + |
| 343 | + const client = new Kernel({ |
| 344 | + apiKey: 'My API Key', |
| 345 | + baseURL: null, |
| 346 | + environment: 'production', |
| 347 | + }); |
346 | 348 | expect(client.baseURL).toEqual('https://api.onkernel.com/'); |
347 | 349 | }); |
348 | 350 |
|
|
0 commit comments