@@ -11,8 +11,8 @@ import { ROUND_UP, ROUND_DOWN } from '../constants';
1111
1212describe ( 'usePriceConstraints' , ( ) => {
1313 const TestComponent = ( { price } ) => {
14- const maxPriceConstraint = usePriceConstraint ( price , 2 , ROUND_UP ) ;
15- const minPriceConstraint = usePriceConstraint ( price , 2 , ROUND_DOWN ) ;
14+ const maxPriceConstraint = usePriceConstraint ( price , ROUND_UP ) ;
15+ const minPriceConstraint = usePriceConstraint ( price , ROUND_DOWN ) ;
1616 return (
1717 < div
1818 minPriceConstraint = { minPriceConstraint }
@@ -22,61 +22,61 @@ describe( 'usePriceConstraints', () => {
2222 } ;
2323
2424 it ( 'max price constraint should be updated when new price is set' , ( ) => {
25- const renderer = TestRenderer . create ( < TestComponent price = { 1000 } /> ) ;
25+ const renderer = TestRenderer . create ( < TestComponent price = { 10 } /> ) ;
2626 const container = renderer . root . findByType ( 'div' ) ;
2727
28- expect ( container . props . maxPriceConstraint ) . toBe ( 1000 ) ;
28+ expect ( container . props . maxPriceConstraint ) . toBe ( 10 ) ;
2929
30- renderer . update ( < TestComponent price = { 2000 } /> ) ;
30+ renderer . update ( < TestComponent price = { 20 } /> ) ;
3131
32- expect ( container . props . maxPriceConstraint ) . toBe ( 2000 ) ;
32+ expect ( container . props . maxPriceConstraint ) . toBe ( 20 ) ;
3333 } ) ;
3434
3535 it ( 'min price constraint should be updated when new price is set' , ( ) => {
36- const renderer = TestRenderer . create ( < TestComponent price = { 1000 } /> ) ;
36+ const renderer = TestRenderer . create ( < TestComponent price = { 10 } /> ) ;
3737 const container = renderer . root . findByType ( 'div' ) ;
3838
39- expect ( container . props . minPriceConstraint ) . toBe ( 1000 ) ;
39+ expect ( container . props . minPriceConstraint ) . toBe ( 10 ) ;
4040
41- renderer . update ( < TestComponent price = { 2000 } /> ) ;
41+ renderer . update ( < TestComponent price = { 20 } /> ) ;
4242
43- expect ( container . props . minPriceConstraint ) . toBe ( 2000 ) ;
43+ expect ( container . props . minPriceConstraint ) . toBe ( 20 ) ;
4444 } ) ;
4545
4646 it ( 'previous price constraint should be preserved when new price is not a infinite number' , ( ) => {
47- const renderer = TestRenderer . create ( < TestComponent price = { 1000 } /> ) ;
47+ const renderer = TestRenderer . create ( < TestComponent price = { 10 } /> ) ;
4848 const container = renderer . root . findByType ( 'div' ) ;
4949
50- expect ( container . props . maxPriceConstraint ) . toBe ( 1000 ) ;
50+ expect ( container . props . maxPriceConstraint ) . toBe ( 10 ) ;
5151
5252 renderer . update ( < TestComponent price = { Infinity } /> ) ;
5353
54- expect ( container . props . maxPriceConstraint ) . toBe ( 1000 ) ;
54+ expect ( container . props . maxPriceConstraint ) . toBe ( 10 ) ;
5555 } ) ;
5656
5757 it ( 'max price constraint should be higher if the price is decimal' , ( ) => {
5858 const renderer = TestRenderer . create (
59- < TestComponent price = { 1099 } />
59+ < TestComponent price = { 10.99 } />
6060 ) ;
6161 const container = renderer . root . findByType ( 'div' ) ;
6262
63- expect ( container . props . maxPriceConstraint ) . toBe ( 2000 ) ;
63+ expect ( container . props . maxPriceConstraint ) . toBe ( 20 ) ;
6464
65- renderer . update ( < TestComponent price = { 1999 } /> ) ;
65+ renderer . update ( < TestComponent price = { 19.99 } /> ) ;
6666
67- expect ( container . props . maxPriceConstraint ) . toBe ( 2000 ) ;
67+ expect ( container . props . maxPriceConstraint ) . toBe ( 20 ) ;
6868 } ) ;
6969
7070 it ( 'min price constraint should be lower if the price is decimal' , ( ) => {
7171 const renderer = TestRenderer . create (
72- < TestComponent price = { 999 } />
72+ < TestComponent price = { 9.99 } />
7373 ) ;
7474 const container = renderer . root . findByType ( 'div' ) ;
7575
7676 expect ( container . props . minPriceConstraint ) . toBe ( 0 ) ;
7777
78- renderer . update ( < TestComponent price = { 1999 } /> ) ;
78+ renderer . update ( < TestComponent price = { 19.99 } /> ) ;
7979
80- expect ( container . props . minPriceConstraint ) . toBe ( 1000 ) ;
80+ expect ( container . props . minPriceConstraint ) . toBe ( 10 ) ;
8181 } ) ;
8282} ) ;
0 commit comments