import proxyquire from 'proxyquire'; export type MarkdownToken = { token: string; type?: string; text: string; noHtml?: string }; export type ParsedMessage = { html?: string; msg?: string; tokens?: MarkdownToken[] }; export type MarkdownOptions = { supportSchemesForLink?: string; headers?: boolean; rootUrl?: string }; const mocks = { 'meteor/meteor': { Meteor: { absoluteUrl() { return 'http://localhost:3000/'; }, }, }, }; export const { Markdown, filterMarkdown, createMarkdownMessageRenderer, createMarkdownNotificationRenderer } = proxyquire .noCallThru() .load('../../../../app/markdown/lib/markdown', mocks) as typeof import('../../../../app/markdown/lib/markdown'); export const { original } = proxyquire.noCallThru().load('../../../../app/markdown/lib/parser/original/original', mocks) as { original: (message: ParsedMessage, options?: MarkdownOptions) => ParsedMessage; }; export const { code } = proxyquire .noCallThru() .load('../../../../app/markdown/lib/parser/original/code', mocks) as typeof import('../../../../app/markdown/lib/parser/original/code'); const copyonly = (text: string, marker: string) => `${marker}${text}${marker}`; export const markup = { bold: (text: string) => copyonly(`${text}`, '*'), inlineCode: (text: string) => copyonly(`${text}`, '`'), anchor: (url: string, title: string, target = '_blank') => `${title}`, image: (url: string, title: string, target = '_blank') => `` + `
`, blockquote: (text: string, marker = '>') => `
${marker}${text}
`, };