diff --git a/src/lib/seam/connect/options.ts b/src/lib/seam/connect/options.ts index 1699e38..35d30cd 100644 --- a/src/lib/seam/connect/options.ts +++ b/src/lib/seam/connect/options.ts @@ -238,4 +238,9 @@ export class SeamHttpInvalidOptionsError extends Error { } } -export class SeamHttpMultiWorkspaceInvalidOptionsError extends SeamHttpInvalidOptionsError {} +export class SeamHttpMultiWorkspaceInvalidOptionsError extends Error { + constructor(message: string) { + super(`SeamHttpMultiWorkspace received invalid options: ${message}`) + this.name = this.constructor.name + } +} diff --git a/test/seam/connect/env.test.ts b/test/seam/connect/env.test.ts index 0609cfa..20ddcdb 100644 --- a/test/seam/connect/env.test.ts +++ b/test/seam/connect/env.test.ts @@ -30,6 +30,16 @@ test.serial( }, ) +test.serial( + 'SeamHttp: constructor checks for SEAM_API_KEY environment variable', + (t) => { + t.throws(() => new SeamHttp(), { + instanceOf: SeamHttpInvalidOptionsError, + message: /SEAM_API_KEY/, + }) + }, +) + test.serial( 'SeamHttp: apiKey option overrides environment variables', async (t) => {