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.
Deze repo is gearchiveerd. U kunt bestanden bekijken en het klonen, maar niet pushen of problemen/pull-requests openen.

31 regels
822 B

  1. import getThousandName from './getThousandName'
  2. it('should exist', () => {
  3. expect(getThousandName).toBeDefined()
  4. })
  5. it('should be a callable', () => {
  6. expect(typeof getThousandName).toBe('function')
  7. })
  8. it('should accept 3 arguments', () => {
  9. expect(getThousandName).toHaveLength(3)
  10. })
  11. describe.each`
  12. hundreds | hundredsName
  13. ${1} | ${'one hundred'}
  14. ${2} | ${'two hundred'}
  15. ${3} | ${'three hundred'}
  16. ${4} | ${'four hundred'}
  17. ${5} | ${'five hundred'}
  18. ${6} | ${'six hundred'}
  19. ${7} | ${'seven hundred'}
  20. ${8} | ${'eight hundred'}
  21. ${9} | ${'nine hundred'}
  22. `('on $hundreds in hundreds place', ({ hundreds, hundredsName, }) => {
  23. it(`should return "${hundredsName}" on ${hundreds}00`, () => {
  24. expect(getThousandName(hundreds, 0, 0)).toBe(hundredsName)
  25. })
  26. })