Skip to content

Commit

Permalink
test: fix: support older version of fossil
Browse files Browse the repository at this point in the history
  • Loading branch information
senyai committed Jul 29, 2023
1 parent 93094b1 commit 1c3bdd5
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/fossilExecutable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ export class FossilExecutable {
} else if (/--force\b/.test(result.stderr)) {
return 'OperationMustBeForced';
} else if (
/^(a branch of the same name|an open branch named ".*") already exists/.test(
/^(a branch of the same name|an open branch named ".*"|branch ".*") already exists/.test(
result.stderr
)
) {
Expand Down
8 changes: 5 additions & 3 deletions src/test/suite/commitSuite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ import {
} from './common';
import * as assert from 'assert/strict';
import * as fs from 'fs/promises';
import { Suite, afterEach } from 'mocha';
import { Suite, before, beforeEach } from 'mocha';

export function CommitSuite(this: Suite): void {
afterEach(function () {
const clearInputBox = () => {
const repository = getRepository();
repository.sourceControl.inputBox.value = '';
});
};
before(clearInputBox);
beforeEach(clearInputBox);

test('Commit using input box', async () => {
const repository = getRepository();
Expand Down
2 changes: 1 addition & 1 deletion src/test/suite/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export function getRepository(): Repository {
const extension = vscode.extensions.getExtension('koog1000.fossil');
assert.ok(extension);
const model = extension.exports as Model;
assert.ok(model.repositories.length);
assert.equal(model.repositories.length, 1);
return model.repositories[0];
}

Expand Down
4 changes: 3 additions & 1 deletion src/test/suite/setup.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,9 @@ suite('Setup', () => {
await vscode.commands.executeCommand('fossil.close');
sinon.assert.calledOnceWithExactly(
swm,
'Fossil: there are unsaved changes in the current check-out\n'
sinon.match(
/^Fossil: there are unsaved changes in the current check-?out\n$/
)
);
}).timeout(3500);

Expand Down
4 changes: 2 additions & 2 deletions src/test/suite/test_commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ export function BranchSuite(this: Suite): void {

const swm: sinon.SinonStub = this.ctx.sandbox
.stub(window, 'showWarningMessage')
.resolves(undefined);
.resolves();

const creation = getExecStub(this.ctx.sandbox).withArgs([
'branch',
Expand All @@ -201,7 +201,7 @@ export function BranchSuite(this: Suite): void {
'&&Update',
'&&Re-open'
);
}).timeout(4500);
}).timeout(14500);

test('Create private branch', async () => {
const cib = this.ctx.sandbox.stub(window, 'createInputBox');
Expand Down

0 comments on commit 1c3bdd5

Please sign in to comment.