diff --git a/src/test/spec/checkbox/createCheckbox.spec.ts b/src/test/spec/checkbox/createCheckbox.spec.ts index ff48214..ebc1e33 100644 --- a/src/test/spec/checkbox/createCheckbox.spec.ts +++ b/src/test/spec/checkbox/createCheckbox.spec.ts @@ -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', () => { @@ -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('typeOfBulletPoint'); + const expectedResult = `${typeOfBulletPoint} [ ] ${dateNow} this is a text`; + + assert.strictEqual(content, expectedResult); + }); });