Skip to content

Commit 4d51976

Browse files
ergunshDevtools-frontend LUCI CQ
authored andcommitted
[AiAssistance] Reset aiHistoryStorage before "should switch agents..." test
Otherwise, the `AiHistoryStorage` instance leaks to this test and it is failing based on the order of the test run. Bug: none Change-Id: Ibeebe87395f99c31f5bd2368c0c6ea12f97fa70d Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/6366902 Commit-Queue: Nikolay Vitkov <[email protected]> Auto-Submit: Ergün Erdoğmuş <[email protected]> Reviewed-by: Nikolay Vitkov <[email protected]> Commit-Queue: Ergün Erdoğmuş <[email protected]>
1 parent f395cc3 commit 4d51976

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

front_end/panels/ai_assistance/AiAssistancePanel.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -590,6 +590,8 @@ describeWithMockConnection('AI Assistance Panel', () => {
590590
enabled: true,
591591
},
592592
});
593+
const aiHistoryStorage = AiAssistance.AiHistoryStorage.instance({forceNew: true});
594+
const deleteHistoryEntryStub = sinon.stub(aiHistoryStorage, 'deleteHistoryEntry');
593595
const {panel, view} = await createAiAssistancePanel(
594596
{
595597
aidaClient: mockAidaClient(
@@ -612,13 +614,11 @@ describeWithMockConnection('AI Assistance Panel', () => {
612614
contextMenu.invokeHandler(id);
613615
await view.nextInput;
614616

615-
const stub = sinon.createStubInstance(AiAssistance.AiHistoryStorage);
616-
sinon.stub(AiAssistance.AiHistoryStorage, 'instance').returns(stub);
617617
view.input.onDeleteClick();
618618

619619
assert.deepEqual((await view.nextInput).messages, []);
620-
assert.strictEqual(stub.deleteHistoryEntry.callCount, 1);
621-
assert.isString(stub.deleteHistoryEntry.lastCall.args[0]);
620+
assert.strictEqual(deleteHistoryEntryStub.callCount, 1);
621+
assert.isString(deleteHistoryEntryStub.lastCall.args[0]);
622622

623623
const menuAfterDelete = openHistoryContextMenu(view.input, 'User question to Freestyler?');
624624
assert.isUndefined(menuAfterDelete.id);

0 commit comments

Comments
 (0)