diff --git a/.eslintignore b/.eslintignore index abb29d655..77acd0806 100644 --- a/.eslintignore +++ b/.eslintignore @@ -155,6 +155,7 @@ packages/app-desktop/commands/exportNotes.js packages/app-desktop/commands/focusElement.js packages/app-desktop/commands/index.js packages/app-desktop/commands/openProfileDirectory.js +packages/app-desktop/commands/renderMarkup.test.js packages/app-desktop/commands/renderMarkup.js packages/app-desktop/commands/replaceMisspelling.js packages/app-desktop/commands/restoreNoteRevision.js diff --git a/.gitignore b/.gitignore index 7beb12af8..c61785aad 100644 --- a/.gitignore +++ b/.gitignore @@ -132,6 +132,7 @@ packages/app-desktop/commands/exportNotes.js packages/app-desktop/commands/focusElement.js packages/app-desktop/commands/index.js packages/app-desktop/commands/openProfileDirectory.js +packages/app-desktop/commands/renderMarkup.test.js packages/app-desktop/commands/renderMarkup.js packages/app-desktop/commands/replaceMisspelling.js packages/app-desktop/commands/restoreNoteRevision.js diff --git a/packages/app-desktop/commands/renderMarkup.test.ts b/packages/app-desktop/commands/renderMarkup.test.ts new file mode 100644 index 000000000..83dc3f6ca --- /dev/null +++ b/packages/app-desktop/commands/renderMarkup.test.ts @@ -0,0 +1,47 @@ +import shim from '@joplin/lib/shim'; +import Resource from '@joplin/lib/models/Resource'; +import Note from '@joplin/lib/models/Note'; +import { setupDatabaseAndSynchronizer, supportDir, switchClient } from '@joplin/lib/testing/test-utils'; +import { runtime } from './renderMarkup'; +import { MarkupLanguage } from '@joplin/renderer'; +const testImagePath = `${supportDir}/photo.jpg`; + +const command = runtime(); + +describe('renderMarkup', () => { + + beforeEach(async () => { + await setupDatabaseAndSynchronizer(1); + await switchClient(1); + }); + + test('should return the rendered note as HTML', async () => { + { + const renderedNote = await command.execute(null, MarkupLanguage.Markdown, 'hello **strong**'); + expect(renderedNote.html).toBe('
hello strong
\n