mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-24 21:48:02 +02:00
feat(blog): add LastUpdateAuthor & LastUpdateTime (#9912)
Co-authored-by: OzakIOne <OzakIOne@users.noreply.github.com> Co-authored-by: sebastien <lorber.sebastien@gmail.com>
This commit is contained in:
parent
7938803747
commit
c745021b01
40 changed files with 833 additions and 359 deletions
|
@ -16,6 +16,7 @@ import {
|
|||
PathnameSchema,
|
||||
RouteBasePathSchema,
|
||||
ContentVisibilitySchema,
|
||||
FrontMatterLastUpdateSchema,
|
||||
} from '../validationSchemas';
|
||||
|
||||
function createTestHelpers({
|
||||
|
@ -216,4 +217,28 @@ describe('validation schemas', () => {
|
|||
testFail({unlisted: 42});
|
||||
testFail({draft: true, unlisted: true});
|
||||
});
|
||||
|
||||
it('frontMatterLastUpdateSchema schema', () => {
|
||||
const {testFail, testOK} = createTestHelpers({
|
||||
schema: FrontMatterLastUpdateSchema,
|
||||
});
|
||||
|
||||
testOK(undefined);
|
||||
testOK({date: '2021-01-01'});
|
||||
testOK({date: '2021-01'});
|
||||
testOK({date: '2021'});
|
||||
testOK({date: new Date()});
|
||||
testOK({author: 'author'});
|
||||
testOK({author: 'author', date: '2021-01-01'});
|
||||
testOK({author: 'author', date: new Date()});
|
||||
|
||||
testFail(null);
|
||||
testFail({});
|
||||
testFail('string');
|
||||
testFail(42);
|
||||
testFail(true);
|
||||
testFail([]);
|
||||
testFail({author: 23});
|
||||
testFail({date: '20-20-20'});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue