1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-12 08:54:00 +02:00
joplin/packages/app-cli/app/utils/testUtils.ts
2022-11-01 15:28:14 +00:00

18 lines
596 B
TypeScript

const { app } = require('../app');
import Folder from '@joplin/lib/models/Folder';
import BaseCommand from '../base-command';
import setupCommand from '../setupCommand';
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();
};