Get the name of a number, even if it's stupidly big.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.

63 line
1.4 KiB

  1. import getHundredName from './getHundredName'
  2. it('should exist', () => {
  3. expect(getHundredName).toBeDefined()
  4. })
  5. it('should be a callable', () => {
  6. expect(typeof getHundredName).toBe('function')
  7. })
  8. it('should accept 2 arguments', () => {
  9. expect(getHundredName).toHaveLength(2)
  10. })
  11. describe('on 0 in tens place', () => {
  12. test.each`
  13. ones | onesName
  14. ${0} | ${'sero'}
  15. ${1} | ${'isa'}
  16. ${2} | ${'dalawa'}
  17. ${3} | ${'tatlo'}
  18. ${4} | ${'apat'}
  19. ${5} | ${'lima'}
  20. ${6} | ${'anim'}
  21. ${7} | ${'pito'}
  22. ${8} | ${'walo'}
  23. ${9} | ${'siyam'}
  24. `(`should return "$onesName" for $ones`, ({ ones, onesName, }) => {
  25. expect(getHundredName(0, ones)).toBe(onesName)
  26. })
  27. })
  28. describe.each`
  29. tens | tensName
  30. ${2} | ${'dalawampu'}
  31. ${3} | ${'tatlumpu'}
  32. ${4} | ${'apatnapu'}
  33. ${5} | ${'limampu'}
  34. ${6} | ${'animnapu'}
  35. ${7} | ${'pitumpu'}
  36. ${8} | ${'walumpu'}
  37. ${9} | ${'siyamnapu'}
  38. `('on $tens in tens place', ({ tens, tensName, }) => {
  39. test.each`
  40. ones | onesName
  41. ${0} | ${''}
  42. ${1} | ${"'t isa"}
  43. ${2} | ${"'t dalawa"}
  44. ${3} | ${"'t tatlo"}
  45. ${4} | ${"'t apat"}
  46. ${5} | ${"'t lima"}
  47. ${6} | ${"'t anim"}
  48. ${7} | ${"'t pito"}
  49. ${8} | ${"'t walo"}
  50. ${9} | ${"'t siyam"}
  51. `(`should return "${tensName}$onesName" for ${tens}$ones`, ({ ones, onesName, }) => {
  52. expect(getHundredName(tens, ones)).toBe([
  53. tensName,
  54. onesName
  55. ].join(''))
  56. })
  57. })