Skip to content

Commit 5f92672

Browse files
committed
🚀 1.2.0
1 parent ae45fe9 commit 5f92672

8 files changed

+308
-409
lines changed

__tests__/EnvSafe_Example_test.res

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
open Ava
22

3-
ava->test(`Works with Example code`, t => {
3+
test(`Works with Example code`, t => {
44
let envSafe = EnvSafe.make(
55
~env=Obj.magic({
66
"NODE_ENV": "development",

__tests__/EnvSafe_bool_test.res

+19-20
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
open Ava
22

3-
ava->test(`Successfully get Bool value when the env is "1"`, t => {
3+
test(`Successfully get Bool value when the env is "1"`, t => {
44
let envSafe = EnvSafe.make(
55
~env=Obj.magic({
66
"BOOL_ENV": "1",
@@ -14,7 +14,7 @@ ava->test(`Successfully get Bool value when the env is "1"`, t => {
1414
}, ())
1515
})
1616

17-
ava->test(`Successfully get Bool value when the env is "t"`, t => {
17+
test(`Successfully get Bool value when the env is "t"`, t => {
1818
let envSafe = EnvSafe.make(
1919
~env=Obj.magic({
2020
"BOOL_ENV": "t",
@@ -28,7 +28,7 @@ ava->test(`Successfully get Bool value when the env is "t"`, t => {
2828
}, ())
2929
})
3030

31-
ava->test(`Successfully get Bool value when the env is "true"`, t => {
31+
test(`Successfully get Bool value when the env is "true"`, t => {
3232
let envSafe = EnvSafe.make(
3333
~env=Obj.magic({
3434
"BOOL_ENV": "true",
@@ -42,7 +42,7 @@ ava->test(`Successfully get Bool value when the env is "true"`, t => {
4242
}, ())
4343
})
4444

45-
ava->test(`Successfully get Bool value when the env is "false"`, t => {
45+
test(`Successfully get Bool value when the env is "false"`, t => {
4646
let envSafe = EnvSafe.make(
4747
~env=Obj.magic({
4848
"BOOL_ENV": "false",
@@ -56,7 +56,7 @@ ava->test(`Successfully get Bool value when the env is "false"`, t => {
5656
}, ())
5757
})
5858

59-
ava->test(`Successfully get Bool value when the env is "f"`, t => {
59+
test(`Successfully get Bool value when the env is "f"`, t => {
6060
let envSafe = EnvSafe.make(
6161
~env=Obj.magic({
6262
"BOOL_ENV": "f",
@@ -70,7 +70,7 @@ ava->test(`Successfully get Bool value when the env is "f"`, t => {
7070
}, ())
7171
})
7272

73-
ava->test(`Successfully get Bool value when the env is "0"`, t => {
73+
test(`Successfully get Bool value when the env is "0"`, t => {
7474
let envSafe = EnvSafe.make(
7575
~env=Obj.magic({
7676
"BOOL_ENV": "0",
@@ -84,7 +84,7 @@ ava->test(`Successfully get Bool value when the env is "0"`, t => {
8484
}, ())
8585
})
8686

87-
ava->test(`Successfully get Literal Bool (true) value when the env is "1"`, t => {
87+
test(`Successfully get Literal Bool (true) value when the env is "1"`, t => {
8888
let envSafe = EnvSafe.make(
8989
~env=Obj.magic({
9090
"BOOL_ENV": "1",
@@ -98,7 +98,7 @@ ava->test(`Successfully get Literal Bool (true) value when the env is "1"`, t =>
9898
}, ())
9999
})
100100

101-
ava->test(`Successfully get Literal Bool (true) value when the env is "t"`, t => {
101+
test(`Successfully get Literal Bool (true) value when the env is "t"`, t => {
102102
let envSafe = EnvSafe.make(
103103
~env=Obj.magic({
104104
"BOOL_ENV": "t",
@@ -112,7 +112,7 @@ ava->test(`Successfully get Literal Bool (true) value when the env is "t"`, t =>
112112
}, ())
113113
})
114114

115-
ava->test(`Successfully get Literal Bool (true) value when the env is "true"`, t => {
115+
test(`Successfully get Literal Bool (true) value when the env is "true"`, t => {
116116
let envSafe = EnvSafe.make(
117117
~env=Obj.magic({
118118
"BOOL_ENV": "true",
@@ -126,7 +126,7 @@ ava->test(`Successfully get Literal Bool (true) value when the env is "true"`, t
126126
}, ())
127127
})
128128

129-
ava->test(`Successfully get Lietarl Bool (false) value when the env is "false"`, t => {
129+
test(`Successfully get Lietarl Bool (false) value when the env is "false"`, t => {
130130
let envSafe = EnvSafe.make(
131131
~env=Obj.magic({
132132
"BOOL_ENV": "false",
@@ -144,7 +144,7 @@ ava->test(`Successfully get Lietarl Bool (false) value when the env is "false"`,
144144
}, ())
145145
})
146146

147-
ava->test(`Successfully get Lietarl Bool (false) value when the env is "f"`, t => {
147+
test(`Successfully get Lietarl Bool (false) value when the env is "f"`, t => {
148148
let envSafe = EnvSafe.make(
149149
~env=Obj.magic({
150150
"BOOL_ENV": "f",
@@ -162,7 +162,7 @@ ava->test(`Successfully get Lietarl Bool (false) value when the env is "f"`, t =
162162
}, ())
163163
})
164164

165-
ava->test(`Successfully get Lietarl Bool (false) value when the env is "0"`, t => {
165+
test(`Successfully get Lietarl Bool (false) value when the env is "0"`, t => {
166166
let envSafe = EnvSafe.make(
167167
~env=Obj.magic({
168168
"BOOL_ENV": "0",
@@ -180,7 +180,7 @@ ava->test(`Successfully get Lietarl Bool (false) value when the env is "0"`, t =
180180
}, ())
181181
})
182182

183-
ava->test(`Fails to get Bool value when the env is "2"`, t => {
183+
test(`Fails to get Bool value when the env is "2"`, t => {
184184
let envSafe = EnvSafe.make(
185185
~env=Obj.magic({
186186
"BOOL_ENV": "2",
@@ -193,19 +193,18 @@ ava->test(`Fails to get Bool value when the env is "2"`, t => {
193193
() => {
194194
envSafe->EnvSafe.close()
195195
},
196-
~expectations=ThrowsException.make(
197-
~name="TypeError",
198-
~message=String(`========================================
196+
~expectations={
197+
name: "TypeError",
198+
message: `========================================
199199
❌ Invalid environment variables:
200200
BOOL_ENV ("2"): Failed parsing at root. Reason: Expected Bool, received String
201-
========================================`),
202-
(),
203-
),
201+
========================================`,
202+
},
204203
(),
205204
)
206205
})
207206

208-
ava->test(`Successfully get optional Bool value when the env is "1"`, t => {
207+
test(`Successfully get optional Bool value when the env is "1"`, t => {
209208
let envSafe = EnvSafe.make(
210209
~env=Obj.magic({
211210
"BOOL_ENV": "1",

__tests__/EnvSafe_number_test.res

+16-18
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
open Ava
22

3-
ava->test(`Successfully get Int value when the env is "1"`, t => {
3+
test(`Successfully get Int value when the env is "1"`, t => {
44
let envSafe = EnvSafe.make(
55
~env=Obj.magic({
66
"INT_ENV": "1",
@@ -14,7 +14,7 @@ ava->test(`Successfully get Int value when the env is "1"`, t => {
1414
}, ())
1515
})
1616

17-
ava->test(`Successfully get Literal Int value when the env is "1"`, t => {
17+
test(`Successfully get Literal Int value when the env is "1"`, t => {
1818
let envSafe = EnvSafe.make(
1919
~env=Obj.magic({
2020
"INT_ENV": "1",
@@ -28,7 +28,7 @@ ava->test(`Successfully get Literal Int value when the env is "1"`, t => {
2828
}, ())
2929
})
3030

31-
ava->test(`Successfully get Float value when the env is "1"`, t => {
31+
test(`Successfully get Float value when the env is "1"`, t => {
3232
let envSafe = EnvSafe.make(
3333
~env=Obj.magic({
3434
"INT_ENV": "1",
@@ -42,7 +42,7 @@ ava->test(`Successfully get Float value when the env is "1"`, t => {
4242
}, ())
4343
})
4444

45-
ava->test(`Successfully get Literal Float value when the env is "1"`, t => {
45+
test(`Successfully get Literal Float value when the env is "1"`, t => {
4646
let envSafe = EnvSafe.make(
4747
~env=Obj.magic({
4848
"INT_ENV": "1",
@@ -56,7 +56,7 @@ ava->test(`Successfully get Literal Float value when the env is "1"`, t => {
5656
}, ())
5757
})
5858

59-
ava->test(`Fails to get invalid number`, t => {
59+
test(`Fails to get invalid number`, t => {
6060
let envSafe = EnvSafe.make(
6161
~env=Obj.magic({
6262
"INT_ENV": "1_000",
@@ -69,19 +69,18 @@ ava->test(`Fails to get invalid number`, t => {
6969
() => {
7070
envSafe->EnvSafe.close()
7171
},
72-
~expectations=ThrowsException.make(
73-
~name="TypeError",
74-
~message=String(`========================================
72+
~expectations={
73+
name: "TypeError",
74+
message: `========================================
7575
❌ Invalid environment variables:
7676
INT_ENV ("1_000"): Failed parsing at root. Reason: Expected Int, received NaN Literal (NaN)
77-
========================================`),
78-
(),
79-
),
77+
========================================`,
78+
},
8079
(),
8180
)
8281
})
8382

84-
ava->test(`Fails to get missing number`, t => {
83+
test(`Fails to get missing number`, t => {
8584
let envSafe = EnvSafe.make(
8685
~env=Obj.magic({
8786
"INT_ENV": "1_000",
@@ -98,14 +97,13 @@ ava->test(`Fails to get missing number`, t => {
9897
() => {
9998
envSafe->EnvSafe.close()
10099
},
101-
~expectations=ThrowsException.make(
102-
~name="TypeError",
103-
~message=String(`========================================
100+
~expectations={
101+
name: "TypeError",
102+
message: `========================================
104103
💨 Missing environment variables:
105104
MISSING_ENV: Missing value
106-
========================================`),
107-
(),
108-
),
105+
========================================`,
106+
},
109107
(),
110108
)
111109
})

0 commit comments

Comments
 (0)