A calm place to write long-form, and publish it to the open social web.
skypress.blog/
1import { describe, expect, it } from 'vitest';
2import {
3 CONTENT_LEXICON_ID,
4 CONTENT_LEXICON_DESCRIPTION,
5 contentSchemaFields,
6} from './schema-doc';
7
8describe( 'content lexicon doc', () => {
9 it( 'exposes the owned lexicon NSID and description from the schema file', () => {
10 expect( CONTENT_LEXICON_ID ).toBe( 'blog.skypress.content.gutenberg' );
11 expect( CONTENT_LEXICON_DESCRIPTION ).toContain( 'block tree' );
12 } );
13
14 it( 'derives ordered field rows from the schema, with required flags', () => {
15 const fields = contentSchemaFields();
16 expect( fields.map( ( f ) => f.name ) ).toEqual( [ 'version', 'blocks', 'mentions' ] );
17
18 expect( fields[ 0 ] ).toMatchObject( {
19 name: 'version',
20 type: 'integer',
21 required: true,
22 } );
23 expect( fields[ 0 ].description.length ).toBeGreaterThan( 0 );
24
25 expect( fields[ 1 ] ).toMatchObject( {
26 name: 'blocks',
27 type: 'array',
28 required: true,
29 } );
30 expect( fields[ 1 ].description ).toContain( 'block tree' );
31
32 expect( fields[ 2 ] ).toMatchObject( {
33 name: 'mentions',
34 type: 'array',
35 required: false,
36 } );
37 expect( fields[ 2 ].description.length ).toBeGreaterThan( 0 );
38 } );
39} );