Create New Item
Item Type
File
Folder
Item Name
Search file in folder and subfolders...
Are you sure want to rename?
optometrists
/
cache
/
cache
/
.wp-cli
/
wp-content
/
plugins
/
woocommerce
/
packages
/
woocommerce-blocks
/
packages
/
prices
/
utils
/
test
:
price.js
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
/** * Internal dependencies */ import { formatPrice, getCurrency } from '../price'; describe( 'formatPrice', () => { test.each` value | prefix | suffix | expected ${ 1000 } | ${ '€' } | ${ '' } | ${ '€10' } ${ 1000 } | ${ '' } | ${ '€' } | ${ '10€' } ${ 1000 } | ${ '' } | ${ '$' } | ${ '10$' } ${ '1000' } | ${ '€' } | ${ '' } | ${ '€10' } ${ 0 } | ${ '€' } | ${ '' } | ${ '€0' } ${ '' } | ${ '€' } | ${ '' } | ${ '' } ${ null } | ${ '€' } | ${ '' } | ${ '' } ${ undefined } | ${ '€' } | ${ '' } | ${ '' } `( 'correctly formats price given "$value", "$prefix" prefix, and "$suffix" suffix', ( { value, prefix, suffix, expected } ) => { const formattedPrice = formatPrice( value, getCurrency( { prefix, suffix } ) ); expect( formattedPrice ).toEqual( expected ); } ); } );