fix(core): update
This commit is contained in:
27
test/test.ts
27
test/test.ts
@ -7,6 +7,7 @@ const testQenv = new Qenv('./', './.nogit/');
|
||||
|
||||
let testSmartbucket: smartbucket.SmartBucket;
|
||||
let myBucket: smartbucket.Bucket;
|
||||
let baseDirectory: smartbucket.Directory;
|
||||
|
||||
tap.test('should create a valid smartbucket', async () => {
|
||||
testSmartbucket = new smartbucket.SmartBucket({
|
||||
@ -44,5 +45,31 @@ tap.test('should delete data in bucket', async () => {
|
||||
await myBucket.fastRemove('hithere/socool.txt');
|
||||
});
|
||||
|
||||
// fs operations
|
||||
|
||||
tap.test('prepare for directory style tests', async () => {
|
||||
await myBucket.fastStore('dir1/file1.txt', 'dir1/file1.txt content');
|
||||
await myBucket.fastStore('dir1/file2.txt', 'dir1/file2.txt content');
|
||||
await myBucket.fastStore('dir2/file1.txt', 'dir2/file1.txt content');
|
||||
await myBucket.fastStore('dir3/file1.txt', 'dir3/file1.txt content');
|
||||
await myBucket.fastStore('file1.txt', 'file1 content');
|
||||
});
|
||||
|
||||
tap.test('should get base directory', async () => {
|
||||
baseDirectory = await myBucket.getBaseDirectory();
|
||||
const directories = await baseDirectory.listDirectories();
|
||||
expect(directories.length).to.equal(3);
|
||||
const files = await baseDirectory.listFiles();
|
||||
});
|
||||
|
||||
|
||||
tap.test('clean up directory style tests', async () => {
|
||||
await myBucket.fastRemove('dir1/file1.txt');
|
||||
await myBucket.fastRemove('dir1/file2.txt');
|
||||
await myBucket.fastRemove('dir2/file1.txt');
|
||||
await myBucket.fastRemove('dir3/file1.txt');
|
||||
await myBucket.fastRemove('file1.txt');
|
||||
});
|
||||
|
||||
|
||||
tap.start();
|
||||
|
Reference in New Issue
Block a user