Get the name of a number, even if it's stupidly big.
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
Ce dépôt est archivé. Vous pouvez voir les fichiers et le cloner, mais vous ne pouvez pas pousser ni ouvrir de ticket/demande d'ajout.

94 lignes
2.7 KiB

  1. import getKiloCount from './getKiloCount'
  2. it('should exist', () => {
  3. expect(getKiloCount).toBeDefined()
  4. })
  5. it('should be a callable', () => {
  6. expect(typeof getKiloCount).toBe('function')
  7. })
  8. it('should accept 3 arguments', () => {
  9. expect(getKiloCount).toHaveLength(3)
  10. })
  11. describe.each`
  12. hundreds | hundredsName
  13. ${1} | ${'sandaan'}
  14. ${2} | ${'dalawandaan'}
  15. ${3} | ${'tatlongdaan'}
  16. ${4} | ${'apatnaraan'}
  17. ${5} | ${'limandaan'}
  18. ${6} | ${'animnaraan'}
  19. ${7} | ${'pitongdaan'}
  20. ${8} | ${'walongdaan'}
  21. ${9} | ${'siyamnaraan'}
  22. `('on $hundreds in hundreds place', ({ hundreds, hundredsName }) => {
  23. describe('on 0 in tens place', () => {
  24. test.each`
  25. ones | onesName
  26. ${0} | ${''}
  27. ${1} | ${' at isa'}
  28. ${2} | ${' at dalawa'}
  29. ${3} | ${' at tatlo'}
  30. ${4} | ${' at apat'}
  31. ${5} | ${' at lima'}
  32. ${6} | ${' at anim'}
  33. ${7} | ${' at pito'}
  34. ${8} | ${' at walo'}
  35. ${9} | ${' at siyam'}
  36. `(`should return "${hundredsName}$onesName" for ${hundreds}0$ones`, ({ ones, onesName }) => {
  37. expect(getKiloCount(hundreds, 0, ones)).toBe([hundredsName, onesName].join(''))
  38. })
  39. })
  40. describe('on 1 in tens place', () => {
  41. test.each`
  42. ones | tenPlusName
  43. ${0} | ${' at sampu'}
  44. ${1} | ${' at labing-isa'}
  45. ${2} | ${' at labindalawa'}
  46. ${3} | ${' at labintatlo'}
  47. ${4} | ${' at labing-apat'}
  48. ${5} | ${' at labinlima'}
  49. ${6} | ${' at labing-anim'}
  50. ${7} | ${' at labimpito'}
  51. ${8} | ${' at labingwalo'}
  52. ${9} | ${' at labinsiyam'}
  53. `(`should return "${hundredsName}$tenPlusName" for ${hundreds}1$ones`, ({ ones, tenPlusName }) => {
  54. expect(getKiloCount(hundreds, 1, ones)).toBe([hundredsName, tenPlusName].join(''))
  55. })
  56. })
  57. describe.each`
  58. tens | tensName
  59. ${2} | ${' dalawampu'}
  60. ${3} | ${' tatlumpu'}
  61. ${4} | ${' apatnapu'}
  62. ${5} | ${' limampu'}
  63. ${6} | ${' animnapu'}
  64. ${7} | ${' pitumpu'}
  65. ${8} | ${' walumpu'}
  66. ${9} | ${' siyamnapu'}
  67. `('on $tens in tens place', ({ tens, tensName }) => {
  68. it(`should return "${hundredsName} at${tensName}" for ${hundreds}${tens}0`, () => {
  69. expect(getKiloCount(hundreds, tens, 0)).toBe([hundredsName, tensName].join(' at'))
  70. })
  71. test.each`
  72. ones | onesName
  73. ${1} | ${"'t isa"}
  74. ${2} | ${"'t dalawa"}
  75. ${3} | ${"'t tatlo"}
  76. ${4} | ${"'t apat"}
  77. ${5} | ${"'t lima"}
  78. ${6} | ${"'t anim"}
  79. ${7} | ${"'t pito"}
  80. ${8} | ${"'t walo"}
  81. ${9} | ${"'t siyam"}
  82. `(`should return "${hundredsName}${tensName}$onesName" for ${hundreds}${tens}$ones`, ({ ones, onesName }) => {
  83. expect(getKiloCount(hundreds, tens, ones)).toBe([hundredsName, tensName, onesName].join(''))
  84. })
  85. })
  86. })