aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/helpers
diff options
context:
space:
mode:
authorWouter Admiraal <wouter.admiraal@sonarsource.com>2022-10-11 14:12:17 +0200
committersonartech <sonartech@sonarsource.com>2022-10-13 20:03:19 +0000
commit1a4d4ee96aef0362cc70361a4cf0359411674fcb (patch)
treef54e1831a243932d71a8a33b82a3162ede2fb44e /server/sonar-web/src/main/js/helpers
parentf0dc1938077a3bf4b4e8ba6baf9687404b6c8f5f (diff)
downloadsonarqube-1a4d4ee96aef0362cc70361a4cf0359411674fcb.tar.gz
sonarqube-1a4d4ee96aef0362cc70361a4cf0359411674fcb.zip
SONAR-17004 SONAR-17011 Write RTL ITs
Diffstat (limited to 'server/sonar-web/src/main/js/helpers')
-rw-r--r--server/sonar-web/src/main/js/helpers/mocks/project-activity.ts29
1 files changed, 28 insertions, 1 deletions
diff --git a/server/sonar-web/src/main/js/helpers/mocks/project-activity.ts b/server/sonar-web/src/main/js/helpers/mocks/project-activity.ts
index 439bf4a576d..c8c366bdea3 100644
--- a/server/sonar-web/src/main/js/helpers/mocks/project-activity.ts
+++ b/server/sonar-web/src/main/js/helpers/mocks/project-activity.ts
@@ -18,7 +18,14 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-import { Analysis, AnalysisEvent, ParsedAnalysis } from '../../types/project-activity';
+import {
+ Analysis,
+ AnalysisEvent,
+ HistoryItem,
+ MeasureHistory,
+ ParsedAnalysis
+} from '../../types/project-activity';
+import { parseDate } from '../dates';
export function mockAnalysis(overrides: Partial<Analysis> = {}): Analysis {
return {
@@ -65,3 +72,23 @@ export function mockAnalysisEvent(overrides: Partial<AnalysisEvent> = {}): Analy
...overrides
};
}
+
+export function mockMeasureHistory(overrides: Partial<MeasureHistory> = {}): MeasureHistory {
+ return {
+ metric: 'code_smells',
+ history: [
+ mockHistoryItem(),
+ mockHistoryItem({ date: parseDate('2018-10-27T12:21:15+0200'), value: '1749' }),
+ mockHistoryItem({ date: parseDate('2020-10-27T16:33:50+0200'), value: '500' })
+ ],
+ ...overrides
+ };
+}
+
+export function mockHistoryItem(overrides: Partial<HistoryItem> = {}): HistoryItem {
+ return {
+ date: parseDate('2016-10-26T12:17:29+0200'),
+ value: '2286',
+ ...overrides
+ };
+}