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
e8e71412
Commit
e8e71412
authored
Jan 28, 2022
by
Diana Zubova
Committed by
Olena Horal-Koretska
Jan 28, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't sent empty string as quantity
Skip GraphQL call on invalid input
parent
b6e77ad5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
6 deletions
+21
-6
ee/app/assets/javascripts/subscriptions/buy_addons_shared/components/checkout/addon_purchase_details.vue
...ons_shared/components/checkout/addon_purchase_details.vue
+1
-1
ee/app/assets/javascripts/subscriptions/buy_addons_shared/components/order_summary.vue
...scriptions/buy_addons_shared/components/order_summary.vue
+1
-1
ee/spec/frontend/subscriptions/buy_addons_shared/components/order_summary_spec.js
...ptions/buy_addons_shared/components/order_summary_spec.js
+19
-4
No files found.
ee/app/assets/javascripts/subscriptions/buy_addons_shared/components/checkout/addon_purchase_details.vue
View file @
e8e71412
...
...
@@ -47,7 +47,7 @@ export default {
return
this
.
quantity
||
0
;
},
set
(
quantity
)
{
this
.
updateQuantity
(
quantity
);
this
.
updateQuantity
(
quantity
||
0
);
},
},
isValid
()
{
...
...
ee/app/assets/javascripts/subscriptions/buy_addons_shared/components/order_summary.vue
View file @
e8e71412
...
...
@@ -75,7 +75,7 @@ export default {
logError
(
error
);
},
skip
()
{
return
!
this
.
purchaseHasExpiration
;
return
!
this
.
purchaseHasExpiration
||
!
this
.
quantity
;
},
},
},
...
...
ee/spec/frontend/subscriptions/buy_addons_shared/components/order_summary_spec.js
View file @
e8e71412
...
...
@@ -32,6 +32,10 @@ describe('Order Summary', () => {
const
findAmount
=
()
=>
wrapper
.
findByTestId
(
'
amount
'
);
const
findTitle
=
()
=>
wrapper
.
findByTestId
(
'
title
'
);
const
orderPreviewHandlerMock
=
jest
.
fn
()
.
mockResolvedValue
({
data
:
{
orderPreview
:
mockOrderPreview
}
});
const
createMockApolloProvider
=
(
stateData
=
{},
mockRequest
=
{})
=>
{
const
mockApollo
=
createMockApollo
([],
resolvers
);
const
data
=
merge
({},
mockStateData
,
initialStateData
,
stateData
);
...
...
@@ -96,12 +100,9 @@ describe('Order Summary', () => {
describe
(
'
when subscription has expiration date
'
,
()
=>
{
describe
(
'
calls api that returns prorated amount
'
,
()
=>
{
beforeEach
(
async
()
=>
{
const
orderPreviewQueryMock
=
jest
.
fn
()
.
mockResolvedValue
({
data
:
{
orderPreview
:
mockOrderPreview
}
});
const
apolloProvider
=
createMockApolloProvider
(
{
subscription
:
{
quantity
:
1
}
},
orderPreview
Query
Mock
,
orderPreview
Handler
Mock
,
);
createComponent
(
apolloProvider
,
{
purchaseHasExpiration
:
true
});
await
waitForPromises
();
...
...
@@ -182,5 +183,19 @@ describe('Order Summary', () => {
expect
(
findAmount
().
text
()).
toBe
(
'
-
'
);
});
});
describe
(
'
when subscription quantity is 0
'
,
()
=>
{
beforeEach
(()
=>
{
const
apolloProvider
=
createMockApolloProvider
(
{
subscription
:
{
quantity
:
0
}
},
orderPreviewHandlerMock
,
);
createComponent
(
apolloProvider
,
{
purchaseHasExpiration
:
true
});
});
it
(
'
doesn not call api
'
,
()
=>
{
expect
(
orderPreviewHandlerMock
).
not
.
toHaveBeenCalled
();
});
});
});
});
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