File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
src/packages/core/utils/math Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change
1
+ import { expect } from '@open-wc/testing' ;
2
+ import { calculateExtrapolatedValue } from './math.js' ;
3
+
4
+ describe ( 'calculateExtrapolatedValue' , ( ) => {
5
+ it ( 'should return NaN if the increase factor is less than 0' , ( ) => {
6
+ expect ( calculateExtrapolatedValue ( 1 , - 1 ) ) . to . be . NaN ;
7
+ } ) ;
8
+
9
+ it ( 'should return NaN if the increase factor is equal to 1' , ( ) => {
10
+ expect ( calculateExtrapolatedValue ( 1 , 1 ) ) . to . be . NaN ;
11
+ } ) ;
12
+
13
+ it ( 'should return the extrapolated value' , ( ) => {
14
+ expect ( calculateExtrapolatedValue ( 1 , 0 ) ) . to . equal ( 1 ) ;
15
+ expect ( calculateExtrapolatedValue ( 1 , 0.3 ) ) . to . equal ( 1.4285714285714286 ) ;
16
+ expect ( calculateExtrapolatedValue ( 2 , 0.5 ) ) . to . equal ( 4 ) ;
17
+ expect ( calculateExtrapolatedValue ( 3 , 0.6 ) ) . to . equal ( 7.5 ) ;
18
+ expect ( calculateExtrapolatedValue ( 100 , 0.2 ) ) . to . equal ( 125 ) ;
19
+ expect ( calculateExtrapolatedValue ( 500 , 0.99 ) ) . to . equal ( 49999.999999999956 ) ;
20
+ } ) ;
21
+ } ) ;
You can’t perform that action at this time.
0 commit comments