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.
19 lines
558 B
19 lines
558 B
|
2 years ago
|
import { describe, expect, it } from '@jest/globals'
|
||
|
|
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,
|
||
|
|
})
|
||
|
|
})
|
||
|
|
})
|