aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/api/mocks/AlmIntegrationsServiceMock.ts
diff options
context:
space:
mode:
authorAmbroise C <ambroise.christea@sonarsource.com>2024-12-04 15:53:07 +0100
committerSteve Marion <steve.marion@sonarsource.com>2024-12-18 11:13:22 +0100
commit197f74d0b86b047a56b1984d209b48067a469d72 (patch)
tree84d0477022bd0ca253cf512ebb36a31174598616 /server/sonar-web/src/main/js/api/mocks/AlmIntegrationsServiceMock.ts
parentc904275278dfd43d37aa14796c1358fe02ed20f6 (diff)
downloadsonarqube-197f74d0b86b047a56b1984d209b48067a469d72.tar.gz
sonarqube-197f74d0b86b047a56b1984d209b48067a469d72.zip
SONAR-23268 Add pagination to API functions
Diffstat (limited to 'server/sonar-web/src/main/js/api/mocks/AlmIntegrationsServiceMock.ts')
-rw-r--r--server/sonar-web/src/main/js/api/mocks/AlmIntegrationsServiceMock.ts25
1 files changed, 17 insertions, 8 deletions
diff --git a/server/sonar-web/src/main/js/api/mocks/AlmIntegrationsServiceMock.ts b/server/sonar-web/src/main/js/api/mocks/AlmIntegrationsServiceMock.ts
index 540e0ebfbf6..752d8d3cb22 100644
--- a/server/sonar-web/src/main/js/api/mocks/AlmIntegrationsServiceMock.ts
+++ b/server/sonar-web/src/main/js/api/mocks/AlmIntegrationsServiceMock.ts
@@ -77,7 +77,8 @@ export default class AlmIntegrationsServiceMock {
githubRepositories: GithubRepository[];
pagination: Paging;
bitbucketCloudRepositories: BitbucketCloudRepository[];
- bitbucketIsLastPage: boolean;
+ bitbucketProjectsIsLastPage: boolean;
+ bitbucketReposIsLastPage: boolean;
bitbucketRepositories: BitbucketRepository[];
bitbucketProjects: BitbucketProject[];
defaultAlmInstancePATMap: { [key: string]: boolean } = {
@@ -189,7 +190,8 @@ export default class AlmIntegrationsServiceMock {
this.githubRepositories = cloneDeep(this.defaultGithubRepositories);
this.bitbucketRepositories = cloneDeep(this.defaultBitbucketRepositories);
this.bitbucketProjects = cloneDeep(this.defaultBitbucketProjects);
- this.bitbucketIsLastPage = true;
+ this.bitbucketProjectsIsLastPage = true;
+ this.bitbucketReposIsLastPage = true;
jest
.mocked(checkPersonalAccessTokenIsValid)
.mockImplementation(this.checkPersonalAccessTokenIsValid);
@@ -267,7 +269,7 @@ export default class AlmIntegrationsServiceMock {
searchForBitbucketCloudRepositories = () => {
return Promise.resolve({
- isLastPage: this.bitbucketIsLastPage,
+ isLastPage: this.bitbucketReposIsLastPage,
repositories: this.bitbucketCloudRepositories,
});
};
@@ -311,7 +313,7 @@ export default class AlmIntegrationsServiceMock {
});
this.bitbucketCloudRepositories = generatedRepositories;
- this.bitbucketIsLastPage = quantity >= total;
+ this.bitbucketReposIsLastPage = quantity >= total;
}
createRandomGithubRepositoriessWithLoadMore(quantity: number, total: number) {
@@ -362,12 +364,17 @@ export default class AlmIntegrationsServiceMock {
};
getBitbucketServerProjects = () => {
- return Promise.resolve({ projects: this.bitbucketProjects });
+ return Promise.resolve({
+ isLastPage: this.bitbucketProjectsIsLastPage,
+ nextPageStart: this.bitbucketProjects.length - Number(this.bitbucketProjectsIsLastPage),
+ projects: this.bitbucketProjects,
+ });
};
getBitbucketServerRepositories = () => {
return Promise.resolve({
- isLastPage: this.bitbucketIsLastPage,
+ isLastPage: this.bitbucketReposIsLastPage,
+ nextPageStart: this.bitbucketRepositories.length - Number(this.bitbucketReposIsLastPage),
repositories: this.bitbucketRepositories,
});
};
@@ -389,7 +396,8 @@ export default class AlmIntegrationsServiceMock {
searchForBitbucketServerRepositories = () => {
return Promise.resolve({
- isLastPage: this.bitbucketIsLastPage,
+ isLastPage: this.bitbucketReposIsLastPage,
+ nextPageStart: this.bitbucketRepositories.length - Number(this.bitbucketReposIsLastPage),
repositories: this.bitbucketRepositories,
});
};
@@ -402,6 +410,7 @@ export default class AlmIntegrationsServiceMock {
this.bitbucketCloudRepositories = cloneDeep(this.defaultBitbucketCloudRepositories);
this.bitbucketRepositories = cloneDeep(this.defaultBitbucketRepositories);
this.bitbucketProjects = cloneDeep(this.defaultBitbucketProjects);
- this.bitbucketIsLastPage = true;
+ this.bitbucketProjectsIsLastPage = true;
+ this.bitbucketReposIsLastPage = true;
};
}