@@ -769,27 +769,23 @@ describe('Cost Calculation', () => {
769769 } )
770770
771771 describe ( 'formatCost' , ( ) => {
772- it . concurrent ( 'should format costs >= $1 with two decimal places ' , ( ) => {
773- expect ( formatCost ( 1.234 ) ) . toBe ( '$1.23 ' )
774- expect ( formatCost ( 10.567 ) ) . toBe ( '$10.57 ' )
772+ it . concurrent ( 'should format dollar amounts as credits ' , ( ) => {
773+ expect ( formatCost ( 1.234 ) ) . toBe ( '247 credits ' )
774+ expect ( formatCost ( 10.567 ) ) . toBe ( '2,113 credits ' )
775775 } )
776776
777- it . concurrent ( 'should format costs between 1¢ and $1 with three decimal places ' , ( ) => {
778- expect ( formatCost ( 0.0234 ) ) . toBe ( '$0.023 ' )
779- expect ( formatCost ( 0.1567 ) ) . toBe ( '$0.157 ' )
777+ it . concurrent ( 'should show <1 credit for very small costs ' , ( ) => {
778+ expect ( formatCost ( 0.0024 ) ) . toBe ( '<1 credit ' )
779+ expect ( formatCost ( 0.001 ) ) . toBe ( '<1 credit ' )
780780 } )
781781
782- it . concurrent ( 'should format costs between 0.1¢ and 1¢ with four decimal places' , ( ) => {
783- expect ( formatCost ( 0.00234 ) ) . toBe ( '$0.0023' )
784- expect ( formatCost ( 0.00567 ) ) . toBe ( '$0.0057' )
785- } )
786-
787- it . concurrent ( 'should format very small costs with appropriate precision' , ( ) => {
788- expect ( formatCost ( 0.000234 ) ) . toContain ( '$0.000234' )
782+ it . concurrent ( 'should show credit count for small costs that round to at least 1' , ( ) => {
783+ expect ( formatCost ( 0.0234 ) ) . toBe ( '5 credits' )
784+ expect ( formatCost ( 0.1567 ) ) . toBe ( '31 credits' )
789785 } )
790786
791787 it . concurrent ( 'should handle zero cost' , ( ) => {
792- expect ( formatCost ( 0 ) ) . toBe ( '$0 ' )
788+ expect ( formatCost ( 0 ) ) . toBe ( '0 credits ' )
793789 } )
794790
795791 it . concurrent ( 'should handle undefined/null costs' , ( ) => {
0 commit comments