2024-01-20 16:29:21 +02:00
|
|
|
import app from '../app';
|
2022-11-01 17:28:14 +02:00
|
|
|
import Folder from '@joplin/lib/models/Folder';
|
|
|
|
import BaseCommand from '../base-command';
|
|
|
|
import setupCommand from '../setupCommand';
|
|
|
|
|
2023-06-30 11:30:29 +02:00
|
|
|
// eslint-disable-next-line @typescript-eslint/ban-types -- Old code before rule was applied
|
2022-11-01 17:28:14 +02:00
|
|
|
export const setupCommandForTesting = (CommandClass: any, stdout: Function = null): BaseCommand => {
|
|
|
|
const command = new CommandClass();
|
|
|
|
setupCommand(command, stdout, null, null);
|
|
|
|
return command;
|
|
|
|
};
|
|
|
|
|
|
|
|
export const setupApplication = async () => {
|
|
|
|
// We create a notebook and set it as default since most commands require
|
|
|
|
// such notebook.
|
|
|
|
await Folder.save({ title: 'default' });
|
|
|
|
await app().refreshCurrentFolder();
|
|
|
|
};
|