Skip to content

Commit a6c4351

Browse files
russellwheatleymikehardy
authored andcommitted
test: backend
1 parent 427a302 commit a6c4351

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

packages/ai/__tests__/backend.test.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { describe, it, expect } from '@jest/globals';
2+
import { GoogleAIBackend, VertexAIBackend } from '../lib/backend';
3+
import { BackendType } from 'lib/public-types';
4+
import { DEFAULT_LOCATION } from 'lib/constants';
5+
describe('Backend', () => {
6+
describe('GoogleAIBackend', () => {
7+
it('sets backendType to GOOGLE_AI', () => {
8+
const backend = new GoogleAIBackend();
9+
expect(backend.backendType).toBe(BackendType.GOOGLE_AI); // Use toBe instead of to.equal
10+
});
11+
});
12+
13+
describe('VertexAIBackend', () => {
14+
it('set backendType to VERTEX_AI', () => {
15+
const backend = new VertexAIBackend();
16+
expect(backend.backendType).toBe(BackendType.VERTEX_AI); // Use toBe instead of to.equal
17+
expect(backend.location).toBe(DEFAULT_LOCATION); // Use toBe instead of to.equal
18+
});
19+
20+
it('sets custom location', () => {
21+
const backend = new VertexAIBackend('test-location');
22+
expect(backend.backendType).toBe(BackendType.VERTEX_AI); // Use toBe instead of to.equal
23+
expect(backend.location).toBe('test-location'); // Use toBe instead of to.equal
24+
});
25+
26+
it('uses default location if location is empty string', () => {
27+
const backend = new VertexAIBackend('');
28+
expect(backend.backendType).toBe(BackendType.VERTEX_AI); // Use toBe instead of to.equal
29+
expect(backend.location).toBe(DEFAULT_LOCATION); // Use toBe instead of to.equal
30+
});
31+
32+
it('uses default location if location is null', () => {
33+
const backend = new VertexAIBackend(null as any);
34+
expect(backend.backendType).toBe(BackendType.VERTEX_AI); // Use toBe instead of to.equal
35+
expect(backend.location).toBe(DEFAULT_LOCATION); // Use toBe instead of to.equal
36+
});
37+
});
38+
});

0 commit comments

Comments
 (0)