Skip to content

Commit 166f9c8

Browse files
google-genai-botcopybara-github
authored andcommitted
ADK changes
PiperOrigin-RevId: 813414139
1 parent c57fcdf commit 166f9c8

File tree

2 files changed

+35
-8
lines changed

2 files changed

+35
-8
lines changed

src/app/components/chat/chat.component.spec.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,17 @@
1515
* limitations under the License.
1616
*/
1717

18+
1819
import {Location} from '@angular/common';
1920
import {HttpErrorResponse} from '@angular/common/http';
20-
import {ComponentFixture, fakeAsync, TestBed, tick} from '@angular/core/testing';
21+
import {Component} from '@angular/core';
22+
import {ComponentFixture, TestBed} from '@angular/core/testing';
2123
import {MatDialog, MatDialogModule} from '@angular/material/dialog';
2224
import {MatSnackBar} from '@angular/material/snack-bar';
2325
import {By} from '@angular/platform-browser';
2426
import {NoopAnimationsModule} from '@angular/platform-browser/animations';
2527
import {ActivatedRoute, NavigationEnd, Router} from '@angular/router';
28+
2629
import {BehaviorSubject, NEVER, of, Subject, throwError} from 'rxjs';
2730

2831
import {EvalCase} from '../../core/models/Eval';
@@ -37,7 +40,6 @@ import {GRAPH_SERVICE, GraphService} from '../../core/services/graph.service';
3740
import {SAFE_VALUES_SERVICE} from '../../core/services/interfaces/safevalues';
3841
import {STRING_TO_COLOR_SERVICE} from '../../core/services/interfaces/string-to-color';
3942
import {SESSION_SERVICE, SessionService,} from '../../core/services/session.service';
40-
import {StringToColorServiceImpl} from '../../core/services/string-to-color.service';
4143
import {MockAgentService} from '../../core/services/testing/mock-agent.service';
4244
import {MockArtifactService} from '../../core/services/testing/mock-artifact.service';
4345
import {MockAudioService} from '../../core/services/testing/mock-audio.service';
@@ -55,11 +57,11 @@ import {MockWebSocketService} from '../../core/services/testing/mock-websocket.s
5557
import {TRACE_SERVICE, TraceService} from '../../core/services/trace.service';
5658
import {VIDEO_SERVICE, VideoService} from '../../core/services/video.service';
5759
import {WEBSOCKET_SERVICE, WebSocketService,} from '../../core/services/websocket.service';
58-
import {Component} from '@angular/core';
59-
import {MARKDOWN_COMPONENT} from '../markdown/markdown.component.interface';
60-
import {MarkdownComponent} from '../markdown/markdown.component';
61-
60+
import {fakeAsync,
61+
tick} from '../../testing/utils';
6262
import {ChatPanelComponent} from '../chat-panel/chat-panel.component';
63+
import {MARKDOWN_COMPONENT} from '../markdown/markdown.component.interface';
64+
import {MockMarkdownComponent} from '../markdown/testing/mock-markdown.component';
6365
import {SidePanelComponent} from '../side-panel/side-panel.component';
6466

6567
import {ChatComponent} from './chat.component';
@@ -136,6 +138,8 @@ describe('ChatComponent', () => {
136138
mockStringToColorService = new MockStringToColorService();
137139
mockSafeValuesService = new MockSafeValuesService();
138140

141+
mockStringToColorService.stc.and.returnValue('#8c8526ff');
142+
139143
mockSessionService.createSessionResponse.next(
140144
{id: SESSION_1_ID, state: {}});
141145
mockTraceService.selectedTraceRow$.next(undefined);
@@ -198,15 +202,18 @@ describe('ChatComponent', () => {
198202
{provide: TRACE_SERVICE, useValue: mockTraceService},
199203
{provide: AGENT_SERVICE, useValue: mockAgentService},
200204
{provide: FEATURE_FLAG_SERVICE, useValue: mockFeatureFlagService},
201-
{provide: STRING_TO_COLOR_SERVICE, useClass: StringToColorServiceImpl},
205+
{
206+
provide: STRING_TO_COLOR_SERVICE,
207+
useValue: mockStringToColorService,
208+
},
202209
{provide: GRAPH_SERVICE, useValue: graphService},
203210
{provide: SAFE_VALUES_SERVICE, useValue: mockSafeValuesService},
204211
{provide: MatDialog, useValue: mockDialog},
205212
{provide: MatSnackBar, useValue: mockSnackBar},
206213
{provide: Router, useValue: mockRouter},
207214
{provide: ActivatedRoute, useValue: mockActivatedRoute},
208215
{provide: Location, useValue: mockLocation},
209-
{provide: MARKDOWN_COMPONENT, useValue: MarkdownComponent},
216+
{provide: MARKDOWN_COMPONENT, useValue: MockMarkdownComponent},
210217
],
211218
})
212219
.compileComponents();

src/app/testing/utils.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/**
2+
* @license
3+
* Copyright 2025 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
export {tick, fakeAsync} from '@angular/core/testing';
19+
20+

0 commit comments

Comments
 (0)