@uppy/utils
Version:
Shared utility functions for Uppy Core and plugins maintained by the Uppy team.
19 lines (16 loc) • 551 B
text/typescript
import { describe, expect, it } from 'vitest'
import getFileNameAndExtension from './getFileNameAndExtension.js'
describe('getFileNameAndExtension', () => {
it('should return the filename and extension as an array', () => {
expect(getFileNameAndExtension('fsdfjodsuf23rfw.jpg')).toEqual({
name: 'fsdfjodsuf23rfw',
extension: 'jpg',
})
})
it('should handle invalid filenames', () => {
expect(getFileNameAndExtension('fsdfjodsuf23rfw')).toEqual({
name: 'fsdfjodsuf23rfw',
extension: undefined,
})
})
})