2018-06-20 17:43:53 +00:00
|
|
|
/** @format */
|
|
|
|
|
2018-07-13 13:33:15 +00:00
|
|
|
/**
|
|
|
|
* External dependencies
|
|
|
|
*/
|
|
|
|
import { setLocaleData } from '@wordpress/i18n';
|
|
|
|
|
2018-05-16 14:59:03 +00:00
|
|
|
// 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() ),
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2018-08-20 21:18:13 +00:00
|
|
|
global.wc = {};
|
|
|
|
|
2018-10-30 18:57:48 +00:00
|
|
|
const wordPressPackages = [
|
|
|
|
'element',
|
|
|
|
'date',
|
|
|
|
];
|
|
|
|
|
|
|
|
const wooCommercePackages = [
|
|
|
|
'components',
|
2018-11-06 21:53:22 +00:00
|
|
|
'csv',
|
2018-10-30 18:57:48 +00:00
|
|
|
'currency',
|
|
|
|
'date',
|
2018-11-05 21:02:04 +00:00
|
|
|
'navigation',
|
2019-01-29 16:48:46 +00:00
|
|
|
'number',
|
2018-10-30 18:57:48 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
wordPressPackages.forEach( lib => {
|
|
|
|
Object.defineProperty( global.wp, lib, {
|
|
|
|
get: () => require( `@wordpress/${ lib }` ),
|
|
|
|
} );
|
2018-05-16 14:59:03 +00:00
|
|
|
} );
|
|
|
|
|
2018-10-30 18:57:48 +00:00
|
|
|
wooCommercePackages.forEach( lib => {
|
|
|
|
Object.defineProperty( global.wc, lib, {
|
|
|
|
get: () => require( `@woocommerce/${ lib }` ),
|
|
|
|
} );
|
2018-08-20 21:18:13 +00:00
|
|
|
} );
|
|
|
|
|
2018-06-20 17:43:53 +00:00
|
|
|
global.wcSettings = {
|
|
|
|
adminUrl: 'https://vagrant.local/wp/wp-admin/',
|
|
|
|
locale: 'en-US',
|
2019-01-17 07:04:57 +00:00
|
|
|
currency: { code: 'USD', precision: 2, symbol: '$' },
|
2018-07-04 01:50:12 +00:00
|
|
|
date: {
|
|
|
|
dow: 0,
|
|
|
|
},
|
2018-10-18 09:34:37 +00:00
|
|
|
orderStatuses: {
|
2018-11-28 02:58:17 +00:00
|
|
|
pending: 'Pending payment',
|
|
|
|
processing: 'Processing',
|
|
|
|
'on-hold': 'On hold',
|
|
|
|
completed: 'Completed',
|
|
|
|
cancelled: 'Cancelled',
|
|
|
|
refunded: 'Refunded',
|
|
|
|
failed: 'Failed',
|
2018-10-18 09:34:37 +00:00
|
|
|
},
|
2018-12-17 19:34:09 +00:00
|
|
|
l10n: {
|
|
|
|
userLocale: 'en_US',
|
|
|
|
weekdaysShort: [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ],
|
|
|
|
},
|
2018-06-20 17:43:53 +00:00
|
|
|
};
|
2018-05-28 10:55:19 +00:00
|
|
|
|
2018-07-13 13:33:15 +00:00
|
|
|
setLocaleData( { '': { domain: 'wc-admin', lang: 'en_US' } }, 'wc-admin' );
|