-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
BAUVENT Kilian
committed
Sep 5, 2024
1 parent
3dddb4e
commit 8f78d52
Showing
5 changed files
with
109 additions
and
6 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
src/GitLabHealth-Model-Analysis-Tests/ClosedTicketsMetricTest.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
" | ||
A ClosedTicketsMetricTest is a test class for testing the behavior of ClosedTicketsMetric | ||
" | ||
Class { | ||
#name : #ClosedTicketsMetricTest, | ||
#superclass : #TestCase, | ||
#category : #'GitLabHealth-Model-Analysis-Tests' | ||
} | ||
|
||
{ #category : #tests } | ||
ClosedTicketsMetricTest >> testCalculate [ | ||
|
||
| result glhImporter user closedTicket jiraImporter | | ||
"Given" | ||
user := GLHUser new | ||
username: 'test'; | ||
contributedProjects: | ||
{ (GLHProject new repository: GLHRepository new) }. | ||
|
||
glhImporter := GLPHImporterMock new. | ||
glhImporter mergeRequests: { (GLPHEMergeRequest new | ||
author: user; | ||
created_at: '09-05-2024'; | ||
title: '205 feat do something') }. | ||
|
||
jiraImporter := JiraImporterMock new. | ||
jiraImporter issues: { (JPIssue new key: '205') }. | ||
|
||
|
||
closedTicket := ClosedTicketsMetric new | ||
user: user; | ||
glhImporter: glhImporter; | ||
jiraImporter: jiraImporter; | ||
setPeriodSince: '09-04-2024' until: '09-04-2024'; | ||
over: Week. | ||
|
||
"When" | ||
result := closedTicket calculate. | ||
|
||
"Then" | ||
self assert: result equals: 1 | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
src/GitLabHealth-Model-Analysis-Tests/JiraImporterMock.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
Class { | ||
#name : #JiraImporterMock, | ||
#superclass : #Object, | ||
#instVars : [ | ||
'issues', | ||
'model' | ||
], | ||
#category : #'GitLabHealth-Model-Analysis-Tests' | ||
} | ||
|
||
{ #category : #'api - import' } | ||
JiraImporterMock >> importAllCurrentAndPastIssuesOf: email [ | ||
|
||
model addAll: issues. | ||
^ issues | ||
] | ||
|
||
{ #category : #initialization } | ||
JiraImporterMock >> initialize [ | ||
model := GLPHEModel new name: 'model' | ||
] | ||
|
||
{ #category : #accessing } | ||
JiraImporterMock >> issues [ | ||
|
||
^ issues | ||
] | ||
|
||
{ #category : #accessing } | ||
JiraImporterMock >> issues: anObject [ | ||
|
||
issues := anObject | ||
] | ||
|
||
{ #category : #accessing } | ||
JiraImporterMock >> model [ | ||
|
||
^ model | ||
] | ||
|
||
{ #category : #accessing } | ||
JiraImporterMock >> model: anObject [ | ||
|
||
model := anObject | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters