-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(presets): add CH presets to accomodate transaction amnt issue
- Loading branch information
1 parent
71eb4f5
commit 648874f
Showing
9 changed files
with
41 additions
and
13 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
3 changes: 2 additions & 1 deletion
3
models/commons/src/money/money-draft/presets/change-history-data/index.ts
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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
import withUsdCurrencyCode from './with-usd-currency-code'; | ||
import withUsdCurrencyCodeCentMax from './with-usd-currency-code-max-cent'; | ||
|
||
const presets = { withUsdCurrencyCode }; | ||
const presets = { withUsdCurrencyCodeCentMax, withUsdCurrencyCode }; | ||
|
||
export default presets; |
16 changes: 16 additions & 0 deletions
16
...src/money/money-draft/presets/change-history-data/with-usd-currency-code-max-cent.spec.ts
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { TMoneyDraft } from '../../../types'; | ||
import withUsdCurrencyCodeCentMax from './with-usd-currency-code-max-cent'; | ||
|
||
describe('MoneyDraft with a defined `USD` currencyCode and defined max cent', () => { | ||
it('should return a currencyCode set to `USD` and max cent', () => { | ||
const usdCurrencyCodeMaxCent = | ||
withUsdCurrencyCodeCentMax().build<TMoneyDraft>(); | ||
|
||
expect(usdCurrencyCodeMaxCent).toEqual( | ||
expect.objectContaining({ | ||
currencyCode: 'USD', | ||
centAmount: expect.any(Number), | ||
}) | ||
); | ||
}); | ||
}); |
11 changes: 11 additions & 0 deletions
11
...mons/src/money/money-draft/presets/change-history-data/with-usd-currency-code-max-cent.ts
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 |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { TMoneyDraftBuilder } from '../../../types'; | ||
import MoneyDraft from '../../builder'; | ||
|
||
const random10DigitNumber = (): number => { | ||
return Math.floor(1000000000 + Math.random() * 9000000000); | ||
}; | ||
|
||
const withUsdCurrencyCodeCentMax = (): TMoneyDraftBuilder => | ||
MoneyDraft().currencyCode('USD').centAmount(random10DigitNumber()); | ||
|
||
export default withUsdCurrencyCodeCentMax; |
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
4 changes: 2 additions & 2 deletions
4
models/payment/src/transaction/transaction-draft/presets/change-history-data/index.ts
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import withUsdCurrencyCode from './with-usd-currency-code'; | ||
import withTransactionUsdCurrencyCodeMaxCent from './with-usd-currency-code-max-cent'; | ||
|
||
const presets = { | ||
withUsdCurrencyCode, | ||
withTransactionUsdCurrencyCodeMaxCent, | ||
}; | ||
|
||
export default presets; |
8 changes: 4 additions & 4 deletions
8
...story-data/with-usd-currency-code.spec.ts → ...a/with-usd-currency-code-max-cent.spec.ts
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