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();