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:
HyeongHo Jun 2025-07-18 07:57:54 +09:00 committed by GitHub
parent 4b8838bea4
commit f0dc9690b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 2 deletions

View File

@ -7,6 +7,7 @@
import { describe, it, expect, vi } from 'vitest';
import { CodeAssistServer } from './server.js';
import { OAuth2Client } from 'google-auth-library';
import { UserTierId } from './types.js';
vi.mock('google-auth-library');
@ -115,7 +116,14 @@ describe('CodeAssistServer', () => {
const client = new OAuth2Client();
const server = new CodeAssistServer(client, 'test-project');
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);
@ -127,7 +135,7 @@ describe('CodeAssistServer', () => {
'loadCodeAssist',
expect.any(Object),
);
expect(response).toBe(mockResponse);
expect(response).toEqual(mockResponse);
});
it('should return 0 for countTokens', async () => {