Skip to content

Commit

Permalink
fix: test
Browse files Browse the repository at this point in the history
  • Loading branch information
tkat0 committed Sep 18, 2022
1 parent 856da22 commit 959abd9
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ describe('IndentListItemsUsecase', () => {
obsidian.readCurrentLine.mockReturnValue({ lineNo, text: page[lineNo] });
obsidian.readLine.mockImplementation((lineNo) => page[lineNo]);
obsidian.lineCount.mockReturnValue(page.length);
obsidian.canIndent.mockReturnValue(true);
};

it(`should indent with no list item`, async () => {
Expand All @@ -42,6 +43,23 @@ describe('IndentListItemsUsecase', () => {
expect(changedLineNo).toEqual([]);
});

it(`should indent and unindent on several sections`, async () => {
const page = ['```', 'inside code block', '```'];
const lineNo = 1;

setMock(page, lineNo);
obsidian.canIndent.mockReturnValue(false);

{
const { changedLineNo } = indentListItemsUsecase.invoke('indent');
expect(changedLineNo).toEqual([]);
}
{
const { changedLineNo } = indentListItemsUsecase.invoke('outdent');
expect(changedLineNo).toEqual([]);
}
});

it(`should indent`, async () => {
const page = ['- 0', '- 1', '- 2'];
const lineNo = 1;
Expand Down

0 comments on commit 959abd9

Please sign in to comment.