A calm place to write long-form, and publish it to the open social web. skypress.blog/
0

Configure Feed

Select the types of activity you want to include in your feed.

at trunk 1.1 kB View raw
1import { beforeAll, describe, expect, it } from 'vitest'; 2import { createBlock } from '@wordpress/blocks'; 3import { 4 registerSkyPressBlocks, 5 serializeBlocks, 6 parseBlocks, 7} from './serialize'; 8 9beforeAll( () => { 10 registerSkyPressBlocks(); 11} ); 12 13describe( 'block-tree round trip', () => { 14 it( 'serialize → parse → serialize is idempotent for the curated set', () => { 15 const blocks = [ 16 createBlock( 'core/heading', { level: 2, content: 'Welcome' } ), 17 createBlock( 'core/paragraph', { content: 'Hello world' } ), 18 createBlock( 'core/list', {}, [ 19 createBlock( 'core/list-item', { content: 'First' } ), 20 createBlock( 'core/list-item', { content: 'Second' } ), 21 ] ), 22 createBlock( 'core/quote', {}, [ 23 createBlock( 'core/paragraph', { content: 'A quotable line' } ), 24 ] ), 25 createBlock( 'core/separator' ), 26 ]; 27 28 const markup1 = serializeBlocks( blocks ); 29 const markup2 = serializeBlocks( parseBlocks( markup1 ) ); 30 31 expect( markup1 ).toContain( '<!-- wp:heading' ); 32 expect( markup2 ).toBe( markup1 ); 33 } ); 34} );