-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
update Drafts to format number to text (#22)
* build: add to-words dependency Signed-off-by: ahmad-kashkoush <[email protected]>
- Loading branch information
1 parent
6f7d0fb
commit 7083e87
Showing
5 changed files
with
73 additions
and
32 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,14 @@ | ||
import { getDrafter } from '../src/drafting'; | ||
|
||
describe('number to words format', ()=>{ | ||
test('should format integer to words', ()=>{ | ||
const drafter:any=getDrafter('Integer'); | ||
expect(drafter(123,'word' )).toBe('One Hundred Twenty Three'); | ||
expect(drafter(123456,'word' )).toBe('One Lakh Twenty Three Thousand Four Hundred Fifty Six'); | ||
}); | ||
test('should format double to words', ()=>{ | ||
const drafter:any=getDrafter('Double'); | ||
expect(drafter(123.045,'word' )).toBe('One Hundred Twenty Three Point Zero Four Five'); | ||
expect(drafter(1234.045,'word' )).toBe('One Thousand Two Hundred Thirty Four Point Zero Four Five'); | ||
}); | ||
}); |