Skip to content

Commit

Permalink
Specification test with begin (PKief#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
ganskef committed May 12, 2023
1 parent c0c4bb7 commit 40f1351
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion src/test/spec/checkbox/createCheckbox.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as assert from 'assert';
import * as vscode from 'vscode';
import { createCheckbox } from '../../../createCheckbox';
import { getConfig, getEditor } from '../../../helpers';
import { getConfig, getDateString, getEditor } from '../../../helpers';
import { setSettingsToDefault } from '../defaultSettings';

describe('create checkboxes', () => {
Expand Down Expand Up @@ -140,4 +140,32 @@ describe('create checkboxes', () => {

assert.strictEqual(content, expectedResult);
});

it('should create checkbox with begin date', async () => {
// create new document
const newDocument = await vscode.workspace.openTextDocument({
content: 'this is a text',
language: 'markdown',
});
await vscode.window.showTextDocument(newDocument);

// set the cursor to the current line
const editor = getEditor();
const position = editor.selection.active;
const newCursorPosition = position.with(0, 0);
const newSelection = new vscode.Selection(
newCursorPosition,
newCursorPosition
);
editor.selection = newSelection;

await createCheckbox(editor);

const dateNow = getDateString(new Date());
const content = editor.document.getText();
const typeOfBulletPoint = getConfig<string>('typeOfBulletPoint');
const expectedResult = `${typeOfBulletPoint} [ ] ${dateNow} this is a text`;

assert.strictEqual(content, expectedResult);
});
});

0 comments on commit 40f1351

Please sign in to comment.