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
Show 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 {
...
@@ -85,9 +85,11 @@ export default {
<div
class=
"d-flex"
>
<div
class=
"d-flex"
>
<gl-icon
v-if=
"isBottomSummaryVisible"
name=
"chevron-down"
/>
<gl-icon
v-if=
"isBottomSummaryVisible"
name=
"chevron-down"
/>
<gl-icon
v-else
name=
"chevron-right"
/>
<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>
<div
class=
"gl-ml-3"
>
{{
formatAmount
(
totalAmount
,
quantityPresent
)
}}
</div>
</h4>
</h4>
</div>
</div>
<gl-collapse
id=
"summary-details"
v-model=
"isBottomSummaryVisible"
>
<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
{
merge
}
from
'
lodash
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
VueApollo
from
'
vue-apollo
'
;
import
OrderSummary
from
'
ee/subscriptions/buy_minutes/components/order_summary.vue
'
;
import
OrderSummary
from
'
ee/subscriptions/buy_minutes/components/order_summary.vue
'
;
...
@@ -42,7 +42,7 @@ describe('Order Summary', () => {
...
@@ -42,7 +42,7 @@ describe('Order Summary', () => {
const
createComponent
=
(
stateData
)
=>
{
const
createComponent
=
(
stateData
)
=>
{
const
apolloProvider
=
createMockApolloProvider
(
stateData
);
const
apolloProvider
=
createMockApolloProvider
(
stateData
);
wrapper
=
m
ount
(
OrderSummary
,
{
wrapper
=
shallowM
ount
(
OrderSummary
,
{
localVue
,
localVue
,
apolloProvider
,
apolloProvider
,
propsData
:
{
propsData
:
{
...
@@ -63,58 +63,30 @@ describe('Order Summary', () => {
...
@@ -63,58 +63,30 @@ describe('Order Summary', () => {
});
});
});
});
it
(
'
displays the
chosen plan
'
,
()
=>
{
it
(
'
displays the
title
'
,
()
=>
{
expect
(
wrapper
.
find
(
'
.js-selected-plan
'
).
text
()).
toMatchInterpolatedText
(
expect
(
wrapper
.
find
(
'
[data-testid="title"]
'
).
text
()).
toMatchInterpolatedText
(
'
1000 CI minutes pack plan (x1)
'
,
"
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
(()
=>
{
beforeEach
(()
=>
{
createComponent
({
createComponent
({
subscription
:
{
quantity
:
3
},
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
'
,
()
=>
{
describe
(
'
when quantity is less than or equal to zero
'
,
()
=>
{
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
(()
=>
{
beforeEach
(()
=>
{
createComponent
();
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
'
,
()
=>
{
it
(
'
does not render amount
'
,
()
=>
{
expect
(
wrapper
.
find
(
'
.js-vat
'
).
exists
()).
toBe
(
false
);
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