|
@@ -5,16 +5,18 @@ const sampleImageDataURI =
|
|
|
|
|
|
describe('core/utils', () => {
|
|
|
describe('generateFileID', () => {
|
|
|
- it('should take the filename object and produce a lowercase file id made up of the name and lastModified date', () => {
|
|
|
+ it('should take the filename object and produce a lowercase file id made up of uppy- prefix, file name (cleaned up to be lowercase, letters and numbers only), type, size and lastModified date', () => {
|
|
|
const fileObj = {
|
|
|
name: 'fOo0Fi@£$.jpg',
|
|
|
+ type: 'image/jpeg',
|
|
|
data: {
|
|
|
- lastModified: '2017-08-31T00:00:00.000Z'
|
|
|
+ lastModified: '2017-08-31T00:00:00.000Z',
|
|
|
+ size: 2271173
|
|
|
}
|
|
|
}
|
|
|
|
|
|
expect(utils.generateFileID(fileObj)).toEqual(
|
|
|
- 'foo0fijpg2017-08-31T00:00:00.000Z'
|
|
|
+ 'uppy-foo0fijpg-image/jpeg-2271173-2017-08-31T00:00:00.000Z'
|
|
|
)
|
|
|
})
|
|
|
})
|