This is the codeAbility Sharing Platform! Learn more about the
codeAbility Sharing Platform
.
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
codeAbility Sharing Platform
Manage
Activity
Members
Labels
Plan
Issues
43
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
development
sharing
codeAbility Sharing Platform
Commits
e7183008
Commit
e7183008
authored
1 year ago
by
Michael Breu
Browse files
Options
Downloads
Patches
Plain Diff
more test coverage
parent
7c867e49
3 merge requests
!188
Merging Peer Reviewing et. al to Master
,
!181
Resolve "Prüfen des Caches der Review Badge Statistiken"
,
!164
211 peer reviewing functionality
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/webapp/app/layouts/navbar/navbar-badge.component.spec.ts
+62
-1
62 additions, 1 deletion
.../webapp/app/layouts/navbar/navbar-badge.component.spec.ts
with
62 additions
and
1 deletion
src/main/webapp/app/layouts/navbar/navbar-badge.component.spec.ts
+
62
−
1
View file @
e7183008
...
...
@@ -13,7 +13,7 @@ import { AccountService } from 'app/core/auth/account.service';
import
{
ProfileService
}
from
'
app/layouts/profiles/profile.service
'
;
import
{
LoginService
}
from
'
app/login/login.service
'
;
import
{
ReviewMenuBadgeComponent
,
ReviewRequestedMenuBadgeComponent
}
from
'
./navbar.component
'
;
import
{
ImprovementsRequestedMenuBadgeComponent
,
ReviewMenuBadgeComponent
,
ReviewRequestedMenuBadgeComponent
}
from
'
./navbar.component
'
;
import
{
ReactiveFormsModule
}
from
'
@angular/forms
'
;
import
{
ReviewManagementService
}
from
'
../../../../../../bin/src/main/webapp/app/admin/review-management/review-management.service
'
;
import
{
ApplicationConfigService
}
from
'
app/core/config/application-config.service
'
;
...
...
@@ -140,3 +140,64 @@ describe('ReviewRequestedMenuBadge Component', () => {
expect
(
comp
.
getReviewRequestedLabel
()).
toEqual
(
'
5 reviews request, but not yet assigned.
'
);
});
});
describe
(
'
ImprovementsRequestedMenuBadge Component
'
,
()
=>
{
let
comp
:
ImprovementsRequestedMenuBadgeComponent
;
let
fixture
:
ComponentFixture
<
ImprovementsRequestedMenuBadgeComponent
>
;
let
accountService
:
AccountService
;
let
reviewManagementService
:
ReviewManagementService
;
let
httpMock
:
HttpTestingController
;
let
applicationConfigService
:
ApplicationConfigService
;
const
stats
=
{
reviewInProgress
:
1
,
reviewImproved
:
2
,
reviewCompleted
:
3
,
unknownStats
:
4
,
reviewsRequestedByUser
:
5
,
reviewInProgressByUser
:
6
,
reviewImprovementRequestedByUser
:
7
,
reviewCompletedByUser
:
8
,
unknownStatsByUser
:
9
,
badgesRewarded
:
10
,
};
beforeEach
(
waitForAsync
(()
=>
{
TestBed
.
configureTestingModule
({
imports
:
[
HttpClientTestingModule
,
RouterTestingModule
.
withRoutes
([]),
ReactiveFormsModule
,
TranslateModule
.
forRoot
(),
NgxWebstorageModule
.
forRoot
(),
],
declarations
:
[
ReviewMenuBadgeComponent
],
providers
:
[
LoginService
,
ReviewManagementService
],
}).
compileComponents
();
})
);
beforeEach
(()
=>
{
fixture
=
TestBed
.
createComponent
(
ImprovementsRequestedMenuBadgeComponent
);
comp
=
fixture
.
componentInstance
;
accountService
=
TestBed
.
inject
(
AccountService
);
applicationConfigService
=
TestBed
.
inject
(
ApplicationConfigService
);
reviewManagementService
=
TestBed
.
inject
(
ReviewManagementService
);
httpMock
=
TestBed
.
inject
(
HttpTestingController
);
});
it
(
'
Should call reviewManagementService.getReviewStatistics on init
'
,
()
=>
{
// WHEN
comp
.
ngOnInit
();
// WHEN
const
testRequest
=
httpMock
.
expectOne
({
method
:
'
POST
'
,
url
:
applicationConfigService
.
getEndpointFor
(
'
api/review/countAllByUser
'
),
});
testRequest
.
flush
(
stats
);
expect
(
comp
.
getReviewRequestedCount
()).
toEqual
(
7
);
expect
(
comp
.
getReviewRquestedLabel
()).
toEqual
(
'
7 review(s) resulted in an improvements request
'
);
});
});
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment