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:
ozaki 2024-03-15 12:50:06 +01:00 committed by GitHub
parent 7938803747
commit c745021b01
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
40 changed files with 833 additions and 359 deletions

View file

@ -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'});
});
});