Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nmaas Portal
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nmaas
nmaas Portal
Commits
86157fe3
Commit
86157fe3
authored
11 months ago
by
kbeyro
Browse files
Options
Downloads
Patches
Plain Diff
add test
parent
b0d1599e
No related branches found
No related tags found
1 merge request
!21
fix logic
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/app/appmarket/appmanagement/app-management-list/appmanagementlist.component.spec.ts
+43
-1
43 additions, 1 deletion
...t/app-management-list/appmanagementlist.component.spec.ts
with
43 additions
and
1 deletion
src/app/appmarket/appmanagement/app-management-list/appmanagementlist.component.spec.ts
+
43
−
1
View file @
86157fe3
...
@@ -12,17 +12,44 @@ import {FormsModule} from '@angular/forms';
...
@@ -12,17 +12,44 @@ import {FormsModule} from '@angular/forms';
import
{
BrowserModule
}
from
'
@angular/platform-browser
'
;
import
{
BrowserModule
}
from
'
@angular/platform-browser
'
;
import
{
MockAuthService
}
from
'
../../appmarket.component.spec
'
;
import
{
MockAuthService
}
from
'
../../appmarket.component.spec
'
;
import
{
CUSTOM_ELEMENTS_SCHEMA
}
from
'
@angular/core
'
;
import
{
CUSTOM_ELEMENTS_SCHEMA
}
from
'
@angular/core
'
;
import
{
ApplicationBase
}
from
'
../../../model/application-base
'
;
import
{
ApplicationState
}
from
'
../../../model/application-state
'
;
import
{
Rate
}
from
'
../../../model
'
;
import
{
RemovalConfirmationModalComponent
}
from
'
../../domains/modals/removal-confirmation-modal/removal-confirmation-modal.component
'
;
describe
(
'
AppManagementListComponent
'
,
()
=>
{
describe
(
'
AppManagementListComponent
'
,
()
=>
{
let
component
:
AppManagementListComponent
;
let
component
:
AppManagementListComponent
;
let
fixture
:
ComponentFixture
<
AppManagementListComponent
>
;
let
fixture
:
ComponentFixture
<
AppManagementListComponent
>
;
let
confirmRemovalModal
:
ModalComponent
=
jasmine
.
createSpyObj
(
'
confirmRemovalModal
'
,
[
'
show
'
])
const
appBase
:
ApplicationBase
=
{
id
:
1
,
name
:
'
app
'
,
owner
:
'
admin
'
,
license
:
undefined
,
licenseUrl
:
undefined
,
wwwUrl
:
undefined
,
sourceUrl
:
undefined
,
issuesUrl
:
undefined
,
nmaasDocumentationUrl
:
undefined
,
descriptions
:
[],
tags
:
[],
versions
:
[
{
id
:
1
,
version
:
'
1.0.0
'
,
state
:
ApplicationState
.
ACTIVE
,
appVersionId
:
1
},
{
id
:
2
,
version
:
'
1.0.1
'
,
state
:
ApplicationState
.
ACTIVE
,
appVersionId
:
2
},
{
id
:
3
,
version
:
'
1.0.3
'
,
state
:
ApplicationState
.
NEW
,
appVersionId
:
3
}
],
rate
:
new
Rate
(
4
,
4.5
,
new
Map
([[
5
,
1
],
[
4
,
1
]]))
}
beforeEach
(
waitForAsync
(()
=>
{
beforeEach
(
waitForAsync
(()
=>
{
TestBed
.
configureTestingModule
({
TestBed
.
configureTestingModule
({
declarations
:
[
declarations
:
[
AppManagementListComponent
,
AppManagementListComponent
,
AppChangeStateModalComponent
,
AppChangeStateModalComponent
,
ModalComponent
ModalComponent
,
RemovalConfirmationModalComponent
],
],
providers
:
[
providers
:
[
AppsService
,
AppsService
,
...
@@ -55,4 +82,19 @@ describe('AppManagementListComponent', () => {
...
@@ -55,4 +82,19 @@ describe('AppManagementListComponent', () => {
it
(
'
should create
'
,
()
=>
{
it
(
'
should create
'
,
()
=>
{
expect
(
component
).
toBeTruthy
();
expect
(
component
).
toBeTruthy
();
});
});
it
(
'
should not be able to remove app
'
,
()
=>
{
component
.
openRemovalModal
(
appBase
);
expect
(
component
.
appToRemove
).
toEqual
(
appBase
);
expect
(
component
.
hasRunningInstances
).
toBeTruthy
;
})
it
(
'
should be able to remove app
'
,
()
=>
{
appBase
.
versions
.
forEach
(
ver
=>
{
ver
.
state
=
ApplicationState
.
DELETED
})
component
.
openRemovalModal
(
appBase
);
expect
(
component
.
appToRemove
).
toEqual
(
appBase
);
expect
(
component
.
hasRunningInstances
).
toBeFalsy
;
})
});
});
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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