-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated address transform to use full country name (#33745)
- Loading branch information
1 parent
9730f6c
commit 31b591d
Showing
2 changed files
with
66 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,35 +4,53 @@ import formConfig from '../../../config/form'; | |
import transformForSubmit from '../../../config/submitTransformer'; | ||
|
||
describe('submit transformer', () => { | ||
it('should return expected data', () => { | ||
const formData = { | ||
data: { | ||
veteranDateOfBirth: '2004-02-19', | ||
fullName: 'John Smith', | ||
physical_address: { | ||
street: '1 Main st', | ||
city: 'Canton', | ||
state: 'NY', | ||
postalCode: '13625', | ||
country: 'US', | ||
}, | ||
mailing_address: { | ||
street: '21 Jump St', | ||
city: 'Prattville', | ||
state: 'WA', | ||
postalCode: '12569', | ||
country: 'US', | ||
}, | ||
ssn: '963879632', | ||
va_claim_number: '5236978', | ||
phone_number: '2056321459', | ||
email_address: '[email protected]', | ||
const formData = { | ||
data: { | ||
veteranDateOfBirth: '2004-02-19', | ||
fullName: 'John Smith', | ||
veteranAddress: { | ||
street: '1 Main st', | ||
city: 'Canton', | ||
state: 'NY', | ||
postalCode: '13625', | ||
country: 'AFG', | ||
}, | ||
physicalAddress: { | ||
street: '21 Jump St', | ||
city: 'Prattville', | ||
state: 'WA', | ||
postalCode: '12569', | ||
country: 'USA', | ||
}, | ||
}; | ||
ssn: '963879632', | ||
va_claim_number: '5236978', | ||
phone_number: '2056321459', | ||
email_address: '[email protected]', | ||
}, | ||
}; | ||
it('should return expected data', () => { | ||
const newTransformData = JSON.parse( | ||
transformForSubmit(formConfig, formData), | ||
); | ||
// eslint-disable-next-line no-console | ||
expect(newTransformData.veteran.date_of_birth).to.equal('02/19/2004'); | ||
}); | ||
it('should replace country code with full country name', () => { | ||
const data = JSON.parse( | ||
transformForSubmit(formConfig, { | ||
data: { | ||
veteranDateOfBirth: '2004-02-19', | ||
sameMailingAddress: true, | ||
veteranAddress: { | ||
street: '1 Main st', | ||
city: 'Canton', | ||
state: 'NY', | ||
postalCode: '13625', | ||
country: 'USA', | ||
}, | ||
}, | ||
}), | ||
); | ||
expect(data.veteran.physical_address.country).to.equal('United States'); | ||
}); | ||
}); |