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' let testSmartexpose: smartexpose.SmartExpose; tap.test('should create a valid instance of smartexpose using Webdav', async () => { testSmartexpose = new smartexpose.SmartExpose({ webdav: { webdavCredentials: { serverUrl: await testQenv.getEnvVarOnDemand('WEBDAV_SERVER_URL'), password: await testQenv.getEnvVarOnDemand('WEBDAV_SERVER_TOKEN'), }, webdavSubPath: await testQenv.getEnvVarOnDemand('WEBDAV_SUB_PATH'), }, deleteAfterMillis: 30000, privateUrl: true, exposedBaseUrl: await testQenv.getEnvVarOnDemand('EXPOSED_BASE_URL'), }); await testSmartexpose.start(); expect(testSmartexpose).toBeInstanceOf(smartexpose.SmartExpose); }); 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();