Skip to content

Commit

Permalink
test: fix 'update' test by removing @Throttle
Browse files Browse the repository at this point in the history
  • Loading branch information
senyai committed Jun 13, 2023
1 parent e7fad04 commit 15012e9
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/interaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -827,7 +827,7 @@ export async function presentLogSourcesMenu(
}
}

export async function presentLogMenu(
async function presentLogMenu(
source: CommitSources,
logOptions: LogEntryOptions,
commands: InteractionAPI,
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -790,7 +790,7 @@ export class Repository implements IDisposable, InteractionAPI {
);
}

@throttle
// @throttle
async update(checkin: FossilCheckin): Promise<void> {
await this.runWithProgress(Operation.Update, () =>
this.repository.update(checkin)
Expand Down
12 changes: 8 additions & 4 deletions src/test/suite/test_commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ export async function fossil_pull_with_autoUpdate_on(
sandbox: sinon.SinonSandbox
): Promise<void> {
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);
}

Expand All @@ -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 {
Expand Down

0 comments on commit 15012e9

Please sign in to comment.