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
5904edfb
Commit
5904edfb
authored
Jan 29, 2020
by
Alex Buijs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add some more specs
parent
2e18b6f9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
3 deletions
+37
-3
ee/spec/frontend/subscriptions/new/components/checkout/confirm_order_spec.js
...bscriptions/new/components/checkout/confirm_order_spec.js
+37
-3
No files found.
ee/spec/frontend/subscriptions/new/components/checkout/confirm_order_spec.js
View file @
5904edfb
import
Vuex
from
'
vuex
'
;
import
Vuex
from
'
vuex
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowMount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
Api
from
'
ee/api
'
;
import
createStore
from
'
ee/subscriptions/new/store
'
;
import
createStore
from
'
ee/subscriptions/new/store
'
;
import
*
as
types
from
'
ee/subscriptions/new/store/mutation_types
'
;
import
*
as
types
from
'
ee/subscriptions/new/store/mutation_types
'
;
import
{
GlButton
}
from
'
@gitlab/ui
'
;
import
{
GlButton
,
GlLoadingIcon
}
from
'
@gitlab/ui
'
;
import
Component
from
'
ee/subscriptions/new/components/checkout/confirm_order.vue
'
;
import
Component
from
'
ee/subscriptions/new/components/checkout/confirm_order.vue
'
;
describe
(
'
Confirm Order
'
,
()
=>
{
describe
(
'
Confirm Order
'
,
()
=>
{
...
@@ -11,6 +12,8 @@ describe('Confirm Order', () => {
...
@@ -11,6 +12,8 @@ describe('Confirm Order', () => {
let
wrapper
;
let
wrapper
;
jest
.
mock
(
'
ee/api.js
'
);
const
store
=
createStore
();
const
store
=
createStore
();
const
createComponent
=
(
opts
=
{})
=>
{
const
createComponent
=
(
opts
=
{})
=>
{
...
@@ -21,6 +24,9 @@ describe('Confirm Order', () => {
...
@@ -21,6 +24,9 @@ describe('Confirm Order', () => {
});
});
};
};
const
findConfirmButton
=
()
=>
wrapper
.
find
(
GlButton
);
const
findLoadingIcon
=
()
=>
wrapper
.
find
(
GlLoadingIcon
);
beforeEach
(()
=>
{
beforeEach
(()
=>
{
createComponent
();
createComponent
();
});
});
...
@@ -35,7 +41,35 @@ describe('Confirm Order', () => {
...
@@ -35,7 +41,35 @@ describe('Confirm Order', () => {
});
});
it
(
'
button should be visible
'
,
()
=>
{
it
(
'
button should be visible
'
,
()
=>
{
expect
(
wrapper
.
find
(
GlButton
).
exists
()).
toBe
(
true
);
expect
(
findConfirmButton
().
exists
()).
toBe
(
true
);
});
it
(
'
shows the text "Confirm purchase"
'
,
()
=>
{
expect
(
findConfirmButton
().
text
()).
toBe
(
'
Confirm purchase
'
);
});
it
(
'
the loading indicator should not be visible
'
,
()
=>
{
expect
(
findLoadingIcon
().
exists
()).
toBe
(
false
);
});
describe
(
'
Clicking the button
'
,
()
=>
{
beforeEach
(()
=>
{
Api
.
confirmOrder
=
jest
.
fn
().
mockReturnValue
(
new
Promise
(
jest
.
fn
()));
findConfirmButton
().
vm
.
$emit
(
'
click
'
);
});
it
(
'
calls the confirmOrder API method
'
,
()
=>
{
expect
(
Api
.
confirmOrder
).
toHaveBeenCalled
();
});
it
(
'
shows the text "Confirming..."
'
,
()
=>
{
expect
(
findConfirmButton
().
text
()).
toBe
(
'
Confirming...
'
);
});
it
(
'
the loading indicator should be visible
'
,
()
=>
{
expect
(
findLoadingIcon
().
exists
()).
toBe
(
true
);
});
});
});
});
});
...
@@ -45,7 +79,7 @@ describe('Confirm Order', () => {
...
@@ -45,7 +79,7 @@ describe('Confirm Order', () => {
});
});
it
(
'
button should not be visible
'
,
()
=>
{
it
(
'
button should not be visible
'
,
()
=>
{
expect
(
wrapper
.
find
(
GlButton
).
exists
()).
toBe
(
false
);
expect
(
findConfirmButton
(
).
exists
()).
toBe
(
false
);
});
});
});
});
});
});
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