From 15012e93cbffb2fd96d24d87d687c4a19ed601a6 Mon Sep 17 00:00:00 2001 From: Arseniy Terekhin Date: Tue, 13 Jun 2023 21:44:46 +0300 Subject: [PATCH] test: fix 'update' test by removing @throttle --- src/interaction.ts | 4 ++-- src/repository.ts | 2 +- src/test/suite/test_commands.ts | 12 ++++++++---- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/interaction.ts b/src/interaction.ts index c4be6d1..a76b138 100644 --- a/src/interaction.ts +++ b/src/interaction.ts @@ -827,7 +827,7 @@ export async function presentLogSourcesMenu( } } -export async function presentLogMenu( +async function presentLogMenu( source: CommitSources, logOptions: LogEntryOptions, commands: InteractionAPI, @@ -948,7 +948,7 @@ export async function pickStashItem( /** * use selected commit in 'fossil.log' command */ -export async function presentCommitDetails( +async function presentCommitDetails( details: CommitDetails, back: RunnableQuickPickItem, commands: InteractionAPI diff --git a/src/repository.ts b/src/repository.ts index c1bd8b5..d559807 100644 --- a/src/repository.ts +++ b/src/repository.ts @@ -790,7 +790,7 @@ export class Repository implements IDisposable, InteractionAPI { ); } - @throttle + // @throttle async update(checkin: FossilCheckin): Promise { await this.runWithProgress(Operation.Update, () => this.repository.update(checkin) diff --git a/src/test/suite/test_commands.ts b/src/test/suite/test_commands.ts index 7c44ac8..c49a1aa 100644 --- a/src/test/suite/test_commands.ts +++ b/src/test/suite/test_commands.ts @@ -78,8 +78,10 @@ export async function fossil_pull_with_autoUpdate_on( sandbox: sinon.SinonSandbox ): Promise { const execStub = getExecStub(sandbox); - const updateCall = execStub.withArgs(['update']); + const sem = sandbox.stub(window, 'showErrorMessage').resolves(); + const updateCall = execStub.withArgs(['update']).resolves(); await commands.executeCommand('fossil.pull'); + sinon.assert.notCalled(sem); sinon.assert.calledOnce(updateCall); } @@ -90,12 +92,14 @@ export async function fossil_pull_with_autoUpdate_off( 'fossil', workspace.workspaceFolders![0].uri ); + const sem = sandbox.stub(window, 'showErrorMessage').resolves(); await fossilConfig.update('autoUpdate', false); const execStub = getExecStub(sandbox); - const updateCall = execStub.withArgs(['pull']); - updateCall.resolves(undefined); // stub as 'undefined' as we can't do pull + const pullCall = execStub.withArgs(['pull']).resolves(); await commands.executeCommand('fossil.pull'); - sinon.assert.calledOnce(updateCall); + sinon.assert.notCalled(sem); + sinon.assert.calledOnce(pullCall); + await fossilConfig.update('autoUpdate', true); } export function fossil_revert_suite(sandbox: sinon.SinonSandbox): void {