Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
7a6d9b96
Commit
7a6d9b96
authored
May 28, 2020
by
Daniel Tian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use vue-test-utils for Kubernetes apps tests
parent
ab130380
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
105 additions
and
181 deletions
+105
-181
spec/frontend/clusters/components/applications_spec.js
spec/frontend/clusters/components/applications_spec.js
+105
-181
No files found.
spec/frontend/clusters/components/applications_spec.js
View file @
7a6d9b96
import
Vue
from
'
vue
'
;
import
{
shallowMount
,
mount
}
from
'
@vue/test-utils
'
;
import
mountComponent
from
'
helpers/vue_mount_component_helper
'
;
import
Applications
from
'
~/clusters/components/applications.vue
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
applications
from
'
~/clusters/components/applications.vue
'
;
import
{
CLUSTER_TYPE
}
from
'
~/clusters/constants
'
;
import
{
CLUSTER_TYPE
}
from
'
~/clusters/constants
'
;
import
{
APPLICATIONS_MOCK_STATE
}
from
'
../services/mock_data
'
;
import
{
APPLICATIONS_MOCK_STATE
}
from
'
../services/mock_data
'
;
import
eventHub
from
'
~/clusters/event_hub
'
;
import
eventHub
from
'
~/clusters/event_hub
'
;
import
ApplicationRow
from
'
~/clusters/components/application_row.vue
'
;
import
KnativeDomainEditor
from
'
~/clusters/components/knative_domain_editor.vue
'
;
import
KnativeDomainEditor
from
'
~/clusters/components/knative_domain_editor.vue
'
;
import
CrossplaneProviderStack
from
'
~/clusters/components/crossplane_provider_stack.vue
'
;
import
CrossplaneProviderStack
from
'
~/clusters/components/crossplane_provider_stack.vue
'
;
import
IngressModsecuritySettings
from
'
~/clusters/components/ingress_modsecurity_settings.vue
'
;
import
IngressModsecuritySettings
from
'
~/clusters/components/ingress_modsecurity_settings.vue
'
;
import
FluentdOutputSettings
from
'
~/clusters/components/fluentd_output_settings.vue
'
;
import
FluentdOutputSettings
from
'
~/clusters/components/fluentd_output_settings.vue
'
;
describe
(
'
Applications
'
,
()
=>
{
describe
(
'
Applications
'
,
()
=>
{
let
vm
;
let
wrapper
;
let
Applications
;
const
ApplicationRowStub
=
{
name
:
'
application-row-stub
'
,
template
:
`
<div>
<slot name="description"></slot>
</div>
`
,
};
beforeEach
(()
=>
{
beforeEach
(()
=>
{
Applications
=
Vue
.
extend
(
applications
);
gon
.
features
=
gon
.
features
||
{};
gon
.
features
=
gon
.
features
||
{};
gon
.
features
.
managedAppsLocalTiller
=
false
;
gon
.
features
.
managedAppsLocalTiller
=
false
;
});
});
const
createApp
=
({
applications
,
type
}
=
{},
isShallow
)
=>
{
const
mountMethod
=
isShallow
?
shallowMount
:
mount
;
wrapper
=
mountMethod
(
Applications
,
{
stubs
:
{
ApplicationRow
},
propsData
:
{
type
,
applications
:
{
...
APPLICATIONS_MOCK_STATE
,
...
applications
},
},
});
};
const
createShallowApp
=
options
=>
createApp
(
options
,
true
);
afterEach
(()
=>
{
afterEach
(()
=>
{
vm
.
$
destroy
();
wrapper
.
destroy
();
});
});
describe
(
'
Project cluster applications
'
,
()
=>
{
describe
(
'
Project cluster applications
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
vm
=
mountComponent
(
Applications
,
{
createApp
({
type
:
CLUSTER_TYPE
.
PROJECT
});
applications
:
APPLICATIONS_MOCK_STATE
,
type
:
CLUSTER_TYPE
.
PROJECT
,
});
});
});
it
(
'
renders a row for Helm Tiller
'
,
()
=>
{
it
(
'
renders a row for Helm Tiller
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-cluster-application-row-helm
'
)).
not
.
toBeNull
(
);
expect
(
wrapper
.
find
(
'
.js-cluster-application-row-helm
'
).
exists
()).
toBe
(
true
);
});
});
it
(
'
renders a row for Ingress
'
,
()
=>
{
it
(
'
renders a row for Ingress
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-cluster-application-row-ingress
'
)).
not
.
toBeNull
(
);
expect
(
wrapper
.
find
(
'
.js-cluster-application-row-ingress
'
).
exists
()).
toBe
(
true
);
});
});
it
(
'
renders a row for Cert-Manager
'
,
()
=>
{
it
(
'
renders a row for Cert-Manager
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-cluster-application-row-cert_manager
'
)).
not
.
toBeNull
(
);
expect
(
wrapper
.
find
(
'
.js-cluster-application-row-cert_manager
'
).
exists
()).
toBe
(
true
);
});
});
it
(
'
renders a row for Crossplane
'
,
()
=>
{
it
(
'
renders a row for Crossplane
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-cluster-application-row-crossplane
'
)).
not
.
toBeNull
(
);
expect
(
wrapper
.
find
(
'
.js-cluster-application-row-crossplane
'
).
exists
()).
toBe
(
true
);
});
});
it
(
'
renders a row for Prometheus
'
,
()
=>
{
it
(
'
renders a row for Prometheus
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-cluster-application-row-prometheus
'
)).
not
.
toBeNull
(
);
expect
(
wrapper
.
find
(
'
.js-cluster-application-row-prometheus
'
).
exists
()).
toBe
(
true
);
});
});
it
(
'
renders a row for GitLab Runner
'
,
()
=>
{
it
(
'
renders a row for GitLab Runner
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-cluster-application-row-runner
'
)).
not
.
toBeNull
(
);
expect
(
wrapper
.
find
(
'
.js-cluster-application-row-runner
'
).
exists
()).
toBe
(
true
);
});
});
it
(
'
renders a row for Jupyter
'
,
()
=>
{
it
(
'
renders a row for Jupyter
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-cluster-application-row-jupyter
'
)).
not
.
toBeNull
(
);
expect
(
wrapper
.
find
(
'
.js-cluster-application-row-jupyter
'
).
exists
()).
toBe
(
true
);
});
});
it
(
'
renders a row for Knative
'
,
()
=>
{
it
(
'
renders a row for Knative
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-cluster-application-row-knative
'
)).
not
.
toBeNull
(
);
expect
(
wrapper
.
find
(
'
.js-cluster-application-row-knative
'
).
exists
()).
toBe
(
true
);
});
});
it
(
'
renders a row for Elastic Stack
'
,
()
=>
{
it
(
'
renders a row for Elastic Stack
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-cluster-application-row-elastic_stack
'
)).
not
.
toBeNull
(
);
expect
(
wrapper
.
find
(
'
.js-cluster-application-row-elastic_stack
'
).
exists
()).
toBe
(
true
);
});
});
it
(
'
renders a row for Fluentd
'
,
()
=>
{
it
(
'
renders a row for Fluentd
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-cluster-application-row-fluentd
'
)).
not
.
toBeNull
(
);
expect
(
wrapper
.
find
(
'
.js-cluster-application-row-fluentd
'
).
exists
()).
toBe
(
true
);
});
});
});
});
describe
(
'
Group cluster applications
'
,
()
=>
{
describe
(
'
Group cluster applications
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
vm
=
mountComponent
(
Applications
,
{
createApp
({
type
:
CLUSTER_TYPE
.
GROUP
});
type
:
CLUSTER_TYPE
.
GROUP
,
applications
:
APPLICATIONS_MOCK_STATE
,
});
});
});
it
(
'
renders a row for Helm Tiller
'
,
()
=>
{
it
(
'
renders a row for Helm Tiller
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-cluster-application-row-helm
'
)).
not
.
toBeNull
(
);
expect
(
wrapper
.
find
(
'
.js-cluster-application-row-helm
'
).
exists
()).
toBe
(
true
);
});
});
it
(
'
renders a row for Ingress
'
,
()
=>
{
it
(
'
renders a row for Ingress
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-cluster-application-row-ingress
'
)).
not
.
toBeNull
(
);
expect
(
wrapper
.
find
(
'
.js-cluster-application-row-ingress
'
).
exists
()).
toBe
(
true
);
});
});
it
(
'
renders a row for Cert-Manager
'
,
()
=>
{
it
(
'
renders a row for Cert-Manager
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-cluster-application-row-cert_manager
'
)).
not
.
toBeNull
(
);
expect
(
wrapper
.
find
(
'
.js-cluster-application-row-cert_manager
'
).
exists
()).
toBe
(
true
);
});
});
it
(
'
renders a row for Crossplane
'
,
()
=>
{
it
(
'
renders a row for Crossplane
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-cluster-application-row-crossplane
'
)).
not
.
toBeNull
(
);
expect
(
wrapper
.
find
(
'
.js-cluster-application-row-crossplane
'
).
exists
()).
toBe
(
true
);
});
});
it
(
'
renders a row for Prometheus
'
,
()
=>
{
it
(
'
renders a row for Prometheus
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-cluster-application-row-prometheus
'
)).
not
.
toBeNull
(
);
expect
(
wrapper
.
find
(
'
.js-cluster-application-row-prometheus
'
).
exists
()).
toBe
(
true
);
});
});
it
(
'
renders a row for GitLab Runner
'
,
()
=>
{
it
(
'
renders a row for GitLab Runner
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-cluster-application-row-runner
'
)).
not
.
toBeNull
(
);
expect
(
wrapper
.
find
(
'
.js-cluster-application-row-runner
'
).
exists
()).
toBe
(
true
);
});
});
it
(
'
renders a row for Jupyter
'
,
()
=>
{
it
(
'
renders a row for Jupyter
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-cluster-application-row-jupyter
'
)).
not
.
toBeNull
(
);
expect
(
wrapper
.
find
(
'
.js-cluster-application-row-jupyter
'
).
exists
()).
toBe
(
true
);
});
});
it
(
'
renders a row for Knative
'
,
()
=>
{
it
(
'
renders a row for Knative
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-cluster-application-row-knative
'
)).
not
.
toBeNull
(
);
expect
(
wrapper
.
find
(
'
.js-cluster-application-row-knative
'
).
exists
()).
toBe
(
true
);
});
});
it
(
'
renders a row for Elastic Stack
'
,
()
=>
{
it
(
'
renders a row for Elastic Stack
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-cluster-application-row-elastic_stack
'
)).
not
.
toBeNull
(
);
expect
(
wrapper
.
find
(
'
.js-cluster-application-row-elastic_stack
'
).
exists
()).
toBe
(
true
);
});
});
it
(
'
renders a row for Fluentd
'
,
()
=>
{
it
(
'
renders a row for Fluentd
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-cluster-application-row-fluentd
'
)).
not
.
toBeNull
(
);
expect
(
wrapper
.
find
(
'
.js-cluster-application-row-fluentd
'
).
exists
()).
toBe
(
true
);
});
});
});
});
describe
(
'
Instance cluster applications
'
,
()
=>
{
describe
(
'
Instance cluster applications
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
vm
=
mountComponent
(
Applications
,
{
createApp
({
type
:
CLUSTER_TYPE
.
INSTANCE
});
type
:
CLUSTER_TYPE
.
INSTANCE
,
applications
:
APPLICATIONS_MOCK_STATE
,
});
});
});
it
(
'
renders a row for Helm Tiller
'
,
()
=>
{
it
(
'
renders a row for Helm Tiller
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-cluster-application-row-helm
'
)).
not
.
toBeNull
(
);
expect
(
wrapper
.
find
(
'
.js-cluster-application-row-helm
'
).
exists
()).
toBe
(
true
);
});
});
it
(
'
renders a row for Ingress
'
,
()
=>
{
it
(
'
renders a row for Ingress
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-cluster-application-row-ingress
'
)).
not
.
toBeNull
(
);
expect
(
wrapper
.
find
(
'
.js-cluster-application-row-ingress
'
).
exists
()).
toBe
(
true
);
});
});
it
(
'
renders a row for Cert-Manager
'
,
()
=>
{
it
(
'
renders a row for Cert-Manager
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-cluster-application-row-cert_manager
'
)).
not
.
toBeNull
(
);
expect
(
wrapper
.
find
(
'
.js-cluster-application-row-cert_manager
'
).
exists
()).
toBe
(
true
);
});
});
it
(
'
renders a row for Crossplane
'
,
()
=>
{
it
(
'
renders a row for Crossplane
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-cluster-application-row-crossplane
'
)).
not
.
toBeNull
(
);
expect
(
wrapper
.
find
(
'
.js-cluster-application-row-crossplane
'
).
exists
()).
toBe
(
true
);
});
});
it
(
'
renders a row for Prometheus
'
,
()
=>
{
it
(
'
renders a row for Prometheus
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-cluster-application-row-prometheus
'
)).
not
.
toBeNull
(
);
expect
(
wrapper
.
find
(
'
.js-cluster-application-row-prometheus
'
).
exists
()).
toBe
(
true
);
});
});
it
(
'
renders a row for GitLab Runner
'
,
()
=>
{
it
(
'
renders a row for GitLab Runner
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-cluster-application-row-runner
'
)).
not
.
toBeNull
(
);
expect
(
wrapper
.
find
(
'
.js-cluster-application-row-runner
'
).
exists
()).
toBe
(
true
);
});
});
it
(
'
renders a row for Jupyter
'
,
()
=>
{
it
(
'
renders a row for Jupyter
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-cluster-application-row-jupyter
'
)).
not
.
toBeNull
(
);
expect
(
wrapper
.
find
(
'
.js-cluster-application-row-jupyter
'
).
exists
()).
toBe
(
true
);
});
});
it
(
'
renders a row for Knative
'
,
()
=>
{
it
(
'
renders a row for Knative
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-cluster-application-row-knative
'
)).
not
.
toBeNull
(
);
expect
(
wrapper
.
find
(
'
.js-cluster-application-row-knative
'
).
exists
()).
toBe
(
true
);
});
});
it
(
'
renders a row for Elastic Stack
'
,
()
=>
{
it
(
'
renders a row for Elastic Stack
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-cluster-application-row-elastic_stack
'
)).
not
.
toBeNull
(
);
expect
(
wrapper
.
find
(
'
.js-cluster-application-row-elastic_stack
'
).
exists
()).
toBe
(
true
);
});
});
it
(
'
renders a row for Fluentd
'
,
()
=>
{
it
(
'
renders a row for Fluentd
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-cluster-application-row-fluentd
'
)).
not
.
toBeNull
(
);
expect
(
wrapper
.
find
(
'
.js-cluster-application-row-fluentd
'
).
exists
()).
toBe
(
true
);
});
});
});
});
...
@@ -187,11 +180,8 @@ describe('Applications', () => {
...
@@ -187,11 +180,8 @@ describe('Applications', () => {
});
});
it
(
'
does not render a row for Helm Tiller
'
,
()
=>
{
it
(
'
does not render a row for Helm Tiller
'
,
()
=>
{
vm
=
mountComponent
(
Applications
,
{
createApp
();
applications
:
APPLICATIONS_MOCK_STATE
,
expect
(
wrapper
.
find
(
'
.js-cluster-application-row-helm
'
).
exists
()).
toBe
(
false
);
});
expect
(
vm
.
$el
.
querySelector
(
'
.js-cluster-application-row-helm
'
)).
toBeNull
();
});
});
});
});
});
});
...
@@ -200,7 +190,6 @@ describe('Applications', () => {
...
@@ -200,7 +190,6 @@ describe('Applications', () => {
describe
(
'
with nested component
'
,
()
=>
{
describe
(
'
with nested component
'
,
()
=>
{
const
propsData
=
{
const
propsData
=
{
applications
:
{
applications
:
{
...
APPLICATIONS_MOCK_STATE
,
ingress
:
{
ingress
:
{
title
:
'
Ingress
'
,
title
:
'
Ingress
'
,
status
:
'
installed
'
,
status
:
'
installed
'
,
...
@@ -208,18 +197,8 @@ describe('Applications', () => {
...
@@ -208,18 +197,8 @@ describe('Applications', () => {
},
},
};
};
let
wrapper
;
beforeEach
(()
=>
createShallowApp
(
propsData
));
beforeEach
(()
=>
{
wrapper
=
shallowMount
(
Applications
,
{
propsData
,
stubs
:
{
ApplicationRow
:
ApplicationRowStub
,
},
});
});
afterEach
(()
=>
{
wrapper
.
destroy
();
});
it
(
'
renders IngressModsecuritySettings
'
,
()
=>
{
it
(
'
renders IngressModsecuritySettings
'
,
()
=>
{
const
modsecuritySettings
=
wrapper
.
find
(
IngressModsecuritySettings
);
const
modsecuritySettings
=
wrapper
.
find
(
IngressModsecuritySettings
);
expect
(
modsecuritySettings
.
exists
()).
toBe
(
true
);
expect
(
modsecuritySettings
.
exists
()).
toBe
(
true
);
...
@@ -229,9 +208,8 @@ describe('Applications', () => {
...
@@ -229,9 +208,8 @@ describe('Applications', () => {
describe
(
'
when installed
'
,
()
=>
{
describe
(
'
when installed
'
,
()
=>
{
describe
(
'
with ip address
'
,
()
=>
{
describe
(
'
with ip address
'
,
()
=>
{
it
(
'
renders ip address with a clipboard button
'
,
()
=>
{
it
(
'
renders ip address with a clipboard button
'
,
()
=>
{
vm
=
mountComponent
(
Applications
,
{
createApp
(
{
applications
:
{
applications
:
{
...
APPLICATIONS_MOCK_STATE
,
ingress
:
{
ingress
:
{
title
:
'
Ingress
'
,
title
:
'
Ingress
'
,
status
:
'
installed
'
,
status
:
'
installed
'
,
...
@@ -240,17 +218,16 @@ describe('Applications', () => {
...
@@ -240,17 +218,16 @@ describe('Applications', () => {
},
},
});
});
expect
(
vm
.
$el
.
querySelector
(
'
.js-endpoint
'
).
value
).
toEqual
(
'
0.0.0.0
'
);
expect
(
wrapper
.
find
(
'
.js-endpoint
'
).
element
.
value
).
toEqual
(
'
0.0.0.0
'
);
expect
(
wrapper
.
find
(
'
.js-clipboard-btn
'
).
attributes
(
'
data-clipboard-text
'
)).
toEqual
(
expect
(
'
0.0.0.0
'
,
vm
.
$el
.
querySelector
(
'
.js-clipboard-btn
'
).
getAttribute
(
'
data-clipboard-text
'
),
);
).
toEqual
(
'
0.0.0.0
'
);
});
});
});
});
describe
(
'
with hostname
'
,
()
=>
{
describe
(
'
with hostname
'
,
()
=>
{
it
(
'
renders hostname with a clipboard button
'
,
()
=>
{
it
(
'
renders hostname with a clipboard button
'
,
()
=>
{
vm
=
mountComponent
(
Applications
,
{
createApp
(
{
applications
:
{
applications
:
{
ingress
:
{
ingress
:
{
title
:
'
Ingress
'
,
title
:
'
Ingress
'
,
...
@@ -270,19 +247,18 @@ describe('Applications', () => {
...
@@ -270,19 +247,18 @@ describe('Applications', () => {
},
},
});
});
expect
(
vm
.
$el
.
querySelector
(
'
.js-endpoint
'
)
.
value
).
toEqual
(
'
localhost.localdomain
'
);
expect
(
wrapper
.
find
(
'
.js-endpoint
'
).
element
.
value
).
toEqual
(
'
localhost.localdomain
'
);
expect
(
expect
(
wrapper
.
find
(
'
.js-clipboard-btn
'
).
attributes
(
'
data-clipboard-text
'
)).
toEqual
(
vm
.
$el
.
querySelector
(
'
.js-clipboard-btn
'
).
getAttribute
(
'
data-clipboard-text
'
)
,
'
localhost.localdomain
'
,
)
.
toEqual
(
'
localhost.localdomain
'
)
;
);
});
});
});
});
describe
(
'
without ip address
'
,
()
=>
{
describe
(
'
without ip address
'
,
()
=>
{
it
(
'
renders an input text with a loading icon and an alert text
'
,
()
=>
{
it
(
'
renders an input text with a loading icon and an alert text
'
,
()
=>
{
vm
=
mountComponent
(
Applications
,
{
createApp
(
{
applications
:
{
applications
:
{
...
APPLICATIONS_MOCK_STATE
,
ingress
:
{
ingress
:
{
title
:
'
Ingress
'
,
title
:
'
Ingress
'
,
status
:
'
installed
'
,
status
:
'
installed
'
,
...
@@ -290,29 +266,26 @@ describe('Applications', () => {
...
@@ -290,29 +266,26 @@ describe('Applications', () => {
},
},
});
});
expect
(
vm
.
$el
.
querySelector
(
'
.js-ingress-ip-loading-icon
'
)).
not
.
toBe
(
null
);
expect
(
wrapper
.
find
(
'
.js-ingress-ip-loading-icon
'
).
exists
()).
toBe
(
true
);
expect
(
vm
.
$el
.
querySelector
(
'
.js-no-endpoint-message
'
)).
not
.
toBe
(
null
);
expect
(
wrapper
.
find
(
'
.js-no-endpoint-message
'
).
exists
()).
toBe
(
true
);
});
});
});
});
});
});
describe
(
'
before installing
'
,
()
=>
{
describe
(
'
before installing
'
,
()
=>
{
it
(
'
does not render the IP address
'
,
()
=>
{
it
(
'
does not render the IP address
'
,
()
=>
{
vm
=
mountComponent
(
Applications
,
{
createApp
();
applications
:
APPLICATIONS_MOCK_STATE
,
});
expect
(
vm
.
$el
.
textContent
).
not
.
toContain
(
'
Ingress IP Address
'
);
expect
(
wrapper
.
text
()
).
not
.
toContain
(
'
Ingress IP Address
'
);
expect
(
vm
.
$el
.
querySelector
(
'
.js-endpoint
'
)).
toBe
(
null
);
expect
(
wrapper
.
find
(
'
.js-endpoint
'
).
exists
()).
toBe
(
false
);
});
});
});
});
describe
(
'
Cert-Manager application
'
,
()
=>
{
describe
(
'
Cert-Manager application
'
,
()
=>
{
describe
(
'
when not installed
'
,
()
=>
{
describe
(
'
when not installed
'
,
()
=>
{
it
(
'
renders email & allows editing
'
,
()
=>
{
it
(
'
renders email & allows editing
'
,
()
=>
{
vm
=
mountComponent
(
Applications
,
{
createApp
(
{
applications
:
{
applications
:
{
...
APPLICATIONS_MOCK_STATE
,
cert_manager
:
{
cert_manager
:
{
title
:
'
Cert-Manager
'
,
title
:
'
Cert-Manager
'
,
email
:
'
before@example.com
'
,
email
:
'
before@example.com
'
,
...
@@ -321,16 +294,15 @@ describe('Applications', () => {
...
@@ -321,16 +294,15 @@ describe('Applications', () => {
},
},
});
});
expect
(
vm
.
$el
.
querySelector
(
'
.js-email
'
)
.
value
).
toEqual
(
'
before@example.com
'
);
expect
(
wrapper
.
find
(
'
.js-email
'
).
element
.
value
).
toEqual
(
'
before@example.com
'
);
expect
(
vm
.
$el
.
querySelector
(
'
.js-email
'
).
getAttribute
(
'
readonly
'
)).
toBe
(
null
);
expect
(
wrapper
.
find
(
'
.js-email
'
).
attributes
(
'
readonly
'
)).
toBe
(
undefined
);
});
});
});
});
describe
(
'
when installed
'
,
()
=>
{
describe
(
'
when installed
'
,
()
=>
{
it
(
'
renders email in readonly
'
,
()
=>
{
it
(
'
renders email in readonly
'
,
()
=>
{
vm
=
mountComponent
(
Applications
,
{
createApp
(
{
applications
:
{
applications
:
{
...
APPLICATIONS_MOCK_STATE
,
cert_manager
:
{
cert_manager
:
{
title
:
'
Cert-Manager
'
,
title
:
'
Cert-Manager
'
,
email
:
'
after@example.com
'
,
email
:
'
after@example.com
'
,
...
@@ -339,8 +311,8 @@ describe('Applications', () => {
...
@@ -339,8 +311,8 @@ describe('Applications', () => {
},
},
});
});
expect
(
vm
.
$el
.
querySelector
(
'
.js-email
'
)
.
value
).
toEqual
(
'
after@example.com
'
);
expect
(
wrapper
.
find
(
'
.js-email
'
).
element
.
value
).
toEqual
(
'
after@example.com
'
);
expect
(
vm
.
$el
.
querySelector
(
'
.js-email
'
).
getAttribute
(
'
readonly
'
)).
toEqual
(
'
readonly
'
);
expect
(
wrapper
.
find
(
'
.js-email
'
).
attributes
(
'
readonly
'
)).
toEqual
(
'
readonly
'
);
});
});
});
});
});
});
...
@@ -348,9 +320,8 @@ describe('Applications', () => {
...
@@ -348,9 +320,8 @@ describe('Applications', () => {
describe
(
'
Jupyter application
'
,
()
=>
{
describe
(
'
Jupyter application
'
,
()
=>
{
describe
(
'
with ingress installed with ip & jupyter installable
'
,
()
=>
{
describe
(
'
with ingress installed with ip & jupyter installable
'
,
()
=>
{
it
(
'
renders hostname active input
'
,
()
=>
{
it
(
'
renders hostname active input
'
,
()
=>
{
vm
=
mountComponent
(
Applications
,
{
createApp
(
{
applications
:
{
applications
:
{
...
APPLICATIONS_MOCK_STATE
,
ingress
:
{
ingress
:
{
title
:
'
Ingress
'
,
title
:
'
Ingress
'
,
status
:
'
installed
'
,
status
:
'
installed
'
,
...
@@ -360,66 +331,56 @@ describe('Applications', () => {
...
@@ -360,66 +331,56 @@ describe('Applications', () => {
});
});
expect
(
expect
(
vm
.
$el
wrapper
.
find
(
'
.js-cluster-application-row-jupyter .js-hostname
'
).
attributes
(
'
readonly
'
),
.
querySelector
(
'
.js-cluster-application-row-jupyter .js-hostname
'
)
).
toEqual
(
undefined
);
.
getAttribute
(
'
readonly
'
),
).
toEqual
(
null
);
});
});
});
});
describe
(
'
with ingress installed without external ip
'
,
()
=>
{
describe
(
'
with ingress installed without external ip
'
,
()
=>
{
it
(
'
does not render hostname input
'
,
()
=>
{
it
(
'
does not render hostname input
'
,
()
=>
{
vm
=
mountComponent
(
Applications
,
{
createApp
(
{
applications
:
{
applications
:
{
...
APPLICATIONS_MOCK_STATE
,
ingress
:
{
title
:
'
Ingress
'
,
status
:
'
installed
'
},
ingress
:
{
title
:
'
Ingress
'
,
status
:
'
installed
'
},
},
},
});
});
expect
(
vm
.
$el
.
querySelector
(
'
.js-cluster-application-row-jupyter .js-hostname
'
)).
toBe
(
expect
(
wrapper
.
find
(
'
.js-cluster-application-row-jupyter .js-hostname
'
).
exists
(
)).
toBe
(
null
,
false
,
);
);
});
});
});
});
describe
(
'
with ingress & jupyter installed
'
,
()
=>
{
describe
(
'
with ingress & jupyter installed
'
,
()
=>
{
it
(
'
renders readonly input
'
,
()
=>
{
it
(
'
renders readonly input
'
,
()
=>
{
vm
=
mountComponent
(
Applications
,
{
createApp
(
{
applications
:
{
applications
:
{
...
APPLICATIONS_MOCK_STATE
,
ingress
:
{
title
:
'
Ingress
'
,
status
:
'
installed
'
,
externalIp
:
'
1.1.1.1
'
},
ingress
:
{
title
:
'
Ingress
'
,
status
:
'
installed
'
,
externalIp
:
'
1.1.1.1
'
},
jupyter
:
{
title
:
'
JupyterHub
'
,
status
:
'
installed
'
,
hostname
:
''
},
jupyter
:
{
title
:
'
JupyterHub
'
,
status
:
'
installed
'
,
hostname
:
''
},
},
},
});
});
expect
(
expect
(
vm
.
$el
wrapper
.
find
(
'
.js-cluster-application-row-jupyter .js-hostname
'
).
attributes
(
'
readonly
'
),
.
querySelector
(
'
.js-cluster-application-row-jupyter .js-hostname
'
)
.
getAttribute
(
'
readonly
'
),
).
toEqual
(
'
readonly
'
);
).
toEqual
(
'
readonly
'
);
});
});
});
});
describe
(
'
without ingress installed
'
,
()
=>
{
describe
(
'
without ingress installed
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
vm
=
mountComponent
(
Applications
,
{
createApp
();
applications
:
APPLICATIONS_MOCK_STATE
,
});
});
});
it
(
'
does not render input
'
,
()
=>
{
it
(
'
does not render input
'
,
()
=>
{
expect
(
vm
.
$el
.
querySelector
(
'
.js-cluster-application-row-jupyter .js-hostname
'
)).
toBe
(
expect
(
wrapper
.
find
(
'
.js-cluster-application-row-jupyter .js-hostname
'
).
exists
(
)).
toBe
(
null
,
false
,
);
);
});
});
it
(
'
renders disabled install button
'
,
()
=>
{
it
(
'
renders disabled install button
'
,
()
=>
{
expect
(
expect
(
vm
.
$el
wrapper
.
querySelector
(
.
find
(
'
.js-cluster-application-row-jupyter .js-cluster-application-install-button
'
)
'
.js-cluster-application-row-jupyter .js-cluster-application-install-button
'
,
.
attributes
(
'
disabled
'
),
)
.
getAttribute
(
'
disabled
'
),
).
toEqual
(
'
disabled
'
);
).
toEqual
(
'
disabled
'
);
});
});
});
});
...
@@ -433,7 +394,6 @@ describe('Applications', () => {
...
@@ -433,7 +394,6 @@ describe('Applications', () => {
};
};
const
propsData
=
{
const
propsData
=
{
applications
:
{
applications
:
{
...
APPLICATIONS_MOCK_STATE
,
knative
:
{
knative
:
{
title
:
'
Knative
'
,
title
:
'
Knative
'
,
hostname
:
'
example.com
'
,
hostname
:
'
example.com
'
,
...
@@ -445,23 +405,15 @@ describe('Applications', () => {
...
@@ -445,23 +405,15 @@ describe('Applications', () => {
},
},
},
},
};
};
let
wrapper
;
let
knativeDomainEditor
;
let
knativeDomainEditor
;
beforeEach
(()
=>
{
beforeEach
(()
=>
{
wrapper
=
shallowMount
(
Applications
,
{
createShallowApp
(
propsData
);
propsData
,
stubs
:
{
ApplicationRow
:
ApplicationRowStub
},
});
jest
.
spyOn
(
eventHub
,
'
$emit
'
);
jest
.
spyOn
(
eventHub
,
'
$emit
'
);
knativeDomainEditor
=
wrapper
.
find
(
KnativeDomainEditor
);
knativeDomainEditor
=
wrapper
.
find
(
KnativeDomainEditor
);
});
});
afterEach
(()
=>
{
wrapper
.
destroy
();
});
it
(
'
emits saveKnativeDomain event when knative domain editor emits save event
'
,
()
=>
{
it
(
'
emits saveKnativeDomain event when knative domain editor emits save event
'
,
()
=>
{
propsData
.
applications
.
knative
.
hostname
=
availableDomain
.
domain
;
propsData
.
applications
.
knative
.
hostname
=
availableDomain
.
domain
;
propsData
.
applications
.
knative
.
pagesDomain
=
availableDomain
;
propsData
.
applications
.
knative
.
pagesDomain
=
availableDomain
;
...
@@ -508,7 +460,6 @@ describe('Applications', () => {
...
@@ -508,7 +460,6 @@ describe('Applications', () => {
describe
(
'
Crossplane application
'
,
()
=>
{
describe
(
'
Crossplane application
'
,
()
=>
{
const
propsData
=
{
const
propsData
=
{
applications
:
{
applications
:
{
...
APPLICATIONS_MOCK_STATE
,
crossplane
:
{
crossplane
:
{
title
:
'
Crossplane
'
,
title
:
'
Crossplane
'
,
stack
:
{
stack
:
{
...
@@ -518,16 +469,8 @@ describe('Applications', () => {
...
@@ -518,16 +469,8 @@ describe('Applications', () => {
},
},
};
};
let
wrapper
;
beforeEach
(()
=>
createShallowApp
(
propsData
));
beforeEach
(()
=>
{
wrapper
=
shallowMount
(
Applications
,
{
propsData
,
stubs
:
{
ApplicationRow
:
ApplicationRowStub
},
});
});
afterEach
(()
=>
{
wrapper
.
destroy
();
});
it
(
'
renders the correct Component
'
,
()
=>
{
it
(
'
renders the correct Component
'
,
()
=>
{
const
crossplane
=
wrapper
.
find
(
CrossplaneProviderStack
);
const
crossplane
=
wrapper
.
find
(
CrossplaneProviderStack
);
expect
(
crossplane
.
exists
()).
toBe
(
true
);
expect
(
crossplane
.
exists
()).
toBe
(
true
);
...
@@ -537,61 +480,42 @@ describe('Applications', () => {
...
@@ -537,61 +480,42 @@ describe('Applications', () => {
describe
(
'
Elastic Stack application
'
,
()
=>
{
describe
(
'
Elastic Stack application
'
,
()
=>
{
describe
(
'
with elastic stack installable
'
,
()
=>
{
describe
(
'
with elastic stack installable
'
,
()
=>
{
it
(
'
renders hostname active input
'
,
()
=>
{
it
(
'
renders hostname active input
'
,
()
=>
{
vm
=
mountComponent
(
Applications
,
{
createApp
();
applications
:
{
...
APPLICATIONS_MOCK_STATE
,
},
});
expect
(
expect
(
vm
.
$el
wrapper
.
querySelector
(
.
find
(
'
.js-cluster-application-row-elastic_stack .js-cluster-application-install-button
'
,
'
.js-cluster-application-row-elastic_stack .js-cluster-application-install-button
'
,
)
)
.
getAttribute
(
'
disabled
'
),
.
attributes
(
'
disabled
'
),
).
toEqual
(
'
disabled
'
);
).
toEqual
(
'
disabled
'
);
});
});
});
});
describe
(
'
elastic stack installed
'
,
()
=>
{
describe
(
'
elastic stack installed
'
,
()
=>
{
it
(
'
renders uninstall button
'
,
()
=>
{
it
(
'
renders uninstall button
'
,
()
=>
{
vm
=
mountComponent
(
Applications
,
{
createApp
(
{
applications
:
{
applications
:
{
...
APPLICATIONS_MOCK_STATE
,
elastic_stack
:
{
title
:
'
Elastic Stack
'
,
status
:
'
installed
'
},
elastic_stack
:
{
title
:
'
Elastic Stack
'
,
status
:
'
installed
'
},
},
},
});
});
expect
(
expect
(
vm
.
$el
wrapper
.
querySelector
(
.
find
(
'
.js-cluster-application-row-elastic_stack .js-cluster-application-install-button
'
,
'
.js-cluster-application-row-elastic_stack .js-cluster-application-install-button
'
,
)
)
.
getAttribute
(
'
disabled
'
),
.
attributes
(
'
disabled
'
),
).
toEqual
(
'
disabled
'
);
).
toEqual
(
'
disabled
'
);
});
});
});
});
});
});
describe
(
'
Fluentd application
'
,
()
=>
{
describe
(
'
Fluentd application
'
,
()
=>
{
const
propsData
=
{
beforeEach
(()
=>
createShallowApp
());
applications
:
{
...
APPLICATIONS_MOCK_STATE
,
},
};
let
wrapper
;
beforeEach
(()
=>
{
wrapper
=
shallowMount
(
Applications
,
{
propsData
,
stubs
:
{
ApplicationRow
:
ApplicationRowStub
},
});
});
afterEach
(()
=>
{
wrapper
.
destroy
();
});
it
(
'
renders the correct Component
'
,
()
=>
{
it
(
'
renders the correct Component
'
,
()
=>
{
expect
(
wrapper
.
contains
(
FluentdOutputSettings
)).
toBe
(
true
);
expect
(
wrapper
.
find
(
FluentdOutputSettings
).
exists
(
)).
toBe
(
true
);
});
});
});
});
});
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment