Create directory when adding a book section from book tree view (#18966)

* create folder when creating a book section

* fix test
This commit is contained in:
Barbara Valdez
2022-04-07 16:19:33 -07:00
committed by GitHub
parent 379b24d78c
commit 683d906138
3 changed files with 5 additions and 4 deletions

View File

@@ -576,8 +576,7 @@ describe('BookTocManagerTests', function () {
bookTocManager = new BookTocManager(sourceBookModel);
const fileBasename = `addSectionTest-${generateGuid()}`;
const sectionTitle = 'Section Test';
const testFilePath = path.join(run.sectionA.contentFolder, 'sectionA', fileBasename).concat(FileExtension.Markdown);
await fs.writeFile(testFilePath, '');
const testFilePath = path.join(run.sectionA.contentFolder, 'sectionA', sectionTitle,fileBasename).concat(FileExtension.Markdown);
const pathDetails = new TocEntryPathHandler(testFilePath, run.sourceBook.root, sectionTitle);
await bookTocManager.addNewTocEntry(pathDetails, sectionA, true);
let toc: JupyterBookSection[] = yaml.safeLoad((await fs.promises.readFile(run.sourceBook.tocPath)).toString());