-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42815 from bernhardoj/fix/42084-limi-amount-to-8-…
…digit
- Loading branch information
Showing
5 changed files
with
28 additions
and
21 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
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
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,22 @@ | ||
import * as MoneyRequestUtils from '@libs/MoneyRequestUtils'; | ||
|
||
describe('ReportActionsUtils', () => { | ||
describe('validateAmount', () => { | ||
it('should pass the validation when amount is within the max digit and decimal', () => { | ||
expect(MoneyRequestUtils.validateAmount('12345678', 2, 8)).toBe(true); | ||
expect(MoneyRequestUtils.validateAmount('12345678', 0, 8)).toBe(true); | ||
expect(MoneyRequestUtils.validateAmount('12345678.12', 2, 8)).toBe(true); | ||
expect(MoneyRequestUtils.validateAmount('1234567.1', 2, 8)).toBe(true); | ||
expect(MoneyRequestUtils.validateAmount('12345678.123', 3, 8)).toBe(true); | ||
expect(MoneyRequestUtils.validateAmount('1234.1234', 4, 4)).toBe(true); | ||
}); | ||
|
||
it("shouldn't pass the validation when amount is bigger than the max digit and decimal", () => { | ||
expect(MoneyRequestUtils.validateAmount('12345678.123', 2, 8)).toBe(false); | ||
expect(MoneyRequestUtils.validateAmount('12345678.1', 0, 8)).toBe(false); | ||
expect(MoneyRequestUtils.validateAmount('123456789.12', 2, 8)).toBe(false); | ||
expect(MoneyRequestUtils.validateAmount('123456789.1234', 3, 8)).toBe(false); | ||
expect(MoneyRequestUtils.validateAmount('1234.12345', 4, 4)).toBe(false); | ||
}); | ||
}); | ||
}); |