Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Ancillary feature #204

Merged
merged 24 commits into from
Aug 5, 2024
Merged

Add Ancillary feature #204

merged 24 commits into from
Aug 5, 2024

Conversation

TylerZeroMaster and others added 17 commits May 21, 2024 10:46
Should also handle rename/remove/etc
The orphans appear outside of all books, at the bottom of the tree view
Might be better to use `capabilities`, an array of words like 'delete', 'rename', etc., to support conditions

Example: we may not want to allow removing an orphaned subbook/page
Mostly to address a problem with the tsconfig file, but it's probably better this way anyway
I was stuck on this for a bit. Initially I tried
to write the srcBookToc immediately after removing the node on
model-manager.ts:594. The tests kept failing because the page was being
orphaned instead of appearing in the second book.

I realized that the sideEffectFn was running which
overwrote `this.bookTocs` with a new array. This meant that the splice
(model-manager.ts:597) was modifying a different list of children because the
reference returned by `lookupToken` was not the same as the one stored in
`bookToc`.

I moved my write operation to the end and added a warning. Hopefully the
warning will save someone else from this confusion in the future.
@sparksam sparksam marked this pull request as ready for review June 30, 2024 23:11
@sparksam sparksam requested a review from a team June 30, 2024 23:11
Copy link
Contributor

@TylerZeroMaster TylerZeroMaster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but there are some things not covered by tests. If I look at the html report (in .nyc_output/lcov-report after running npm run test:unit) it looks like most of the uncovered parts are where the functions return early if no title is entered.

In my opinion, it's fine to either nest the logic that expects a title inside the if statement instead of returning early, or istanbul ignore the if statements that check the title (since they only return, I do not see it being a big deal to ignore them).

Also, the validation function for askTitle is not covered by tests. I would maybe pull this function out of the askTitle function and make it a new function that you can test separately. Alternatively, you could use a mock implementation of vscode.window.showInputBox that calls the validation function.

@sparksam sparksam requested a review from TylerZeroMaster July 16, 2024 17:07
@sparksam sparksam merged commit 30dcb65 into main Aug 5, 2024
1 check passed
@sparksam sparksam deleted the sk-ancillary branch August 5, 2024 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants