一些检查失败了
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
59 行
1.4 KiB
TypeScript
59 行
1.4 KiB
TypeScript
import { compileWithFrontMatter, FrontMatter, stripOffFrontMatter } from './frontMatter';
|
|
import moment from 'moment';
|
|
|
|
const testCases: [string, FrontMatter, string, string][] = [
|
|
|
|
// =============================================================
|
|
|
|
[
|
|
`
|
|
---
|
|
tweet: Introducing the "GitHub Action Raw Log Viewer" extension for Chrome
|
|
forum_url: https://discourse.joplinapp.org/t/29139
|
|
created: 2019-09-29T14:28:34.000+00:00
|
|
updated: 2019-09-29T14:30:50.000+00:00
|
|
---
|
|
|
|
Body
|
|
`
|
|
|
|
,
|
|
|
|
{
|
|
tweet: 'Introducing the "GitHub Action Raw Log Viewer" extension for Chrome',
|
|
forum_url: 'https://discourse.joplinapp.org/t/29139',
|
|
created: moment('2019-09-29T14:28:34.000+00:00').toDate(),
|
|
updated: moment('2019-09-29T14:30:50.000+00:00').toDate(),
|
|
},
|
|
|
|
'Body',
|
|
|
|
`
|
|
---
|
|
tweet: Introducing the "GitHub Action Raw Log Viewer" extension for Chrome
|
|
forum_url: https://discourse.joplinapp.org/t/29139
|
|
created: 2019-09-29T14:28:34.000Z
|
|
updated: 2019-09-29T14:30:50.000Z
|
|
---
|
|
|
|
Body
|
|
`,
|
|
],
|
|
|
|
];
|
|
|
|
describe('frontMatter', () => {
|
|
|
|
it('should strip-off FrontMatter', async () => {
|
|
for (const [doc, frontMatter, body, compiled] of testCases) {
|
|
const actual = stripOffFrontMatter(doc.trim());
|
|
expect(actual.doc).toBe(body);
|
|
expect(actual.header).toEqual(frontMatter);
|
|
|
|
const actualCompiled = compileWithFrontMatter(actual);
|
|
expect(actualCompiled).toBe(compiled.trim());
|
|
}
|
|
});
|
|
|
|
});
|