mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-03 08:35:29 +02:00
28 lines
873 B
TypeScript
28 lines
873 B
TypeScript
import Note from '@joplin/lib/models/Note';
|
|
import { NoteEntity } from '@joplin/lib/services/database/types';
|
|
import { setupDatabaseAndSynchronizer, switchClient } from '@joplin/lib/testing/test-utils';
|
|
import { setupCommandForTesting, setupApplication } from './utils/testUtils';
|
|
const Command = require('./command-done');
|
|
|
|
describe('command-done', () => {
|
|
|
|
beforeEach(async () => {
|
|
await setupDatabaseAndSynchronizer(1);
|
|
await switchClient(1);
|
|
await setupApplication();
|
|
});
|
|
|
|
it('should make a note as "done"', async () => {
|
|
const note = await Note.save({ title: 'hello', is_todo: 1, todo_completed: 0 });
|
|
|
|
const command = setupCommandForTesting(Command);
|
|
|
|
const now = Date.now();
|
|
await command.action({ note: note.id });
|
|
|
|
const checkNote: NoteEntity = await Note.load(note.id);
|
|
expect(checkNote.todo_completed).toBeGreaterThanOrEqual(now);
|
|
});
|
|
|
|
});
|