Added unit test for books getChildren() method (#6602)

* started unit tests for books

* added first unit test for getchildren()

* fixed dependencies and use tmpdir

* latest from master
This commit is contained in:
Lucy Zhang
2019-08-06 10:39:01 -07:00
committed by GitHub
parent 308029c03c
commit 0509234362
5 changed files with 107 additions and 4 deletions

View File

@@ -100,6 +100,14 @@ export class BookTreeItem extends vscode.TreeItem {
}
}
public get title(): string {
return this.book.title;
}
public get uri(): string {
return this._uri;
}
public get root(): string {
return this.book.root;
}
@@ -128,4 +136,4 @@ export class BookTreeItem extends vscode.TreeItem {
return undefined;
}
}
}
}

View File

@@ -121,7 +121,7 @@ export class BookTreeViewProvider implements vscode.TreeDataProvider<BookTreeIte
return array.reduce((acc, val) => Array.isArray(val.sections) ? acc.concat(val).concat(this.flattenArray(val.sections)) : acc.concat(val), []);
}
private getBooks(): BookTreeItem[] {
public getBooks(): BookTreeItem[] {
let books: BookTreeItem[] = [];
for (let i in this._tableOfContentsPath) {
let root = path.dirname(path.dirname(this._tableOfContentsPath[i]));