diff options
author | Mathieu Suen <mathieu.suen@sonarsource.com> | 2022-08-30 10:12:39 +0200 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2022-08-30 20:03:14 +0000 |
commit | b6ddc6b31a7626208fc37343cbbd2f2e5c6cac32 (patch) | |
tree | 8f0eef29fca7e4ad0b6e82439d04d3cad37546eb /server/sonar-web/src/main/js/api | |
parent | ba9de63075349b9791f1b1fbf7d4f5d6c06fb72b (diff) | |
download | sonarqube-b6ddc6b31a7626208fc37343cbbd2f2e5c6cac32.tar.gz sonarqube-b6ddc6b31a7626208fc37343cbbd2f2e5c6cac32.zip |
[NO-JIRA] Clean and improve issues page tests
Diffstat (limited to 'server/sonar-web/src/main/js/api')
-rw-r--r-- | server/sonar-web/src/main/js/api/mocks/IssuesServiceMock.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/server/sonar-web/src/main/js/api/mocks/IssuesServiceMock.ts b/server/sonar-web/src/main/js/api/mocks/IssuesServiceMock.ts index ac260fff216..cca51bbd35f 100644 --- a/server/sonar-web/src/main/js/api/mocks/IssuesServiceMock.ts +++ b/server/sonar-web/src/main/js/api/mocks/IssuesServiceMock.ts @@ -53,6 +53,7 @@ import { NoticeType } from '../../types/users'; import { getComponentForSourceViewer, getSources } from '../components'; import { addIssueComment, + bulkChangeIssues, deleteIssueComment, editIssueComment, getIssueFlowSnippets, @@ -252,6 +253,7 @@ export default class IssuesServiceMock { (getComponentForSourceViewer as jest.Mock).mockImplementation( this.handleGetComponentForSourceViewer ); + (bulkChangeIssues as jest.Mock).mockImplementation(this.handleBulkChangeIssues); (getCurrentUser as jest.Mock).mockImplementation(this.handleGetCurrentUser); (dismissNotice as jest.Mock).mockImplementation(this.handleDismissNotification); (setIssueType as jest.Mock).mockImplementation(this.handleSetIssueType); @@ -285,6 +287,16 @@ export default class IssuesServiceMock { this.isAdmin = isAdmin; } + handleBulkChangeIssues = (issueKeys: string[], query: RequestData) => { + //For now we only check for issue type change. + this.list + .filter(i => issueKeys.includes(i.issue.key)) + .forEach(data => { + data.issue.type = query.set_type; + }); + return this.reply({}); + }; + handleGetSources = (data: { key: string; from?: number; to?: number } & BranchParameters) => { return this.reply(range(data.from || 1, data.to || 10).map(line => mockSourceLine({ line }))); }; |