Skip to content

Commit

Permalink
Add strict meta schema validation test for block.json (#44423)
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Lende committed Sep 24, 2022
1 parent 8b9df32 commit a78f644
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/integration/blocks-schema.test.js
Expand Up @@ -21,6 +21,16 @@ describe( 'block.json schema', () => {
] );
const ajv = new Ajv();

test( 'strictly adheres to the draft-04 meta schema', () => {
// Use ajv.compile instead of ajv.validateSchema to validate the schema
// because validateSchema only checks syntax, whereas, compile checks
// if the schema is semantically correct with strict mode.
// See https://github.com/ajv-validator/ajv/issues/1434#issuecomment-822982571
const result = ajv.compile( blockSchema );

expect( result.errors ).toBe( null );
} );

test( 'found block folders', () => {
expect( blockFolders.length ).toBeGreaterThan( 0 );
} );
Expand Down

0 comments on commit a78f644

Please sign in to comment.