Skip to content

Commit

Permalink
Throw error if mock not found
Browse files Browse the repository at this point in the history
  • Loading branch information
dlarocque committed Jan 29, 2025
1 parent dafae52 commit c68a16d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/vertexai/test-utils/mock-response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ export function getMockResponseStreaming(
filename: string,
chunkLength: number = 20
): Partial<Response> {
if (!(filename in mocksLookup)) {
throw Error(`Mock response file '${filename}' not found.`);
}
const fullText = mocksLookup[filename];

return {
Expand All @@ -57,6 +60,9 @@ export function getMockResponseStreaming(
}

export function getMockResponse(filename: string): Partial<Response> {
if (!(filename in mocksLookup)) {
throw Error(`Mock response file '${filename}' not found.`);
}
const fullText = mocksLookup[filename];
return {
ok: true,
Expand Down

0 comments on commit c68a16d

Please sign in to comment.