Gets the name of a number, even if it's stupidly big. Supersedes TheoryOfNekomata/number-name.
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 

35 rader
1.6 KiB

  1. import getNumberName from '../../../index';
  2. describe('Custom numbers', () => {
  3. it('converts 123456000 to one hundred twenty three million four hundred fifty six thousand', () => {
  4. expect(getNumberName(123456000)).toBe('one hundred twenty three million four hundred fifty six thousand');
  5. });
  6. it('converts 123456000 to one hundred twenty three million four hundred fifty six thousand nine', () => {
  7. expect(getNumberName(123456009)).toBe('one hundred twenty three million four hundred fifty six thousand nine');
  8. });
  9. it('converts 123000789 to one hundred twenty three million seven hundred eighty nine', () => {
  10. expect(getNumberName(123000789)).toBe('one hundred twenty three million seven hundred eighty nine');
  11. });
  12. it('converts 123050789 to one hundred twenty three million fifty thousand seven hundred eighty nine', () => {
  13. expect(getNumberName(123050789)).toBe('one hundred twenty three million fifty thousand seven hundred eighty nine');
  14. });
  15. it(
  16. 'converts 123456789 to one hundred twenty three million four hundred fifty six thousand seven hundred eighty nine',
  17. () => {
  18. expect(getNumberName(123456789))
  19. .toBe('one hundred twenty three million four hundred fifty six thousand seven hundred eighty nine');
  20. },
  21. );
  22. it(
  23. 'converts -123456789 to negative one hundred twenty three million four hundred fifty six thousand seven hundred eighty nine',
  24. () => {
  25. expect(getNumberName(-123456789))
  26. .toBe('negative one hundred twenty three million four hundred fifty six thousand seven hundred eighty nine');
  27. },
  28. );
  29. });