You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -22,39 +22,30 @@ Merlin is a [Jest](https://jestjs.io/en/)-inspired testing framework for deno.
22
22
23
23
### All Matchers
24
24
25
-
-`testEqual(label: string, config)`_Compare two values and throws an error if the expect and toBe are not equal._
26
-
27
-
-`testNotEqual(label: string, config)`_Compare two values and throws an error if the expect and notBe are equal._
28
-
29
-
-`evalEquals(testEqual[])`_evaluate multiple equality tests in an array. If the data is not the same it throws an error._
30
-
31
-
-`fetchEqual(label: string, config)`_evaluate if two values are equal. If the request data is not the same as expected, it throws an error._
32
-
33
-
-`arrayContains(label: string, config)`_evaluates that the array contains an especific data. if the array does not contain the data it throws an error._
34
-
35
-
-`stringContains(label: string, config)`_evaluates if a string contains an especific word. if the string does not contain the word it throws an error._
36
-
37
-
-`beNull(label: string, config)`_evaluates if a data is null._
38
-
39
-
-`beFalsy(label: string, config)`_evaluates if a data is a falsy value._
40
-
41
-
-`beTruthy(label: string, config)`_evaluates if a data is a truthy value._
42
-
43
-
-`isBigInt(label: string, config)`_evaluates if a data is a bigInt value type._
44
-
45
-
-`isZero(label: string, config)`_evaluates if a data is a Zero_
46
-
47
-
-`isNaN(label: string, config)`_evaluates if a data is NaN value._
48
-
49
-
-`sameLength(label: string, config)`_evaluates if data has a especific length_
50
-
51
-
-`testRegExp(label: string, config)`_evaluates if a regular expression match_
52
-
53
-
-`isFunction(label: string, config)`_evaluates if a data is a function_
54
-
55
-
-`isSymbol(label: string, config)`_evaluates if a data is a symbol_
56
-
57
-
-`isUndefined(label: string, config)`_evaluates if a data is undefined_
25
+
-`testEqual(label: string, config)` Compare two values and throws an error if the expect and toBe are not equal
26
+
-`testNotEqual(label: string, config)` Compare two values and throws an error if the expect and notBe are equal
27
+
-`evalEquals(testEqual[])` evaluate multiple equality tests in an array. If the data is not the same it throws an error
28
+
-`fetchEqual(label: string, config)` evaluate if two values are equal. If the request data is not the same as expected, it throws an error
29
+
-`arrayContains(label: string, config)` evaluates that the array contains an especific data. if the array does not contain the data it throws an error
30
+
-`stringContains(label: string, config)` evaluates if a string contains an especific word. if the string does not contain the word it throws an error
31
+
-`beNull(label: string, config)` evaluates if a data is null
32
+
-`beFalsy(label: string, config)` evaluates if a data is a falsy value
33
+
-`beTruthy(label: string, config)` evaluates if a data is a truthy value
34
+
-`isBigInt(label: string, config)` evaluates if a data is a bigInt value type
35
+
-`isZero(label: string, config)` evaluates if a data is a Zero
36
+
-`isNaN(label: string, config)` evaluates if a data is NaN value
37
+
-`sameLength(label: string, config)` evaluates if data has a especific length
38
+
-`testRegExp(label: string, config)` evaluates if a regular expression match
39
+
-`isFunction(label: string, config)` evaluates if a data is a function
40
+
-`isSymbol(label: string, config)` evaluates if a data is a symbol
41
+
-`isUndefined(label: string, config)` evaluates if a data is undefined
42
+
-`testSame(label: string, config)` evaluates if two values are strictly the same
43
+
-`testGreaterOrEqual(label: string, config)` evaluates whether the expected data is greater than or equal to another
44
+
-`testGreater(label: string, config)` evaluates whether the expected data is greater than another
45
+
-`testLess(label: string, config)` evaluates if the expected data is less than another
46
+
-`testLessOrEqual(label: string, config)` evaluates if the expected data is less than or equal to another
47
+
-`testInstanceOf(label: string, config)` evaluates that one object is an instance of another
48
+
-`testFloat(label: string, config)` evaluates if two decimal numbers are equal
58
49
59
50
### Basic Use
60
51
@@ -108,7 +99,7 @@ all assertions have parameters that they can receive, these parameters can chang
108
99
-`Resources (optional)` receives a boolean, terminates all asynchronous processes that interact with the system. by default is `true`.
109
100
-`only (optional)` receives a boolean, only tests that have `only in true` will be executed, the rest will not run.
110
101
111
-
## about resources and ops sanitizers
102
+
###about resources and ops sanitizers
112
103
113
104
Certain actions in Deno create resources in the resource table . These resources should be closed after you are done using them.
114
105
@@ -126,20 +117,22 @@ async function writeSomething(): Promise<string> {
126
117
}
127
118
128
119
test.testEqual("Leak resources test", {
129
-
expect:() =>"test",
130
-
toBe:() =>writeSomething(),
120
+
expect:async() =>awaitwriteSomething(),
121
+
toBe:() =>"test",
131
122
only: true,
132
123
Ops: false,
133
-
Resources: false
124
+
Resources: false,
134
125
});
135
126
```
127
+
136
128
```sh
137
129
deno test
138
130
139
131
test Leak resources test ... ok (5ms)
140
132
141
133
test result: ok. 3 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
142
134
```
135
+
143
136
### Multiple tests
144
137
145
138
`example.test.ts`
@@ -263,16 +256,120 @@ test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out
263
256
```
264
257
265
258
### testRegExp
259
+
266
260
```typescript
267
-
test.testRegExp("regEx match",{
268
-
expect:()=>"https://google.com",
269
-
toBe:()=>newRegExp("^https?:\/\/[a-z.]+\.com$"),
270
-
})
261
+
test.testRegExp("regEx match",{
262
+
expect: () =>"https://google.com",
263
+
toBe: () =>newRegExp("^https?://[a-z.]+.com$"),
264
+
});
271
265
```
266
+
272
267
```sh
273
268
deno test
274
269
275
270
test regEx match ... ok (6ms)
276
271
277
272
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out (342ms)
278
-
```
273
+
```
274
+
275
+
### Usin async code.
276
+
277
+
you can use asynchronous code by adding `async` in `expect`, `toBe` and `value` functions.
0 commit comments