aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/api/mocks/AiCodeAssuredServiceMock.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/sonar-web/src/main/js/api/mocks/AiCodeAssuredServiceMock.ts')
-rw-r--r--server/sonar-web/src/main/js/api/mocks/AiCodeAssuredServiceMock.ts17
1 files changed, 12 insertions, 5 deletions
diff --git a/server/sonar-web/src/main/js/api/mocks/AiCodeAssuredServiceMock.ts b/server/sonar-web/src/main/js/api/mocks/AiCodeAssuredServiceMock.ts
index da0a0668abe..825b48c2ea9 100644
--- a/server/sonar-web/src/main/js/api/mocks/AiCodeAssuredServiceMock.ts
+++ b/server/sonar-web/src/main/js/api/mocks/AiCodeAssuredServiceMock.ts
@@ -18,22 +18,29 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { isProjectAiCodeAssured } from '../ai-code-assurance';
+import { AiCodeAssuranceStatus, getProjectAiCodeAssuranceStatus } from '../ai-code-assurance';
jest.mock('../ai-code-assurance');
+export const PROJECT_WITH_AI_ASSURED_QG = 'Sonar AI way';
+export const PROJECT_WITHOUT_AI_ASSURED_QG = 'Sonar way';
+
export class AiCodeAssuredServiceMock {
noAiProject = 'no-ai';
constructor() {
- jest.mocked(isProjectAiCodeAssured).mockImplementation(this.handleProjectAiGeneratedCode);
+ jest
+ .mocked(getProjectAiCodeAssuranceStatus)
+ .mockImplementation(this.handleProjectAiGeneratedCode);
}
handleProjectAiGeneratedCode = (project: string) => {
- if (project === this.noAiProject) {
- return Promise.resolve(false);
+ if (project === PROJECT_WITH_AI_ASSURED_QG) {
+ return Promise.resolve(AiCodeAssuranceStatus.AI_CODE_ASSURED);
+ } else if (project === PROJECT_WITHOUT_AI_ASSURED_QG) {
+ return Promise.resolve(AiCodeAssuranceStatus.CONTAINS_AI_CODE);
}
- return Promise.resolve(true);
+ return Promise.resolve(AiCodeAssuranceStatus.NONE);
};
reset() {