{"size": 1368, "ext": "js", "max_stars_repo_path": "wordpress/wp-content/plugins/woocommerce/packages/woocommerce-blocks/assets/js/base/components/product-price/test/index.js", "max_stars_repo_name": "joeysudo/E-commerce-Website-with-Wordpress", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "wordpress/wp-content/plugins/woocommerce/packages/woocommerce-blocks/assets/js/base/components/product-price/test/index.js", "max_issues_repo_name": "joeysudo/E-commerce-Website-with-Wordpress", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "wordpress/wp-content/plugins/woocommerce/packages/woocommerce-blocks/assets/js/base/components/product-price/test/index.js", "max_forks_repo_name": "joeysudo/E-commerce-Website-with-Wordpress", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 21.375, "max_line_length": 68, "alphanum_fraction": 0.6016081871}
/**
 * External dependencies
 */
import TestRenderer from 'react-test-renderer';

/**
 * Internal dependencies
 */
import ProductPrice from '../index';

describe( 'ProductPrice', () => {
	const currency = {
		code: 'GBP',
		currency_code: 'GBP',
		currency_decimal_separator: '.',
		currency_minor_unit: 2,
		currency_prefix: '£',
		currency_suffix: '',
		currency_symbol: '£',
		currency_thousand_separator: ',',
		decimalSeparator: '.',
		minorUnit: 2,
		prefix: '£',
		price: '61400',
		price_range: null,
		raw_prices: {
			precision: 6,
			price: '614000000',
			regular_price: '614000000',
			sale_price: '614000000',
		},
		regular_price: '61400',
		sale_price: '61400',
		suffix: '',
		symbol: '£',
		thousandSeparator: ',',
	};

	test( 'should use default price if no format is provided', () => {
		const component = TestRenderer.create(
			<ProductPrice
				price={ 50 }
				regularPrice={ 100 }
				currency={ currency }
			/>
		);

		expect( component.toJSON() ).toMatchSnapshot();
	} );

	test( 'should apply the format if one is provided', () => {
		const component = TestRenderer.create(
			<ProductPrice
				price={ 50 }
				regularPrice={ 100 }
				currency={ currency }
				format="pre price <price/> Test format"
			/>
		);

		expect( component.toJSON() ).toMatchSnapshot();
	} );
} );
