Skip to content

Commit b886279

Browse files
test: fix unit tests
1 parent d8d5a52 commit b886279

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

packages/ai/__tests__/api.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ describe('Top level API', () => {
4747
} catch (e) {
4848
expect((e as AIError).code).toContain(AIErrorCode.NO_MODEL);
4949
expect((e as AIError).message).toContain(
50-
`VertexAI: Must provide a model name. Example: ` +
51-
`getGenerativeModel({ model: 'my-model-name' }) (vertexAI/${AIErrorCode.NO_MODEL})`,
50+
`AI: Must provide a model name. Example: ` +
51+
`getGenerativeModel({ model: 'my-model-name' }) (${AI_TYPE}/${AIErrorCode.NO_MODEL})`,
5252
);
5353
}
5454
});
@@ -63,9 +63,9 @@ describe('Top level API', () => {
6363
} catch (e) {
6464
expect((e as AIError).code).toContain(AIErrorCode.NO_API_KEY);
6565
expect((e as AIError).message).toBe(
66-
`VertexAI: The "apiKey" field is empty in the local ` +
67-
`Firebase config. Firebase VertexAI requires this field to` +
68-
` contain a valid API key. (vertexAI/${AIErrorCode.NO_API_KEY})`,
66+
`AI: The "apiKey" field is empty in the local ` +
67+
`Firebase config. Firebase AI requires this field to` +
68+
` contain a valid API key. (${AI_TYPE}/${AIErrorCode.NO_API_KEY})`,
6969
);
7070
}
7171
});
@@ -80,9 +80,9 @@ describe('Top level API', () => {
8080
} catch (e) {
8181
expect((e as AIError).code).toContain(AIErrorCode.NO_PROJECT_ID);
8282
expect((e as AIError).message).toBe(
83-
`VertexAI: The "projectId" field is empty in the local` +
84-
` Firebase config. Firebase VertexAI requires this field ` +
85-
`to contain a valid project ID. (vertexAI/${AIErrorCode.NO_PROJECT_ID})`,
83+
`AI: The "projectId" field is empty in the local` +
84+
` Firebase config. Firebase AI requires this field ` +
85+
`to contain a valid project ID. (${AI_TYPE}/${AIErrorCode.NO_PROJECT_ID})`,
8686
);
8787
}
8888
});

packages/ai/__tests__/googleai-mappers.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ describe('Google AI Mappers', () => {
7676
};
7777
const error = new AIError(
7878
AIErrorCode.UNSUPPORTED,
79-
'SafetySettings.method is not supported in requests to the Gemini Developer API',
79+
'AI: SafetySetting.method is not supported in the the Gemini Developer API. Please remove this property. (AI/unsupported)',
8080
);
8181
expect(() => mapGenerateContentRequest(request)).toThrowError(error);
8282
});
@@ -90,7 +90,7 @@ describe('Google AI Mappers', () => {
9090
};
9191
const mappedRequest = mapGenerateContentRequest(request);
9292
expect(loggerWarnSpy).toHaveBeenCalledWith(
93-
'topK in GenerationConfig has been rounded to the nearest integer to match the format for requests to the Gemini Developer API.',
93+
expect.stringContaining('topK in GenerationConfig has been rounded to the nearest integer'),
9494
);
9595
expect(mappedRequest.generationConfig?.topK).toBe(16);
9696
});

0 commit comments

Comments
 (0)