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
a7a5d85f
Commit
a7a5d85f
authored
Nov 05, 2021
by
Tom Quirk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve Jira Connect app_spec.js
- consolidate template specs into a single spec table.
parent
b000e175
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
42 deletions
+41
-42
spec/frontend/jira_connect/subscriptions/components/app_spec.js
...rontend/jira_connect/subscriptions/components/app_spec.js
+40
-41
spec/views/jira_connect/subscriptions/index.html.haml_spec.rb
.../views/jira_connect/subscriptions/index.html.haml_spec.rb
+1
-1
No files found.
spec/frontend/jira_connect/subscriptions/components/app_spec.js
View file @
a7a5d85f
...
...
@@ -4,6 +4,7 @@ import { mount, shallowMount } from '@vue/test-utils';
import
JiraConnectApp
from
'
~/jira_connect/subscriptions/components/app.vue
'
;
import
AddNamespaceButton
from
'
~/jira_connect/subscriptions/components/add_namespace_button.vue
'
;
import
SignInButton
from
'
~/jira_connect/subscriptions/components/sign_in_button.vue
'
;
import
SubscriptionsList
from
'
~/jira_connect/subscriptions/components/subscriptions_list.vue
'
;
import
createStore
from
'
~/jira_connect/subscriptions/store
'
;
import
{
SET_ALERT
}
from
'
~/jira_connect/subscriptions/store/mutation_types
'
;
import
{
__
}
from
'
~/locale
'
;
...
...
@@ -21,6 +22,7 @@ describe('JiraConnectApp', () => {
const
findAlertLink
=
()
=>
findAlert
().
findComponent
(
GlLink
);
const
findSignInButton
=
()
=>
wrapper
.
findComponent
(
SignInButton
);
const
findAddNamespaceButton
=
()
=>
wrapper
.
findComponent
(
AddNamespaceButton
);
const
findSubscriptionsList
=
()
=>
wrapper
.
findComponent
(
SubscriptionsList
);
const
findEmptyState
=
()
=>
wrapper
.
findComponent
(
GlEmptyState
);
const
createComponent
=
({
provide
,
mountFn
=
shallowMount
}
=
{})
=>
{
...
...
@@ -36,54 +38,51 @@ describe('JiraConnectApp', () => {
wrapper
.
destroy
();
});
describe
(
'
with subscriptions
'
,
()
=>
{
describe
(
'
template
'
,
()
=>
{
describe
.
each
`
scenario | usersPath | expectSignInButton | expectNamespaceButton
${
'
user is not signed in
'
}
|
${
'
/users
'
}
|
${
true
}
|
${
false
}
${
'
user is signed in
'
}
|
${
undefined
}
|
${
false
}
|
${
true
}
`
(
'
when $scenario
'
,
({
usersPath
,
expectSignInButton
,
expectNamespaceButton
})
=>
{
beforeEach
(()
=>
{
createComponent
({
provide
:
{
usersPath
,
subscriptions
:
[
mockSubscription
],
},
scenario | usersPath | subscriptions | expectSignInButton | expectEmptyState | expectNamespaceButton | expectSubscriptionsList
${
'
user is not signed in with subscriptions
'
}
|
${
'
/users
'
}
|
${[
mockSubscription
]}
|
${
true
}
|
${
false
}
|
${
false
}
|
${
true
}
${
'
user is not signed in without subscriptions
'
}
|
${
'
/users
'
}
|
${
undefined
}
|
${
true
}
|
${
false
}
|
${
false
}
|
${
false
}
${
'
user is signed in with subscriptions
'
}
|
${
undefined
}
|
${[
mockSubscription
]}
|
${
false
}
|
${
false
}
|
${
true
}
|
${
true
}
${
'
user is signed in without subscriptions
'
}
|
${
undefined
}
|
${
undefined
}
|
${
false
}
|
${
true
}
|
${
false
}
|
${
false
}
`
(
'
when $scenario
'
,
({
usersPath
,
expectSignInButton
,
subscriptions
,
expectEmptyState
,
expectNamespaceButton
,
expectSubscriptionsList
,
})
=>
{
beforeEach
(()
=>
{
createComponent
({
provide
:
{
usersPath
,
subscriptions
,
},
});
});
});
it
(
'
renders sign in button as expected
'
,
()
=>
{
expect
(
findSignInButton
().
exists
()).
toBe
(
expectSignInButton
);
});
it
(
'
renders "Add Namespace" button as expected
'
,
()
=>
{
expect
(
findAddNamespaceButton
().
exists
()).
toBe
(
expectNamespaceButton
);
});
});
});
it
(
`
${
expectSignInButton
?
'
renders
'
:
'
does not render
'
}
sign in button`
,
()
=>
{
expect
(
findSignInButton
().
exists
()).
toBe
(
expectSignInButton
);
});
describe
(
'
with no subscriptions
'
,
()
=>
{
describe
.
each
`
scenario | usersPath | expectSignInButton | expectEmptyState
${
'
user is not signed in
'
}
|
${
'
/users
'
}
|
${
true
}
|
${
false
}
${
'
user is signed in
'
}
|
${
undefined
}
|
${
false
}
|
${
true
}
`
(
'
when $scenario
'
,
({
usersPath
,
expectSignInButton
,
expectEmptyState
})
=>
{
beforeEach
(()
=>
{
createComponent
({
provide
:
{
usersPath
,
subscriptions
:
[],
},
it
(
`
${
expectEmptyState
?
'
renders
'
:
'
does not render
'
}
empty state`
,
()
=>
{
expect
(
findEmptyState
().
exists
()).
toBe
(
expectEmptyState
);
});
});
it
(
'
renders sign in button as expected
'
,
()
=>
{
expect
(
findSignInButton
().
exists
()).
toBe
(
expectSignInButton
);
});
it
(
`
${
expectNamespaceButton
?
'
renders
'
:
'
does not render
'
}
button to add namespace`
,
()
=>
{
expect
(
findAddNamespaceButton
().
exists
()).
toBe
(
expectNamespaceButton
);
});
it
(
'
renders empty state as expected
'
,
()
=>
{
expect
(
findEmptyState
().
exists
()).
toBe
(
expectEmptyState
);
});
});
it
(
`
${
expectSubscriptionsList
?
'
renders
'
:
'
does not render
'
}
subscriptions list`
,
()
=>
{
expect
(
findSubscriptionsList
().
exists
()).
toBe
(
expectSubscriptionsList
);
});
},
);
});
describe
(
'
alert
'
,
()
=>
{
...
...
spec/views/jira_connect/subscriptions/index.html.haml_spec.rb
View file @
a7a5d85f
...
...
@@ -7,7 +7,7 @@ RSpec.describe 'jira_connect/subscriptions/index.html.haml' do
before
do
allow
(
view
).
to
receive
(
:current_user
).
and_return
(
user
)
assign
(
:subscriptions
,
[]
)
assign
(
:subscriptions
,
create_list
(
:jira_connect_subscription
,
1
)
)
end
context
'when the user is signed in'
do
...
...
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