File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
packages/bezier-react/src/utils Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,17 @@ import {
6
6
} from './assert'
7
7
8
8
describe ( 'isDev' , ( ) => {
9
+ const OLD_ENV = process . env
10
+
11
+ beforeEach ( ( ) => {
12
+ jest . resetModules ( )
13
+ process . env = { ...OLD_ENV }
14
+ } )
15
+
16
+ afterAll ( ( ) => {
17
+ process . env = OLD_ENV
18
+ } )
19
+
9
20
it ( 'should return true when NODE_ENV is not production' , ( ) => {
10
21
process . env . NODE_ENV = 'development'
11
22
@@ -24,6 +35,17 @@ describe('isDev', () => {
24
35
} )
25
36
26
37
describe ( 'assert' , ( ) => {
38
+ const OLD_ENV = process . env
39
+
40
+ beforeEach ( ( ) => {
41
+ jest . resetModules ( )
42
+ process . env = { ...OLD_ENV }
43
+ } )
44
+
45
+ afterAll ( ( ) => {
46
+ process . env = OLD_ENV
47
+ } )
48
+
27
49
it ( 'should throw an assertion exception error in development environment when the predicate is false' , ( ) => {
28
50
process . env . NODE_ENV = 'development'
29
51
@@ -44,6 +66,17 @@ describe('assert', () => {
44
66
} )
45
67
46
68
describe ( 'warn' , ( ) => {
69
+ const OLD_ENV = process . env
70
+
71
+ beforeEach ( ( ) => {
72
+ jest . resetModules ( )
73
+ process . env = { ...OLD_ENV }
74
+ } )
75
+
76
+ afterAll ( ( ) => {
77
+ process . env = OLD_ENV
78
+ } )
79
+
47
80
it ( 'should output the message using console.warn if the message argument is passed' , ( ) => {
48
81
process . env . NODE_ENV = 'development'
49
82
You can’t perform that action at this time.
0 commit comments