30 lines
583 B
JavaScript
30 lines
583 B
JavaScript
|
// Set up `wp.*` aliases. Doing this because any tests importing wp stuff will
|
||
|
// likely run into this.
|
||
|
global.wp = {
|
||
|
shortcode: {
|
||
|
next() {},
|
||
|
regexp: jest.fn().mockReturnValue( new RegExp() ),
|
||
|
},
|
||
|
};
|
||
|
|
||
|
[
|
||
|
'components',
|
||
|
'utils',
|
||
|
'blocks',
|
||
|
'date',
|
||
|
'editor',
|
||
|
'data',
|
||
|
'core-data',
|
||
|
'edit-post',
|
||
|
'viewport',
|
||
|
'plugins',
|
||
|
].forEach( entryPointName => {
|
||
|
Object.defineProperty( global.wp, entryPointName, {
|
||
|
get: () => require( 'gutenberg/' + entryPointName ),
|
||
|
} );
|
||
|
} );
|
||
|
|
||
|
Object.defineProperty( global.wp, 'element', {
|
||
|
get: () => require( 'gutenberg/packages/element' ),
|
||
|
} );
|