fix: use overwrite to make metadata files work

During a delete the metadata file is updated. As the overwrite property was not set, the metadata
couldn't be updated and caused issues.
This commit is contained in:
2024-11-18 21:08:39 +00:00
parent cec9c07b7c
commit 8d160cefb0
4 changed files with 39 additions and 22 deletions

View File

@ -21,8 +21,20 @@ tap.test('should create a valid smartbucket', async () => {
expect(myBucket.name).toEqual('testzone');
});
tap.test('', async () => {
})
tap.test('should put a file into the trash', async () => {
const path = 'hithere/socool.txt';
const file = await myBucket.fastPut({
path,
contents: 'hi there!',
});
expect(await file.getMetaData().then((meta) => meta.metadataFile.getJsonData())).toEqual({});
await file.delete({ mode: 'trash' });
expect(await file.getMetaData().then((meta) => meta.metadataFile.getJsonData())).toEqual({
custom_recycle: {
deletedAt: 123,
originalPath: 'hithere/socool.txt',
},
});
});
export default tap.start();
export default tap.start();

View File

@ -41,9 +41,12 @@ tap.test('should get data in bucket', async () => {
const fileString = await myBucket.fastGet({
path: 'hithere/socool.txt',
});
const fileStringStream = await myBucket.fastGetStream({
path: 'hithere/socool.txt',
}, 'nodestream');
const fileStringStream = await myBucket.fastGetStream(
{
path: 'hithere/socool.txt',
},
'nodestream'
);
console.log(fileString);
});