diff options
author | Wouter Admiraal <wouter.admiraal@sonarsource.com> | 2022-12-28 16:23:39 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2023-01-02 20:03:09 +0000 |
commit | 4da2fd9191d43a75c7a6c4cc848cd048e6700844 (patch) | |
tree | 85982aa98ff80e8312841b5e4b2b0aa8082f2c48 /server/sonar-web/src/main/js/helpers/mocks/sources.ts | |
parent | f3c01c86ab9e7db644c40b4105c10b08ddfbd8a5 (diff) | |
download | sonarqube-4da2fd9191d43a75c7a6c4cc848cd048e6700844.tar.gz sonarqube-4da2fd9191d43a75c7a6c4cc848cd048e6700844.zip |
[NO JIRA] Migrate Code tests to RTL
Diffstat (limited to 'server/sonar-web/src/main/js/helpers/mocks/sources.ts')
-rw-r--r-- | server/sonar-web/src/main/js/helpers/mocks/sources.ts | 34 |
1 files changed, 33 insertions, 1 deletions
diff --git a/server/sonar-web/src/main/js/helpers/mocks/sources.ts b/server/sonar-web/src/main/js/helpers/mocks/sources.ts index 0fe4db77452..87143adac82 100644 --- a/server/sonar-web/src/main/js/helpers/mocks/sources.ts +++ b/server/sonar-web/src/main/js/helpers/mocks/sources.ts @@ -19,7 +19,14 @@ */ import { ComponentQualifier } from '../../types/component'; -import { SnippetsByComponent, SourceLine, SourceViewerFile } from '../../types/types'; +import { + DuplicatedFile, + Duplication, + DuplicationBlock, + SnippetsByComponent, + SourceLine, + SourceViewerFile, +} from '../../types/types'; export function mockSourceViewerFile( name = 'foo/bar.ts', @@ -76,3 +83,28 @@ export function mockSnippetsByComponent( sources, }; } + +export function mockDuplicatedFile(overrides: Partial<DuplicatedFile> = {}): DuplicatedFile { + return { + key: 'file1.java', + name: overrides.key || 'file1.java', + project: 'foo', + projectName: 'Foo', + ...overrides, + }; +} + +export function mockDuplication(overrides: Partial<Duplication> = {}): Duplication { + return { + blocks: [mockDuplicationBlock()], + ...overrides, + }; +} + +export function mockDuplicationBlock(overrides: Partial<DuplicationBlock> = {}): DuplicationBlock { + return { + from: 12, + size: 5, + ...overrides, + }; +} |