@@ -5,7 +5,7 @@ import { DriverRatingBadge } from './DriverRatingBadge';
55describe ( 'DriverRatingBadge' , ( ) => {
66 it ( 'renders with default props' , ( ) => {
77 const { container } = render ( < DriverRatingBadge /> ) ;
8- expect ( container . textContent ) . toBe ( 'R 0.0 0 .0k' ) ;
8+ expect ( container . textContent ) . toBe ( 'R 0.00 .0k' ) ;
99 } ) ;
1010
1111 it ( 'renders with license A and rating 5000' , ( ) => {
@@ -54,35 +54,35 @@ describe('DriverRatingBadge', () => {
5454 const { container } = render (
5555 < DriverRatingBadge license = { undefined } rating = { undefined } />
5656 ) ;
57- expect ( container . textContent ) . toBe ( 'R 0.0 0 .0k' ) ;
57+ expect ( container . textContent ) . toBe ( 'R 0.00 .0k' ) ;
5858 } ) ;
5959
6060 it ( 'rounds rating to 1 decimal place' , ( ) => {
6161 const { container } = render (
6262 < DriverRatingBadge license = "C 3.141592654" rating = { 5000.123 } />
6363 ) ;
64- expect ( container . textContent ) . toBe ( 'C 3.1 5 .0k' ) ;
64+ expect ( container . textContent ) . toBe ( 'C 3.15 .0k' ) ;
6565 } ) ;
6666
6767 it ( 'removes leading zeros from license number when before non-zero digit' , ( ) => {
6868 const { container } = render (
6969 < DriverRatingBadge license = "A 02.99" rating = { 5000 } />
7070 ) ;
71- expect ( container . textContent ) . toBe ( 'A 3.0 5 .0k' ) ;
71+ expect ( container . textContent ) . toBe ( 'A 3.05 .0k' ) ;
7272 } ) ;
7373
7474 it ( 'keeps single zero before decimal point' , ( ) => {
7575 const { container } = render (
7676 < DriverRatingBadge license = "A 0.99" rating = { 5000 } />
7777 ) ;
78- expect ( container . textContent ) . toBe ( 'A 1.0 5 .0k' ) ;
78+ expect ( container . textContent ) . toBe ( 'A 1.05 .0k' ) ;
7979 } ) ;
8080
8181 it ( 'handles multiple leading zeros' , ( ) => {
8282 const { container } = render (
8383 < DriverRatingBadge license = "B 0003.45" rating = { 5000 } />
8484 ) ;
85- expect ( container . textContent ) . toBe ( 'B 3.5 5 .0k' ) ;
85+ expect ( container . textContent ) . toBe ( 'B 3.55 .0k' ) ;
8686 } ) ;
8787
8888 it ( 'should handle invalid license strings' , ( ) => {
0 commit comments