@sprucelabs/schema 28.5.6 → 28.5.9
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/build/AbstractSchemaTest.d.ts +1 -1
- package/build/AbstractSchemaTest.js +2 -2
- package/build/esm/AbstractSchemaTest.d.ts +1 -1
- package/build/esm/AbstractSchemaTest.js +1 -1
- package/build/esm/tests/AbstractDateFieldTest.js +1 -1
- package/build/esm/tests/selectAssert.utility.js +1 -1
- package/build/esm/tests/validationErrorAssert.utility.js +1 -1
- package/build/tests/AbstractDateFieldTest.js +4 -4
- package/build/tests/selectAssert.utility.js +3 -3
- package/build/tests/validationErrorAssert.utility.js +3 -3
- package/package.json +4 -4
|
@@ -3,9 +3,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
6
|
+
const test_utils_1 = __importDefault(require("@sprucelabs/test-utils"));
|
|
7
7
|
const _1 = require(".");
|
|
8
|
-
class AbstractSchemaTest extends
|
|
8
|
+
class AbstractSchemaTest extends test_utils_1.default {
|
|
9
9
|
static async beforeEach() {
|
|
10
10
|
await super.beforeEach();
|
|
11
11
|
this.registry = _1.SchemaRegistry.getInstance();
|
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import AbstractSpruceTest from '@sprucelabs/test';
|
|
10
|
+
import AbstractSpruceTest from '@sprucelabs/test-utils';
|
|
11
11
|
import { SchemaRegistry } from './index.js';
|
|
12
12
|
export default class AbstractSchemaTest extends AbstractSpruceTest {
|
|
13
13
|
static beforeEach() {
|
|
@@ -7,7 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import { assert } from '@sprucelabs/test';
|
|
10
|
+
import { assert } from '@sprucelabs/test-utils';
|
|
11
11
|
import { validationErrorAssert } from '../index.js';
|
|
12
12
|
import AbstractSchemaTest from '../AbstractSchemaTest.js';
|
|
13
13
|
import SchemaEntityFactory from '../factories/SchemaEntityFactory.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { assert } from '@sprucelabs/test';
|
|
1
|
+
import { assert } from '@sprucelabs/test-utils';
|
|
2
2
|
const selectAssert = {
|
|
3
3
|
assertSelectChoicesMatch(choices, expected) {
|
|
4
4
|
assert.isEqual(choices.length, expected.length, `Expected ${expected.length} choices, but found ${choices.length}!`);
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
6
|
+
const test_utils_1 = require("@sprucelabs/test-utils");
|
|
7
7
|
const __1 = require("..");
|
|
8
8
|
const AbstractSchemaTest_1 = __importDefault(require("../AbstractSchemaTest"));
|
|
9
9
|
const SchemaEntityFactory_1 = __importDefault(require("../factories/SchemaEntityFactory"));
|
|
@@ -17,15 +17,15 @@ class AbstractDateFieldTest extends AbstractSchemaTest_1.default {
|
|
|
17
17
|
this.entity.set('optionalBirthday', new Date());
|
|
18
18
|
}
|
|
19
19
|
static failsValidationIfPassedString(fieldName, value) {
|
|
20
|
-
const err =
|
|
20
|
+
const err = test_utils_1.assert.doesThrow(() =>
|
|
21
21
|
//@ts-ignore
|
|
22
22
|
this.entity.set(fieldName, value));
|
|
23
23
|
__1.validationErrorAssert.assertError(err, { invalid: [fieldName] });
|
|
24
24
|
}
|
|
25
25
|
static honorsRequired() {
|
|
26
|
-
|
|
26
|
+
test_utils_1.assert.isFalse(this.entity.isValid());
|
|
27
27
|
this.entity.set('requiredBirthday', new Date().getTime());
|
|
28
|
-
|
|
28
|
+
test_utils_1.assert.isTrue(this.entity.isValid());
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
exports.default = AbstractDateFieldTest;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const test_utils_1 = require("@sprucelabs/test-utils");
|
|
4
4
|
const selectAssert = {
|
|
5
5
|
assertSelectChoicesMatch(choices, expected) {
|
|
6
|
-
|
|
6
|
+
test_utils_1.assert.isEqual(choices.length, expected.length, `Expected ${expected.length} choices, but found ${choices.length}!`);
|
|
7
7
|
const actualValues = choices.map((c) => c.value);
|
|
8
8
|
actualValues.sort();
|
|
9
9
|
expected.sort();
|
|
10
|
-
|
|
10
|
+
test_utils_1.assert.isEqualDeep(actualValues, expected, `The options you sent don't match!`);
|
|
11
11
|
},
|
|
12
12
|
};
|
|
13
13
|
exports.default = selectAssert;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const
|
|
6
|
+
const test_utils_1 = require("@sprucelabs/test-utils");
|
|
7
7
|
const SpruceError_1 = __importDefault(require("../errors/SpruceError"));
|
|
8
8
|
function buildFailMessage(code, name, options) {
|
|
9
9
|
const templates = {
|
|
@@ -11,7 +11,7 @@ function buildFailMessage(code, name, options) {
|
|
|
11
11
|
MISSING_PARAMETER: `I found '${name}' even though it should be reported as missing.`,
|
|
12
12
|
UNEXPECTED_PARAMETER: `I was expecting to unexpectedly find '${name}', but I didn't.`,
|
|
13
13
|
};
|
|
14
|
-
return `${templates[code]}\n\nHere is the error I got: ${
|
|
14
|
+
return `${templates[code]}\n\nHere is the error I got: ${test_utils_1.assertUtil.stringify(options)}`;
|
|
15
15
|
}
|
|
16
16
|
function flattenFields(fieldErrors, flattened, namePrefix = '') {
|
|
17
17
|
fieldErrors.forEach((err) => {
|
|
@@ -65,7 +65,7 @@ const validationErrorAssert = {
|
|
|
65
65
|
for (const lookup of (_b = options === null || options === void 0 ? void 0 : options[key]) !== null && _b !== void 0 ? _b : []) {
|
|
66
66
|
const match = flattened[lookup] === code;
|
|
67
67
|
if (!match) {
|
|
68
|
-
|
|
68
|
+
test_utils_1.assert.fail(buildFailMessage(code, lookup, flattened));
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
}
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"!build/__tests__",
|
|
9
9
|
"esm"
|
|
10
10
|
],
|
|
11
|
-
"version": "28.5.
|
|
11
|
+
"version": "28.5.9",
|
|
12
12
|
"main": "./build/index.js",
|
|
13
13
|
"types": "./build/index.d.ts",
|
|
14
14
|
"module": "./build/esm/index.js",
|
|
@@ -66,8 +66,9 @@
|
|
|
66
66
|
"build.copy-files": "mkdir -p build && rsync -avzq --exclude='*.ts' ./src/ ./build/"
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
|
-
"@sprucelabs/error": "^5.0.
|
|
70
|
-
"@sprucelabs/test": "^7.7.
|
|
69
|
+
"@sprucelabs/error": "^5.0.512",
|
|
70
|
+
"@sprucelabs/test": "^7.7.360",
|
|
71
|
+
"@sprucelabs/test-utils": "^3.2.1",
|
|
71
72
|
"email-validator": "^2.0.4",
|
|
72
73
|
"just-safe-get": "^4.1.1",
|
|
73
74
|
"just-safe-set": "^4.1.1"
|
|
@@ -78,7 +79,6 @@
|
|
|
78
79
|
"@sprucelabs/jest-sheets-reporter": "^1.3.29",
|
|
79
80
|
"@sprucelabs/resolve-path-aliases": "^1.1.14",
|
|
80
81
|
"@sprucelabs/semantic-release": "^4.0.8",
|
|
81
|
-
"@sprucelabs/test-utils": "^3.1.82",
|
|
82
82
|
"chokidar-cli": "^3.0.0",
|
|
83
83
|
"concurrently": "^7.4.0",
|
|
84
84
|
"eslint": "^8.23.1",
|