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
fd82718c
Commit
fd82718c
authored
Jul 14, 2021
by
Vitaly Slobodin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor OrderSummary tests
parent
c0e7f3bd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
44 deletions
+18
-44
ee/app/assets/javascripts/subscriptions/buy_minutes/components/order_summary.vue
...ts/subscriptions/buy_minutes/components/order_summary.vue
+4
-2
ee/spec/frontend/subscriptions/buy_minutes/components/order_summary_spec.js
...ubscriptions/buy_minutes/components/order_summary_spec.js
+14
-42
No files found.
ee/app/assets/javascripts/subscriptions/buy_minutes/components/order_summary.vue
View file @
fd82718c
...
...
@@ -85,9 +85,11 @@ export default {
<div
class=
"d-flex"
>
<gl-icon
v-if=
"isBottomSummaryVisible"
name=
"chevron-down"
/>
<gl-icon
v-else
name=
"chevron-right"
/>
<div>
{{
titleWithName
}}
</div>
<div
data-testid=
"title"
>
{{
titleWithName
}}
</div>
</div>
<div
class=
"gl-ml-3"
data-testid=
"amount"
>
{{
formatAmount
(
totalAmount
,
quantityPresent
)
}}
</div>
<div
class=
"gl-ml-3"
>
{{
formatAmount
(
totalAmount
,
quantityPresent
)
}}
</div>
</h4>
</div>
<gl-collapse
id=
"summary-details"
v-model=
"isBottomSummaryVisible"
>
...
...
ee/spec/frontend/subscriptions/buy_minutes/components/order_summary_spec.js
View file @
fd82718c
import
{
m
ount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
shallowM
ount
,
createLocalVue
}
from
'
@vue/test-utils
'
;
import
{
merge
}
from
'
lodash
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
OrderSummary
from
'
ee/subscriptions/buy_minutes/components/order_summary.vue
'
;
...
...
@@ -42,7 +42,7 @@ describe('Order Summary', () => {
const
createComponent
=
(
stateData
)
=>
{
const
apolloProvider
=
createMockApolloProvider
(
stateData
);
wrapper
=
m
ount
(
OrderSummary
,
{
wrapper
=
shallowM
ount
(
OrderSummary
,
{
localVue
,
apolloProvider
,
propsData
:
{
...
...
@@ -63,58 +63,30 @@ describe('Order Summary', () => {
});
});
it
(
'
displays the
chosen plan
'
,
()
=>
{
expect
(
wrapper
.
find
(
'
.js-selected-plan
'
).
text
()).
toMatchInterpolatedText
(
'
1000 CI minutes pack plan (x1)
'
,
it
(
'
displays the
title
'
,
()
=>
{
expect
(
wrapper
.
find
(
'
[data-testid="title"]
'
).
text
()).
toMatchInterpolatedText
(
"
Gitlab Org's CI minutes
"
,
);
});
it
(
'
displays the correct formatted amount price per pack
'
,
()
=>
{
expect
(
wrapper
.
find
(
'
.js-per-unit
'
).
text
()).
toContain
(
'
$10 per pack per year
'
);
});
it
(
'
displays the correct formatted total amount
'
,
()
=>
{
expect
(
wrapper
.
find
(
'
.js-total-amount
'
).
text
()).
toContain
(
'
$10
'
);
});
});
describe
(
'
changing quantity
'
,
()
=>
{
describe
(
'
when quantity is greater than zero
'
,
()
=>
{
beforeEach
(()
=>
{
createComponent
({
subscription
:
{
quantity
:
3
},
});
});
});
it
(
'
displays the correct quantity
'
,
()
=>
{
expect
(
wrapper
.
find
(
'
.js-quantity
'
).
text
()).
toContain
(
'
(x3)
'
);
});
it
(
'
displays the correct formatted amount price per unit
'
,
()
=>
{
expect
(
wrapper
.
find
(
'
.js-per-unit
'
).
text
()).
toContain
(
'
$10 per pack per year
'
);
});
it
(
'
displays the correct multiplied formatted amount of the chosen plan
'
,
()
=>
{
expect
(
wrapper
.
find
(
'
.js-amount
'
).
text
()).
toContain
(
'
$30
'
);
});
it
(
'
displays the correct formatted total amount
'
,
()
=>
{
expect
(
wrapper
.
find
(
'
.js-total-amount
'
).
text
()).
toContain
(
'
$30
'
);
});
describe
(
'
tax rate
'
,
()
=>
{
beforeEach
(()
=>
{
createComponent
();
describe
(
'
when quantity is less than or equal to zero
'
,
()
=>
{
beforeEach
(()
=>
{
createComponent
({
subscription
:
{
quantity
:
0
},
});
});
describe
(
'
a tax rate of 0
'
,
()
=>
{
it
(
'
should not display the total amount excluding vat
'
,
()
=>
{
expect
(
wrapper
.
find
(
'
.js-total-ex-vat
'
).
exists
()).
toBe
(
false
);
});
it
(
'
should not display the vat amount
'
,
()
=>
{
expect
(
wrapper
.
find
(
'
.js-vat
'
).
exists
()).
toBe
(
false
);
});
});
it
(
'
does not render amount
'
,
()
=>
{
expect
(
wrapper
.
find
(
'
[data-testid="amount"]
'
).
text
()).
toBe
(
'
-
'
);
});
});
});
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