Skip to content

Commit 880110b

Browse files
authored
Update e2e tests to reflect AI package and new API (#9017)
1 parent 3d9291f commit 880110b

File tree

4 files changed

+1136
-1086
lines changed

4 files changed

+1136
-1086
lines changed

e2e/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"author": "",
1818
"license": "ISC",
1919
"dependencies": {
20-
"firebase": "11.3.0"
20+
"firebase": "^11.8.0-20250512211235"
2121
},
2222
"devDependencies": {
2323
"@babel/core": "7.26.8",

e2e/sample-apps/modular.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ import {
5858
onValue,
5959
off
6060
} from 'firebase/database';
61-
import { getGenerativeModel, getVertexAI, VertexAI } from 'firebase/vertexai';
61+
import { getGenerativeModel, getAI, VertexAIBackend } from 'firebase/ai';
6262
import { getDataConnect, DataConnect } from 'firebase/data-connect';
6363

6464
/**
@@ -307,15 +307,15 @@ function callPerformance(app) {
307307
}
308308

309309
/**
310-
* VertexAI smoke test.
310+
* AI smoke test.
311311
* Just make sure some functions can be called without obvious errors.
312312
*/
313-
async function callVertexAI(app) {
314-
console.log('[VERTEXAI] start');
315-
const vertexAI = getVertexAI(app);
316-
const model = getGenerativeModel(vertexAI, { model: 'gemini-1.5-flash' });
313+
async function callAI(app) {
314+
console.log('[AI] start');
315+
const ai = getAI(app, { backend: new VertexAIBackend() });
316+
const model = getGenerativeModel(ai, { model: 'gemini-1.5-flash' });
317317
const result = await model.countTokens('abcdefg');
318-
console.log(`[VERTEXAI] counted tokens: ${result.totalTokens}`);
318+
console.log(`[AI] counted tokens: ${result.totalTokens}`);
319319
}
320320

321321
/**
@@ -350,7 +350,7 @@ async function main() {
350350
callAnalytics(app);
351351
callPerformance(app);
352352
await callFunctions(app);
353-
await callVertexAI(app);
353+
await callAI(app);
354354
callDataConnect(app);
355355
await authLogout(app);
356356
console.log('DONE');

e2e/tests/modular.test.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,12 @@ import {
8686
StorageReference,
8787
deleteObject
8888
} from 'firebase/storage';
89-
import { getGenerativeModel, getVertexAI, VertexAI } from 'firebase/vertexai';
89+
import {
90+
getGenerativeModel,
91+
getAI,
92+
AI,
93+
VertexAIBackend
94+
} from 'firebase/vertexai';
9095
import { getDataConnect, DataConnect } from 'firebase/data-connect';
9196
import { config, testAccount } from '../firebase-config';
9297
import 'jest';
@@ -307,13 +312,13 @@ describe('MODULAR', () => {
307312
});
308313
});
309314

310-
describe('VERTEXAI', () => {
311-
let vertexAI: VertexAI;
315+
describe('AI', () => {
316+
let ai: AI;
312317
it('getVertexAI()', () => {
313-
vertexAI = getVertexAI(app);
318+
ai = getAI(app, { backend: new VertexAIBackend() });
314319
});
315320
it('getGenerativeModel() and countTokens()', async () => {
316-
const model = getGenerativeModel(vertexAI, { model: 'gemini-1.5-flash' });
321+
const model = getGenerativeModel(ai, { model: 'gemini-1.5-flash' });
317322
expect(model.model).toMatch(/gemini-1.5-flash$/);
318323
const result = await model.countTokens('abcdefg');
319324
expect(result.totalTokens).toBeTruthy;

0 commit comments

Comments
 (0)