- Package renamed from @push.rocks/smarts3 to @push.rocks/smartstorage - Class: Smarts3 → SmartStorage, Interface: ISmarts3Config → ISmartStorageConfig - Method: getS3Descriptor → getStorageDescriptor - Rust binary: rusts3 → ruststorage - Rust types: S3Error→StorageError, S3Action→StorageAction, S3Config→SmartStorageConfig, S3Server→StorageServer - On-disk file extension: ._S3_object → ._storage_object - Default credentials: S3RVER → STORAGE - All internal S3 branding removed; AWS S3 protocol compatibility fully maintained
38 lines
1.1 KiB
TypeScript
38 lines
1.1 KiB
TypeScript
import { expect, tap } from '@git.zone/tstest/tapbundle';
|
|
import * as plugins from './plugins.js';
|
|
|
|
import * as smartstorage from '../ts/index.js';
|
|
|
|
let testSmartStorageInstance: smartstorage.SmartStorage;
|
|
|
|
tap.test('should create a smartstorage instance and run it', async (toolsArg) => {
|
|
testSmartStorageInstance = await smartstorage.SmartStorage.createAndStart({
|
|
server: {
|
|
port: 3333,
|
|
},
|
|
storage: {
|
|
cleanSlate: true,
|
|
},
|
|
});
|
|
console.log(`Let the instance run for 2 seconds`);
|
|
await toolsArg.delayFor(2000);
|
|
});
|
|
|
|
tap.test('should be able to access buckets', async () => {
|
|
const smartbucketInstance = new plugins.smartbucket.SmartBucket(
|
|
await testSmartStorageInstance.getStorageDescriptor(),
|
|
);
|
|
const bucket = await smartbucketInstance.createBucket('testbucket');
|
|
const baseDirectory = await bucket.getBaseDirectory();
|
|
await baseDirectory.fastPut({
|
|
path: 'subdir/hello.txt',
|
|
contents: 'hi there!',
|
|
});
|
|
});
|
|
|
|
tap.test('should stop the instance', async () => {
|
|
await testSmartStorageInstance.stop();
|
|
});
|
|
|
|
tap.start();
|