fix(test): Refactor trash test to improve metadata and deletion validation
This commit is contained in:
parent
8ba7cdc873
commit
75dd1d43a9
@ -1,5 +1,11 @@
|
||||
# Changelog
|
||||
|
||||
## 2024-11-25 - 3.3.5 - fix(test)
|
||||
Refactor trash test to improve metadata validation
|
||||
|
||||
- Added new checks in trash tests to ensure metadata files are correctly moved to trash.
|
||||
- Validated the presence and integrity of metadata within trashed files.
|
||||
|
||||
## 2024-11-25 - 3.3.4 - fix(core)
|
||||
Minor refactoring and cleanup of TypeScript source files for improved readability and maintainability.
|
||||
|
||||
|
@ -52,7 +52,21 @@ tap.test('should put a file into the trash', async () => {
|
||||
console.log(fileMetadata.toString());
|
||||
expect(await file.getMetaData().then((meta) => meta.metadataFile.getJsonData())).toEqual({});
|
||||
await file.delete({ mode: 'trash' });
|
||||
jestExpect(await file.getMetaData().then((meta) => meta.metadataFile.getJsonData())).toEqual({
|
||||
|
||||
const getTrashContents = async () => {
|
||||
const trash = await myBucket.getTrash();
|
||||
const trashDir = await trash.getTrashDir();
|
||||
return await trashDir.listFiles();
|
||||
}
|
||||
|
||||
const trashedFiles = await getTrashContents();
|
||||
expect(trashedFiles.length).toEqual(2);
|
||||
|
||||
const trashedMetaFile = trashedFiles.find(file => file.name.endsWith('.metadata'));
|
||||
expect(trashedMetaFile).toBeDefined();
|
||||
expect(trashedMetaFile).toBeInstanceOf(smartbucket.File);
|
||||
|
||||
jestExpect(await trashedMetaFile!.getJsonData()).toEqual({
|
||||
custom_recycle: {
|
||||
deletedAt: jestExpect.any(Number),
|
||||
originalPath: "trashtest/trashme.txt",
|
||||
|
@ -3,6 +3,6 @@
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/smartbucket',
|
||||
version: '3.3.4',
|
||||
version: '3.3.5',
|
||||
description: 'A TypeScript library providing a cloud-agnostic interface for managing object storage with functionalities like bucket management, file and directory operations, and advanced features such as metadata handling and file locking.'
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user