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.

78 line
1.8 KiB

  1. import tensFn from './tens'
  2. it('should exist', () => {
  3. expect(tensFn).toBeDefined()
  4. })
  5. it('should be a callable', () => {
  6. expect(typeof tensFn).toBe('function')
  7. })
  8. it('should accept 2 arguments', () => {
  9. expect(tensFn).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(tensFn(0, ones)).toBe(onesName)
  26. })
  27. })
  28. describe('on 1 in tens place', () => {
  29. test.each`
  30. ones | tenPlusName
  31. ${0} | ${'sampu'}
  32. ${1} | ${'labing-isa'}
  33. ${2} | ${'labindalawa'}
  34. ${3} | ${'labintatlo'}
  35. ${4} | ${'labing-apat'}
  36. ${5} | ${'labinlima'}
  37. ${6} | ${'labing-anim'}
  38. ${7} | ${'labimpito'}
  39. ${8} | ${'labingwalo'}
  40. ${9} | ${'labinsiyam'}
  41. `(`should return "$tenPlusName" for 1$ones`, ({ ones, tenPlusName }) => {
  42. expect(tensFn(1, ones)).toBe(tenPlusName)
  43. })
  44. })
  45. describe.each`
  46. tens | tensName
  47. ${2} | ${'dalawampu'}
  48. ${3} | ${'tatlumpu'}
  49. ${4} | ${'apatnapu'}
  50. ${5} | ${'limampu'}
  51. ${6} | ${'animnapu'}
  52. ${7} | ${'pitumpu'}
  53. ${8} | ${'walumpu'}
  54. ${9} | ${'siyamnapu'}
  55. `('on $tens in tens place', ({ tens, tensName }) => {
  56. test.each`
  57. ones | onesName
  58. ${0} | ${''}
  59. ${1} | ${"'t isa"}
  60. ${2} | ${"'t dalawa"}
  61. ${3} | ${"'t tatlo"}
  62. ${4} | ${"'t apat"}
  63. ${5} | ${"'t lima"}
  64. ${6} | ${"'t anim"}
  65. ${7} | ${"'t pito"}
  66. ${8} | ${"'t walo"}
  67. ${9} | ${"'t siyam"}
  68. `(`should return "${tensName}$onesName" for ${tens}$ones`, ({ ones, onesName }) => {
  69. expect(tensFn(tens, ones)).toBe([tensName, onesName].join(''))
  70. })
  71. })