文件
mynode/packages/lib/services/noteList/renderViewProps.test.ts
chen 301194963b
一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
feat: Initial clean release of CHM
2026-11-04 11:29:39 +08:00

60 行
1.3 KiB
TypeScript

import Logger from '@joplin/utils/Logger';
import { RenderNoteView } from '../plugins/api/noteListType';
import renderViewProps from './renderViewProps';
describe('renderViewProps', () => {
it('should render view props', async () => {
const view: RenderNoteView = {
note: {
title: 'M&M\'s®',
user_updated_time: (new Date(2024, 2, 20, 15, 30, 45, 500)).getTime(),
todo_completed: (new Date(2024, 2, 21, 15, 30, 45, 500)).getTime(),
isWatched: true,
is_todo: 1,
tags: [
{ title: 'one' },
{ title: 'two' },
],
},
};
await renderViewProps(view, [], {
noteTitleHtml: 'M&M's®',
});
expect(view).toEqual({
note: {
title: 'M&M's®',
user_updated_time: '20/03/2024 15:30',
todo_completed: '21/03/2024 15:30',
isWatched: true,
is_todo: 1,
tags: 'one, two',
},
});
});
it('should handle invalid view props', async () => {
const view: RenderNoteView = {
note: {
user_updated_time: 'not a number',
tags: 123,
},
};
Logger.globalLogger.enabled = false;
await renderViewProps(view, [], {
noteTitleHtml: '',
});
Logger.globalLogger.enabled = true;
expect(view).toEqual({
note: {
user_updated_time: 'Invalid date',
tags: 123,
},
});
});
});