feat(bucket): expose the underlying S3 client through getStorageClient()

This commit is contained in:
2026-04-07 16:28:01 +00:00
parent 3a0cd78dad
commit cf0402cd7a
4 changed files with 32 additions and 1 deletions

View File

@@ -24,6 +24,17 @@ tap.test('should create a valid smartbucket', async () => {
expect(myBucket.name).toEqual(bucketName);
});
tap.test('should expose the underlying S3 client via getStorageClient()', async () => {
const client = myBucket.getStorageClient();
expect(client).toBeDefined();
expect(typeof (client as any).send).toEqual('function');
// The returned client must be the exact same instance as the parent
// SmartBucket's storageClient — not a copy. Use identity comparison
// because the S3Client contains circular references and cannot be
// deep-compared by tapbundle's toEqual.
expect(client === testSmartbucket.storageClient).toBeTrue();
});
tap.test('should clean all contents', async () => {
await myBucket.cleanAllContents();
expect(await myBucket.fastExists({ path: 'hithere/socool.txt' })).toBeFalse();