File tree Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Expand file tree Collapse file tree 1 file changed +40
-0
lines changed Original file line number Diff line number Diff line change
1
+ import * as constants from "../src/constants/mod.ts" ;
2
+ import { describe , it } from "jsr:@std/testing@1/bdd" ;
3
+ import { expect } from "jsr:@std/expect@1" ;
4
+
5
+ const cases = {
6
+ Math : [
7
+ "E" ,
8
+ "LN2" ,
9
+ "LN10" ,
10
+ "LOG2E" ,
11
+ "LOG10E" ,
12
+ "PI" ,
13
+ "SQRT1_2" ,
14
+ "SQRT2" ,
15
+ ] ,
16
+ Number : [
17
+ "EPSILON" ,
18
+ "MAX_SAFE_INTEGER" ,
19
+ "MIN_SAFE_INTEGER" ,
20
+ "NEGATIVE_INFINITY" ,
21
+ "POSITIVE_INFINITY" ,
22
+ "NaN" ,
23
+ "MAX_VALUE" ,
24
+ "MIN_VALUE" ,
25
+ ] ,
26
+ } as const ;
27
+
28
+ for ( const kind of Object . keys ( cases ) as ( keyof typeof cases ) [ ] ) {
29
+ const keys = cases [ kind ] ;
30
+ for ( const key of keys ) {
31
+ describe ( key , ( ) => {
32
+ const value = constants [ key ] ;
33
+ const parent = globalThis [ kind ] ;
34
+ const expected = parent [ key as keyof typeof parent ] ;
35
+ it ( `is equal to ${ kind } .${ key } ` , ( ) => {
36
+ expect ( value ) . toBe ( expected ) ;
37
+ } ) ;
38
+ } ) ;
39
+ }
40
+ }
You can’t perform that action at this time.
0 commit comments