mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
Chore: Fix compilation errors due to test resources with .ts extensions (#10909)
This commit is contained in:
parent
e05d7197bd
commit
60a1617b22
@ -1,9 +1,10 @@
|
||||
import Note from '@joplin/lib/models/Note';
|
||||
import { setupDatabaseAndSynchronizer, switchClient } from '@joplin/lib/testing/test-utils';
|
||||
import { setupDatabaseAndSynchronizer, supportDir, switchClient } from '@joplin/lib/testing/test-utils';
|
||||
import { act, renderHook } from '@testing-library/react-hooks';
|
||||
import useFormNote, { HookDependencies } from './useFormNote';
|
||||
import shim from '@joplin/lib/shim';
|
||||
import Resource from '@joplin/lib/models/Resource';
|
||||
import { join } from 'path';
|
||||
|
||||
const defaultFormNoteProps: HookDependencies = {
|
||||
syncStarted: false,
|
||||
@ -115,7 +116,7 @@ describe('useFormNote', () => {
|
||||
|
||||
test('should refresh resource infos when changed outside the editor', async () => {
|
||||
let note = await Note.save({});
|
||||
note = await shim.attachFileToNote(note, __filename);
|
||||
note = await shim.attachFileToNote(note, join(supportDir, 'sample.txt'));
|
||||
const resourceIds = Note.linkedItemIds(note.body);
|
||||
const resource = await Resource.load(resourceIds[0]);
|
||||
|
||||
@ -141,12 +142,12 @@ describe('useFormNote', () => {
|
||||
});
|
||||
|
||||
await act(async () => {
|
||||
await Resource.save({ ...resource, filename: 'test.ts' });
|
||||
await Resource.save({ ...resource, filename: 'test.txt' });
|
||||
});
|
||||
await formNote.waitFor(() => {
|
||||
const resourceInfo = formNote.result.current.resourceInfos[resource.id];
|
||||
expect(resourceInfo.item).toMatchObject({
|
||||
id: resource.id, filename: 'test.ts',
|
||||
id: resource.id, filename: 'test.txt',
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -0,0 +1 @@
|
||||
This is a test.
|
@ -2,7 +2,7 @@ import { test, expect } from './util/test';
|
||||
import MainScreen from './models/MainScreen';
|
||||
import setFilePickerResponse from './util/setFilePickerResponse';
|
||||
import waitForNextOpenPath from './util/waitForNextOpenPath';
|
||||
import { basename } from 'path';
|
||||
import { basename, join } from 'path';
|
||||
|
||||
test.describe('richTextEditor', () => {
|
||||
test('HTML links should be preserved when editing a note', async ({ electronApp, mainWindow }) => {
|
||||
@ -58,7 +58,7 @@ test.describe('richTextEditor', () => {
|
||||
await editor.focusCodeMirrorEditor();
|
||||
|
||||
// Attach this file to the note (create a resource ID)
|
||||
const pathToAttach = __filename;
|
||||
const pathToAttach = join(__dirname, 'resources', 'test-file.txt');
|
||||
await setFilePickerResponse(electronApp, [pathToAttach]);
|
||||
await editor.attachFileButton.click();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user