Test/add loadcodeassist mock (#4287)
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
parent
4b8838bea4
commit
f0dc9690b7
|
@ -7,6 +7,7 @@
|
||||||
import { describe, it, expect, vi } from 'vitest';
|
import { describe, it, expect, vi } from 'vitest';
|
||||||
import { CodeAssistServer } from './server.js';
|
import { CodeAssistServer } from './server.js';
|
||||||
import { OAuth2Client } from 'google-auth-library';
|
import { OAuth2Client } from 'google-auth-library';
|
||||||
|
import { UserTierId } from './types.js';
|
||||||
|
|
||||||
vi.mock('google-auth-library');
|
vi.mock('google-auth-library');
|
||||||
|
|
||||||
|
@ -115,7 +116,14 @@ describe('CodeAssistServer', () => {
|
||||||
const client = new OAuth2Client();
|
const client = new OAuth2Client();
|
||||||
const server = new CodeAssistServer(client, 'test-project');
|
const server = new CodeAssistServer(client, 'test-project');
|
||||||
const mockResponse = {
|
const mockResponse = {
|
||||||
// TODO: Add mock response
|
currentTier: {
|
||||||
|
id: UserTierId.FREE,
|
||||||
|
name: 'Free',
|
||||||
|
description: 'free tier',
|
||||||
|
},
|
||||||
|
allowedTiers: [],
|
||||||
|
ineligibleTiers: [],
|
||||||
|
cloudaicompanionProject: 'projects/test',
|
||||||
};
|
};
|
||||||
vi.spyOn(server, 'requestPost').mockResolvedValue(mockResponse);
|
vi.spyOn(server, 'requestPost').mockResolvedValue(mockResponse);
|
||||||
|
|
||||||
|
@ -127,7 +135,7 @@ describe('CodeAssistServer', () => {
|
||||||
'loadCodeAssist',
|
'loadCodeAssist',
|
||||||
expect.any(Object),
|
expect.any(Object),
|
||||||
);
|
);
|
||||||
expect(response).toBe(mockResponse);
|
expect(response).toEqual(mockResponse);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return 0 for countTokens', async () => {
|
it('should return 0 for countTokens', async () => {
|
||||||
|
|
Loading…
Reference in New Issue