-
Notifications
You must be signed in to change notification settings - Fork 4.3k
/
Copy pathindex.js
41 lines (36 loc) · 990 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/**
* External dependencies
*/
import { equal } from 'assert';
import fs from 'fs';
import path from 'path';
/**
* Internal dependencies
*/
import { registerCoreBlocks } from '../../../../library';
import rawHandler from '../../index';
import serialize from '../../../serializer';
const types = [
'plain',
'apple',
'google-docs',
'ms-word',
'ms-word-online',
'evernote',
];
describe( 'raw handling: integration', () => {
beforeAll( () => {
// Load all hooks that modify blocks
require( 'blocks/hooks' );
registerCoreBlocks();
} );
types.forEach( ( type ) => {
it( type, () => {
const input = fs.readFileSync( path.join( __dirname, `${ type }-in.html` ), 'utf8' ).trim();
const output = fs.readFileSync( path.join( __dirname, `${ type }-out.html` ), 'utf8' ).trim();
const converted = rawHandler( { HTML: input } );
const serialized = typeof converted === 'string' ? converted : serialize( converted );
equal( output, serialized );
} );
} );
} );