fix(core): update

This commit is contained in:
2024-04-24 18:02:21 +02:00
parent a301d67bda
commit b538f72004
10 changed files with 219 additions and 44 deletions

View File

@@ -1,5 +1,7 @@
import { expect, expectAsync, tap } from '@push.rocks/tapbundle';
import * as qenv from '@push.rocks/qenv';
import * as smartfile from '@push.rocks/smartfile';
const testQenv = new qenv.Qenv('./', './.nogit/');
import * as smartexpose from '../ts/index.js'
@@ -10,15 +12,33 @@ tap.test('should create a valid instance of smartexpose using Webdav', async ()
testSmartexpose = await smartexpose.SmartExpose.createWithWebdav({
webdavCredentials: {
serverUrl: await testQenv.getEnvVarOnDemand('WEBDAV_SERVER_URL'),
password: await testQenv.getEnvVarOnDemand('WEBDAV_PASSWORD'),
password: await testQenv.getEnvVarOnDemand('WEBDAV_SERVER_TOKEN'),
},
exposedBaseUrl: await testQenv.getEnvVarOnDemand('WEBDAV_EXPOSED_BASE_URL'),
webdavSubPath: await testQenv.getEnvVarOnDemand('WEBDAV_SUB_PATH'),
exposeOptions: {
deleteAfterMillis: 30000,
privateUrl: true,
exposedBaseUrl: await testQenv.getEnvVarOnDemand('EXPOSED_BASE_URL'),
}
})
}
});
await testSmartexpose.start();
expect(testSmartexpose).toBeInstanceOf(smartexpose.SmartExpose);
});
tap.start()
tap.test('should expose a file', async () => {
await testSmartexpose.exposeFile({
smartFile: await smartfile.SmartFile.fromString('okidoks', 'hi there', 'utf8'),
deleteAfterMillis: 10000,
privateUrl: true,
});
});
tap.test('should delete the file', async (toolsArg) => {
await toolsArg.delayFor(11000);
});
tap.test('should stop the smartexpose', async () => {
await testSmartexpose.stop();
})
export default tap.start();