Skip to content

Commit

Permalink
test scenario passing
Browse files Browse the repository at this point in the history
  • Loading branch information
ghuntley committed Sep 8, 2021
1 parent fd4eb24 commit 0c4551e
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 18 deletions.
16 changes: 8 additions & 8 deletions components/server/src/bitbucket/bitbucket-context-parser.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ class TestBitbucketContextParser {
"ref": "feature/JIRA-123-summary",
"refType": "branch",
"path": "",
"revision": "5a24a0c8a7b42c2e6418593d788e17cb987bda25",
"revision": "bcf3a4b9329385b7a5f50a4490b79570da029cf3",
"isFile": false,
"repository": {
"host": "bitbucket.org",
Expand Down Expand Up @@ -386,8 +386,8 @@ class TestBitbucketContextParser {
"repository": {
"host": "bitbucket.org",
"owner": "corneliusltf",
"name": "integration-tests",
"cloneUrl": "https://bitbucket.org/corneliusltf/integration-tests.git",
"name": "sample-repository",
"cloneUrl": "https://bitbucket.org/corneliusltf/sample-repository.git",
"defaultBranch": "master",
"private": false,
"fork": {
Expand Down Expand Up @@ -443,18 +443,18 @@ class TestBitbucketContextParser {
}

@test public async testSrcContextForkedRepo_01() {
const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/clu-sample-repo/src/master/');
const result = await this.parser.handle({}, this.user, 'https://bitbucket.org/gitpod/integration-tests-forked-repository/src/master/');
expect(result).to.deep.include({
"ref": "master",
"refType": "branch",
"path": "",
"revision": "d932021835e4024136a4f608719720d414490c73",
"revision": "3f1c8403570427170bd3776cfb3aa24c688c2b29",
"isFile": false,
"repository": {
"host": "bitbucket.org",
"owner": "gitpod",
"name": "clu-sample-repo",
"cloneUrl": "https://bitbucket.org/gitpod/clu-sample-repo.git",
"name": "integration-tests-forked-repository",
"cloneUrl": "https://bitbucket.org/gitpod/integration-tests-forked-repository.git",
"defaultBranch": "master",
"private": false,
"fork": {
Expand All @@ -468,7 +468,7 @@ class TestBitbucketContextParser {
}
}
},
"title": "gitpod/clu-sample-repo - master"
"title": "gitpod/integration-tests-forked-repository - master"
})
}

Expand Down
4 changes: 2 additions & 2 deletions components/server/src/bitbucket/bitbucket-context-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ export class BitbucketContextParser extends AbstractContextParser implements ICo
}
case "branch": {
const more: Partial<NavigatorContext> = {};
const branch = moreSegments.length > 1 ? moreSegments[1] : "";
more.ref = branch;
const pathSegments = moreSegments.length > 1 ? moreSegments.slice(1) : [];
more.ref = pathSegments.join("/");
more.refType = "branch";
return this.handleNavigatorContext(ctx, user, host, owner, repoName, more);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ class TestBitbucketFileProvider {
}

@test public async testGetFileContents() {
const result = await this.fileProvider.getFileContent({ repository: { owner: "gitpod", name: "sample-repository" }, revision: "5a24a0c" } as Commit, this.user, "README.md");
const result = await this.fileProvider.getFileContent({ repository: { owner: "gitpod", name: "integration-tests" }, revision: "5a24a0c" } as Commit, this.user, "README.md");
expect(result).to.equal(`# README #
This is the readme of the second branch.`);
}

@test public async testGetLastChangeRevision() {
const result = await this.fileProvider.getLastChangeRevision({ owner: "gitpod", name: "sample-repository" } as Repository, "second-branch", this.user, "README.md");
const result = await this.fileProvider.getLastChangeRevision({ owner: "gitpod", name: "integration-tests" } as Repository, "second-branch", this.user, "README.md");
expect(result).to.equal("5a24a0c8a7b42c2e6418593d788e17cb987bda25");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class TestBitbucketLanguageProvider {
}

@test public async testGetLanguages() {
const result = await this.languageProvider.getLanguages({ owner: "gitpod", name: "sample-repository" } as Repository, this.user);
const result = await this.languageProvider.getLanguages({ owner: "gitpod", name: "integration-tests" } as Repository, this.user);
expect(result).to.deep.equal({ "markdown": 100.0 });
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ class TestBitbucketRepositoryProvider {
}

@test public async testGetRepo() {
const result = await this.repoProvider.getRepo(this.user, "gitpod", "sample-repository");
const result = await this.repoProvider.getRepo(this.user, "gitpod", "integration-tests");
expect(result).to.deep.include({
host: "bitbucket.org",
owner: "gitpod",
name: "sample-repository",
cloneUrl: "https://[email protected]/gitpod/sample-repository.git",
description: "This is a sample repository.",
webUrl: "https://bitbucket.org/gitpod/sample-repository",
name: "integration-tests",
cloneUrl: "https://gitpod-test@bitbucket.org/gitpod/integration-tests.git",
description: "This is the repository used for integration tests.",
webUrl: "https://bitbucket.org/gitpod/integration-tests",
});
}

Expand Down

0 comments on commit 0c4551e

Please sign in to comment.