Skip to content

Commit

Permalink
Merge pull request #1070 from CruGlobal/HS-1040983-amount-mapping
Browse files Browse the repository at this point in the history
HS-1040983 - Fix amount mapping on branded checkout
  • Loading branch information
wrandall22 authored Oct 27, 2023
2 parents 3f7effe + a60c1f1 commit cc06e74
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class ProductConfigFormController {
setDefaultAmount () {
const amountOptions = isEmpty(this.suggestedAmounts)
? this.selectableAmounts
: map(this.suggestedAmounts, 'AMOUNT')
: map(this.suggestedAmounts, 'amount')

if (this.itemConfig.AMOUNT) {
if (amountOptions.indexOf(this.itemConfig.AMOUNT) === -1) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ describe('product config form component', function () {
})

it('should set the default amount if there are suggested amounts', () => {
$ctrl.suggestedAmounts = [{ AMOUNT: 14 }]
$ctrl.suggestedAmounts = [{ amount: 14 }]
$ctrl.setDefaultAmount()

expect($ctrl.itemConfig.AMOUNT).toEqual(14)
Expand All @@ -273,7 +273,7 @@ describe('product config form component', function () {

it('should use an existing suggestedAmounts', () => {
$ctrl.itemConfig.AMOUNT = 14
$ctrl.suggestedAmounts = [{ AMOUNT: 14 }]
$ctrl.suggestedAmounts = [{ amount: 14 }]
$ctrl.setDefaultAmount()

expect($ctrl.itemConfig.AMOUNT).toEqual(14)
Expand All @@ -290,7 +290,7 @@ describe('product config form component', function () {

it('should initialize the custom value with suggestedAmounts', () => {
$ctrl.itemConfig.AMOUNT = 14
$ctrl.suggestedAmounts = [{ AMOUNT: 25 }]
$ctrl.suggestedAmounts = [{ amount: 25 }]
$ctrl.setDefaultAmount()

expect($ctrl.itemConfig.AMOUNT).toEqual(14)
Expand Down

0 comments on commit cc06e74

Please sign in to comment.