mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-21 09:38:01 +02:00
Chore: Fix CI (#11281)
This commit is contained in:
parent
f4ee4a178e
commit
cce6898d83
@ -34,11 +34,11 @@ describe('renderMarkup', () => {
|
|||||||
|
|
||||||
{
|
{
|
||||||
const note = await Note.save({ });
|
const note = await Note.save({ });
|
||||||
await shim.attachFileToNote(note, testImagePath, null, { resizeLargeImages: 'never' });
|
await shim.attachFileToNote(note, testImagePath, { resizeLargeImages: 'never' });
|
||||||
const resource = (await Resource.all())[0];
|
const resource = (await Resource.all())[0];
|
||||||
const noteBody = (await Note.load(note.id)).body;
|
const noteBody = (await Note.load(note.id)).body;
|
||||||
const renderedNote = await await command.execute(null, MarkupLanguage.Markdown, noteBody);
|
const renderedNote = await await command.execute(null, MarkupLanguage.Markdown, noteBody);
|
||||||
expect(renderedNote.html).toContain(`<div id="rendered-md"><p><img data-from-md data-resource-id="${resource.id}" src="joplin-content://note-viewer//Users/laurent/src/joplin/packages/lib/testing/../../app-cli/tests/test data/`);
|
expect(renderedNote.html).toContain(`<div id="rendered-md"><p><img data-from-md data-resource-id="${resource.id}" src="joplin-content://note-viewer/`);
|
||||||
expect(renderedNote.html).toContain(`/resources-1/${resource.id}.jpg?t=`);
|
expect(renderedNote.html).toContain(`/resources-1/${resource.id}.jpg?t=`);
|
||||||
expect(renderedNote.html).toContain('" title alt="photo.jpg" /></p>');
|
expect(renderedNote.html).toContain('" title alt="photo.jpg" /></p>');
|
||||||
}
|
}
|
||||||
|
@ -416,11 +416,10 @@ function shimInit(options: ShimInitOptions = null) {
|
|||||||
return newBody.join('\n\n');
|
return newBody.join('\n\n');
|
||||||
};
|
};
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
shim.attachFileToNote = async function(note, filePath, options = {}) {
|
||||||
shim.attachFileToNote = async function(note, filePath, position: number = null, options: any = null) {
|
|
||||||
if (!options) options = {};
|
if (!options) options = {};
|
||||||
if (note.markup_language) options.markupLanguage = note.markup_language;
|
if (note.markup_language) options.markupLanguage = note.markup_language;
|
||||||
const newBody = await shim.attachFileToNoteBody(note.body, filePath, position, options);
|
const newBody = await shim.attachFileToNoteBody(note.body, filePath, options.position ?? 0, options);
|
||||||
if (!newBody) return null;
|
if (!newBody) return null;
|
||||||
|
|
||||||
const newNote = { ...note, body: newBody };
|
const newNote = { ...note, body: newBody };
|
||||||
|
@ -3,6 +3,7 @@ import { NoteEntity, ResourceEntity } from './services/database/types';
|
|||||||
import type FsDriverBase from './fs-driver-base';
|
import type FsDriverBase from './fs-driver-base';
|
||||||
import type FileApiDriverLocal from './file-api-driver-local';
|
import type FileApiDriverLocal from './file-api-driver-local';
|
||||||
import { Crypto } from './services/e2ee/types';
|
import { Crypto } from './services/e2ee/types';
|
||||||
|
import { MarkupLanguage } from '@joplin/renderer';
|
||||||
|
|
||||||
export interface CreateResourceFromPathOptions {
|
export interface CreateResourceFromPathOptions {
|
||||||
resizeLargeImages?: 'always' | 'never' | 'ask';
|
resizeLargeImages?: 'always' | 'never' | 'ask';
|
||||||
@ -33,6 +34,12 @@ interface FetchOptions {
|
|||||||
agent?: unknown;
|
agent?: unknown;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interface AttachFileToNoteOptions {
|
||||||
|
resizeLargeImages?: 'always'|'never';
|
||||||
|
position?: number;
|
||||||
|
markupLanguage?: MarkupLanguage;
|
||||||
|
}
|
||||||
|
|
||||||
let isTestingEnv_ = false;
|
let isTestingEnv_ = false;
|
||||||
|
|
||||||
// We need to ensure that there's only one instance of React being used by all
|
// We need to ensure that there's only one instance of React being used by all
|
||||||
@ -308,8 +315,7 @@ const shim = {
|
|||||||
// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied
|
// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied
|
||||||
detectAndSetLocale: null as Function,
|
detectAndSetLocale: null as Function,
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Old code before rule was applied
|
attachFileToNote: async (_note: NoteEntity, _filePath: string, _options?: AttachFileToNoteOptions): Promise<NoteEntity> => {
|
||||||
attachFileToNote: async (_note: any, _filePath: string, _position: number, _options: any): Promise<NoteEntity> => {
|
|
||||||
throw new Error('Not implemented: attachFileToNote');
|
throw new Error('Not implemented: attachFileToNote');
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user