feat(docs,blog,pages): add support for "unlisted" front matter - hide md content in production (#8004)

Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
This commit is contained in:
Jody Heavener 2022-11-03 06:31:41 -07:00 committed by GitHub
parent 7a023a2c41
commit 683ba3d2a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
131 changed files with 2449 additions and 303 deletions

View file

@ -14,6 +14,7 @@ import {
PluginIdSchema,
URISchema,
PathnameSchema,
ContentVisibilitySchema,
} from '../validationSchemas';
function createTestHelpers({
@ -166,4 +167,28 @@ describe('validation schemas', () => {
testFail('foo');
testFail('https://github.com/foo');
});
it('contentVisibilitySchema', () => {
const {testFail, testOK} = createTestHelpers({
schema: ContentVisibilitySchema,
});
testOK({});
testOK({draft: false});
testOK({draft: true});
testOK({unlisted: false});
testOK({unlisted: true});
testOK({draft: false, unlisted: false});
testOK({draft: true, unlisted: false});
testOK({draft: false, unlisted: true});
testOK({draft: true, unlisted: undefined});
testOK({draft: undefined, unlisted: true});
testFail({draft: 'bad string'});
testFail({draft: 42});
testFail({unlisted: 'bad string'});
testFail({unlisted: 42});
testFail({draft: true, unlisted: true});
});
});