fix(core): update
This commit is contained in:
36
test/test.ts
Normal file
36
test/test.ts
Normal file
@ -0,0 +1,36 @@
|
||||
import { expect, expectAsync, tap } from '@push.rocks/tapbundle';
|
||||
import * as smartwebdav from '../ts/index.js'
|
||||
|
||||
import * as smartfile from '@push.rocks/smartfile';
|
||||
import * as qenv from '@push.rocks/qenv';
|
||||
const testQenv = new qenv.Qenv('./', './.nogit/');
|
||||
|
||||
let webdavClient: smartwebdav.WebdavClient;
|
||||
|
||||
tap.test('should', async () => {
|
||||
webdavClient = new smartwebdav.WebdavClient({
|
||||
serverUrl: await testQenv.getEnvVarOnDemand('SERVER_URL'),
|
||||
authType: smartwebdav.authType.Password,
|
||||
password: await testQenv.getEnvVarOnDemand('SERVER_TOKEN'),
|
||||
});
|
||||
|
||||
const directoryListed = await webdavClient.listDirectory('/testdir');
|
||||
console.log(directoryListed);
|
||||
});
|
||||
|
||||
tap.test('should upload smartfiles', async () => {
|
||||
const smartfile1 = await smartfile.SmartFile.fromString('./testdir/so/awesome/hello.txt', 'hello there', 'utf8');
|
||||
const smartfile2 = await smartfile.SmartFile.fromString('./testdir/so/awesome/hello2.txt', 'hello there 2', 'utf8');
|
||||
|
||||
await webdavClient.uploadSmartFileArray([smartfile1, smartfile2]);
|
||||
});
|
||||
|
||||
tap.test('should ensure directory', async () => {
|
||||
await webdavClient.ensureDirectory('/testdir/another/dirctory');
|
||||
})
|
||||
|
||||
tap.test('should delete a directory', async () => {
|
||||
await webdavClient.deleteDirectory('/testdir/another');
|
||||
})
|
||||
|
||||
export default tap.start()
|
Reference in New Issue
Block a user