diff --git a/app/soapbox/utils/__tests__/numbers-test.js b/app/soapbox/utils/__tests__/numbers-test.js deleted file mode 100644 index 86923a781..000000000 --- a/app/soapbox/utils/__tests__/numbers-test.js +++ /dev/null @@ -1,13 +0,0 @@ -import { isIntegerId } from '../numbers'; - -test('isIntegerId()', () => { - expect(isIntegerId('0')).toBe(true); - expect(isIntegerId('1')).toBe(true); - expect(isIntegerId('508107650')).toBe(true); - expect(isIntegerId('-1764036199')).toBe(true); - expect(isIntegerId('106801667066418367')).toBe(true); - expect(isIntegerId('9v5bmRalQvjOy0ECcC')).toBe(false); - expect(isIntegerId(null)).toBe(false); - expect(isIntegerId(undefined)).toBe(false); - expect(isIntegerId()).toBe(false); -}); diff --git a/app/soapbox/utils/__tests__/numbers-test.tsx b/app/soapbox/utils/__tests__/numbers-test.tsx new file mode 100644 index 000000000..63c45b26b --- /dev/null +++ b/app/soapbox/utils/__tests__/numbers-test.tsx @@ -0,0 +1,37 @@ +import React from 'react'; + +import { render, screen } from '../../jest/test-helpers'; +import { isIntegerId, shortNumberFormat } from '../numbers'; + +test('isIntegerId()', () => { + expect(isIntegerId('0')).toBe(true); + expect(isIntegerId('1')).toBe(true); + expect(isIntegerId('508107650')).toBe(true); + expect(isIntegerId('-1764036199')).toBe(true); + expect(isIntegerId('106801667066418367')).toBe(true); + expect(isIntegerId('9v5bmRalQvjOy0ECcC')).toBe(false); + expect(isIntegerId(null)).toBe(false); + expect(isIntegerId(undefined)).toBe(false); +}); + +describe('shortNumberFormat', () => { + test('handles non-numbers', () => { + render(