mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
keep extension from file when generating random name (#127)
* keep extension from file when generating random name * added test for random name generation
This commit is contained in:
@@ -96,5 +96,10 @@ describe("media/mime-types", () => {
|
||||
`getRandomizedFilename(): ${filename} should end with ${ext}`,
|
||||
).toBe(ext);
|
||||
}
|
||||
|
||||
// make sure it keeps the extension, even if the file has a different type
|
||||
const file = new File([""], "image.jpg", { type: "text/plain" });
|
||||
const [, ext] = getRandomizedFilename(file).split(".");
|
||||
expect(ext).toBe("jpg");
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user