From bc410899250bea8a727b3f169f73ba926e4d1a94 Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Sun, 20 Oct 2019 00:45:11 +0200 Subject: [PATCH] fix(core): update --- test/test.ts | 7 +++++++ ts/smartbucket.classes.directory.ts | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/test/test.ts b/test/test.ts index 3e0d455..ec47b18 100644 --- a/test/test.ts +++ b/test/test.ts @@ -67,6 +67,13 @@ tap.test('should get base directory', async () => { expect(files.length).to.equal(1); }); +tap.test('should correctly build paths for sub directories', async () => { + const dir1 = await baseDirectory.getSubDirectoryByName('dir1'); + expect(dir1).to.be.instanceOf(smartbucket.Directory); + const dir1BasePath = dir1.getBasePath(); + console.log(dir1BasePath); +}); + tap.test('clean up directory style tests', async () => { await myBucket.fastRemove('dir1/file1.txt'); await myBucket.fastRemove('dir1/file2.txt'); diff --git a/ts/smartbucket.classes.directory.ts b/ts/smartbucket.classes.directory.ts index 4cb87f3..d40c04b 100644 --- a/ts/smartbucket.classes.directory.ts +++ b/ts/smartbucket.classes.directory.ts @@ -43,7 +43,7 @@ export class Directory { const parentDirectories = this.getParentDirectories(); let basePath = ''; for (const parentDir of parentDirectories) { - basePath = parentDir.name + '/' + basePath; + basePath = parentDir.name + '/' + this.name; } return basePath; }