Skip to content

Commit 84dfeca

Browse files
authored
Throw error if mock response file not found (#8739)
1 parent f681482 commit 84dfeca

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/vertexai/test-utils/mock-response.ts

+6
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ export function getMockResponseStreaming(
4949
filename: string,
5050
chunkLength: number = 20
5151
): Partial<Response> {
52+
if (!(filename in mocksLookup)) {
53+
throw Error(`Mock response file '${filename}' not found.`);
54+
}
5255
const fullText = mocksLookup[filename];
5356

5457
return {
@@ -57,6 +60,9 @@ export function getMockResponseStreaming(
5760
}
5861

5962
export function getMockResponse(filename: string): Partial<Response> {
63+
if (!(filename in mocksLookup)) {
64+
throw Error(`Mock response file '${filename}' not found.`);
65+
}
6066
const fullText = mocksLookup[filename];
6167
return {
6268
ok: true,

0 commit comments

Comments
 (0)