@locustjs/test 1.2.0 → 1.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.cjs.js +34 -0
- package/index.esm.js +20 -0
- package/package.json +7 -7
- package/tests/index.js +4 -0
package/index.cjs.js
CHANGED
|
@@ -528,6 +528,40 @@ class Expect {
|
|
|
528
528
|
}
|
|
529
529
|
return this;
|
|
530
530
|
}
|
|
531
|
+
toBeValid(fnValidation) {
|
|
532
|
+
if (!isFunction(fnValidation)) {
|
|
533
|
+
throw new Exception({
|
|
534
|
+
message: `fnValidation is not function`,
|
|
535
|
+
code: 1064,
|
|
536
|
+
status: 'to-be-valid'
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
if (!fnValidation(this.value)) {
|
|
540
|
+
throw new Exception({
|
|
541
|
+
message: `${this.value} is not valid`,
|
|
542
|
+
code: 1065,
|
|
543
|
+
status: 'to-be-valid'
|
|
544
|
+
});
|
|
545
|
+
}
|
|
546
|
+
return this;
|
|
547
|
+
}
|
|
548
|
+
notToBeValid(fnValidation) {
|
|
549
|
+
if (!isFunction(fnValidation)) {
|
|
550
|
+
throw new Exception({
|
|
551
|
+
message: `fnValidation is not function`,
|
|
552
|
+
code: 1066,
|
|
553
|
+
status: 'not-to-be-valid'
|
|
554
|
+
});
|
|
555
|
+
}
|
|
556
|
+
if (fnValidation(this.value)) {
|
|
557
|
+
throw new Exception({
|
|
558
|
+
message: `${this.value} is valid`,
|
|
559
|
+
code: 1067,
|
|
560
|
+
status: 'not-to-be-valid'
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
return this;
|
|
564
|
+
}
|
|
531
565
|
toThrow(ex, shape = false, strict = false) {
|
|
532
566
|
if (!isFunction(this.value)) {
|
|
533
567
|
throw new Exception({
|
package/index.esm.js
CHANGED
|
@@ -395,6 +395,26 @@ class Expect {
|
|
|
395
395
|
|
|
396
396
|
return this;
|
|
397
397
|
}
|
|
398
|
+
toBeValid(fnValidation) {
|
|
399
|
+
if (!isFunction(fnValidation)) {
|
|
400
|
+
throw new Exception({ message: `fnValidation is not function`, code: 1064, status: 'to-be-valid' })
|
|
401
|
+
}
|
|
402
|
+
if (!fnValidation(this.value)) {
|
|
403
|
+
throw new Exception({ message: `${this.value} is not valid`, code: 1065, status: 'to-be-valid' })
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
return this;
|
|
407
|
+
}
|
|
408
|
+
notToBeValid(fnValidation) {
|
|
409
|
+
if (!isFunction(fnValidation)) {
|
|
410
|
+
throw new Exception({ message: `fnValidation is not function`, code: 1066, status: 'not-to-be-valid' })
|
|
411
|
+
}
|
|
412
|
+
if (fnValidation(this.value)) {
|
|
413
|
+
throw new Exception({ message: `${this.value} is valid`, code: 1067, status: 'not-to-be-valid' })
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
return this;
|
|
417
|
+
}
|
|
398
418
|
toThrow(ex, shape = false, strict = false) {
|
|
399
419
|
if (!isFunction(this.value)) {
|
|
400
420
|
throw new Exception({ message: `given argument is not a function.`, code: 1012, status: 'not-func' })
|
package/package.json
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@locustjs/test",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "This library provides a simple test runner.",
|
|
5
5
|
"main": "index.cjs.js",
|
|
6
6
|
"module": "index.esm.js",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"build": "babel index.esm.js -o index.cjs.js",
|
|
9
|
+
"test": "node -r esm ./tests/index.js"
|
|
10
|
+
},
|
|
7
11
|
"repository": {
|
|
8
12
|
"type": "git",
|
|
9
13
|
"url": "git+https://github.com/ironcodev/locustjs-test.git"
|
|
@@ -20,15 +24,11 @@
|
|
|
20
24
|
"homepage": "https://github.com/ironcodev/locustjs-test#readme",
|
|
21
25
|
"dependencies": {
|
|
22
26
|
"@locustjs/base": "^2.1.0",
|
|
23
|
-
"@locustjs/exception": "^2.0.
|
|
27
|
+
"@locustjs/exception": "^2.0.2"
|
|
24
28
|
},
|
|
25
29
|
"devDependencies": {
|
|
26
30
|
"@babel/cli": "^7.22.6",
|
|
27
31
|
"@babel/core": "^7.22.8",
|
|
28
32
|
"esm": "^3.2.25"
|
|
29
|
-
},
|
|
30
|
-
"scripts": {
|
|
31
|
-
"build": "babel index.esm.js -o index.cjs.js",
|
|
32
|
-
"test": "node -r esm ./tests/index.js"
|
|
33
33
|
}
|
|
34
|
-
}
|
|
34
|
+
}
|