Skip to content

Commit 0306be8

Browse files
committed
fix tests
1 parent 357c83d commit 0306be8

File tree

3 files changed

+12
-14
lines changed

3 files changed

+12
-14
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ describe('ChatPanelComponent', () => {
135135

136136
it('should display function call', () => {
137137
component.messages = [
138-
{role: 'bot', functionCall: {name: 'test_func', args: {}}},
138+
{role: 'bot', functionCalls: [{name: 'test_func', args: {}}]},
139139
];
140140
fixture.detectChanges();
141141
const button =
@@ -145,7 +145,7 @@ describe('ChatPanelComponent', () => {
145145

146146
it('should display function response', () => {
147147
component.messages = [
148-
{role: 'bot', functionResponse: {name: 'test_func', response: {}}},
148+
{role: 'bot', functionResponses: [{name: 'test_func', response: {}}]},
149149
];
150150
fixture.detectChanges();
151151
const button =
@@ -223,7 +223,7 @@ describe('ChatPanelComponent', () => {
223223

224224
it('should show edit button for function calls', async () => {
225225
component.messages =
226-
[{role: 'bot', functionCall: {name: 'func1'}, eventId: '1'}];
226+
[{role: 'bot', functionCalls: [{name: 'func1'}], eventId: '1'}];
227227
component.isEditFunctionArgsEnabled = true;
228228
fixture.detectChanges();
229229
await fixture.whenStable();
@@ -270,7 +270,7 @@ describe('ChatPanelComponent', () => {
270270
async () => {
271271
const message = {
272272
role: 'bot',
273-
functionCall: {name: 'func1'},
273+
functionCalls: [{name: 'func1'}],
274274
eventId: '1'
275275
};
276276
component.messages = [message];
@@ -309,7 +309,7 @@ describe('ChatPanelComponent', () => {
309309
it(
310310
'should emit clickEvent when function call button is clicked', () => {
311311
component.messages =
312-
[{role: 'bot', functionCall: {name: 'func1'}, eventId: '1'}];
312+
[{role: 'bot', functionCalls: [{name: 'func1'}], eventId: '1'}];
313313
component.eventData = new Map([['1', {id: '1', author: 'bot'}]]);
314314
spyOn(component.clickEvent, 'emit');
315315
fixture.detectChanges();

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ describe('ChatComponent', () => {
436436
}));
437437

438438
it('should store events', () => {
439-
expect(component.eventData.has('event-1')).toBeFalse();
439+
expect(component.eventData.has('event-1')).toBeTrue();
440440
expect(component.eventData.has('event-2')).toBeTrue();
441441
});
442442
});
@@ -1133,11 +1133,11 @@ describe('ChatComponent', () => {
11331133

11341134
const botMessages =
11351135
component.messages().filter(m => m.role === 'bot');
1136-
expect(botMessages.length).toBe(3);
1136+
expect(botMessages.length).toBe(2);
11371137
expect(botMessages[0].text).toBe('Hello ');
1138-
expect(botMessages[1].functionCall)
1139-
.toEqual({name: 'foo', args: {}});
1140-
expect(botMessages[2].text).toBe('World!');
1138+
expect(botMessages[0].functionCalls)
1139+
.toEqual([{name: 'foo', args: {}}]);
1140+
expect(botMessages[1].text).toBe('World!');
11411141
});
11421142
});
11431143

src/app/components/side-panel/side-panel.component.spec.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,17 +68,15 @@ import {SidePanelComponent} from './side-panel.component';
6868
const TABS_CONTAINER_SELECTOR = By.css('.tabs-container');
6969
const DETAILS_PANEL_SELECTOR = By.css('.details-panel-container');
7070
const TAB_HEADERS_SELECTOR = By.css('[role="tab"]');
71-
const EVENT_TAB_SELECTOR = By.css('app-event-tab');
7271
const SESSION_TAB_SELECTOR = By.css('app-session-tab');
7372
const EVAL_TAB_SELECTOR = By.css('app-eval-tab');
7473
const DETAILS_PANEL_CLOSE_BUTTON_SELECTOR =
7574
By.css('.details-panel-container mat-icon');
7675
const EVENT_GRAPH_SELECTOR = By.css('.event-graph-container div');
7776
const APP_SELECT_SELECTOR = By.css('.app-select');
7877

79-
const EVENTS_TAB_INDEX = 1;
80-
const SESSIONS_TAB_INDEX = 4;
81-
const EVAL_TAB_INDEX = 5;
78+
const SESSIONS_TAB_INDEX = 3;
79+
const EVAL_TAB_INDEX = 4;
8280

8381
describe('SidePanelComponent', () => {
8482
let component: SidePanelComponent;

0 commit comments

Comments
 (0)