@finsys/core 1.0.1 → 1.2.0
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/dist/data/form-field-base-specs.json +7353 -0
- package/dist/data/form-field-types.json +83 -0
- package/dist/data/form-field-validators.json +341 -0
- package/dist/index.cjs +9101 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +375 -0
- package/dist/index.d.ts +374 -11
- package/dist/index.js +9038 -24
- package/dist/index.js.map +1 -0
- package/package.json +14 -10
- package/dist/rhf-generator.d.ts +0 -30
- package/dist/rhf-generator.js +0 -267
- package/dist/rhf-generator.test.d.ts +0 -1
- package/dist/rhf-generator.test.js +0 -583
- package/dist/survey-generator.d.ts +0 -153
- package/dist/survey-generator.js +0 -194
- package/dist/survey-generator.test.d.ts +0 -1
- package/dist/survey-generator.test.js +0 -332
- package/dist/utils.d.ts +0 -13
- package/dist/utils.js +0 -56
- package/dist/utils.test.d.ts +0 -1
- package/dist/utils.test.js +0 -131
- package/dist/validator.d.ts +0 -14
- package/dist/validator.js +0 -49
- package/dist/validator.test.d.ts +0 -1
- package/dist/validator.test.js +0 -142
package/dist/utils.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2025 Sisters Inspire Sdn Bhd
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
/**
|
|
17
|
-
* Utility functions for @finsys/core
|
|
18
|
-
*/
|
|
19
|
-
export function getPastMonthLabel(monthsAgo) {
|
|
20
|
-
const date = new Date();
|
|
21
|
-
date.setMonth(date.getMonth() - monthsAgo);
|
|
22
|
-
return date.toLocaleString('default', { month: 'long' });
|
|
23
|
-
}
|
|
24
|
-
export function getPastYearLabel(yearsAgo) {
|
|
25
|
-
const date = new Date();
|
|
26
|
-
return (date.getFullYear() - yearsAgo).toString();
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Evaluate a SurveyJS-style expression against a data object.
|
|
30
|
-
* e.g. "{totalFinancing} > 50000"
|
|
31
|
-
*
|
|
32
|
-
* NOTE: This is a simplified evaluator that replaces {key} with data[key] access.
|
|
33
|
-
* It does not support complex SurveyJS functions like age() or complicated nested paths unless handled by JS.
|
|
34
|
-
*/
|
|
35
|
-
export function evaluateExpression(expression, data) {
|
|
36
|
-
if (!expression)
|
|
37
|
-
return true;
|
|
38
|
-
try {
|
|
39
|
-
// 1. Replace {variable} with this['variable'] safely
|
|
40
|
-
let jsExpression = expression.replace(/\{([^}]+)\}/g, (_, key) => {
|
|
41
|
-
// Clean key if needed (trim)
|
|
42
|
-
return `this['${key.trim()}']`;
|
|
43
|
-
});
|
|
44
|
-
// 2. Map SurveyJS operators to JS operators
|
|
45
|
-
// Replace single '=' with '==' if it's not already '==' or '!=' or '>=' or '<='
|
|
46
|
-
// Simplistic approach: look for '=' that are not preceded or followed by other operator chars
|
|
47
|
-
jsExpression = jsExpression.replace(/(?<![<>!=])=(?![=])/g, '==');
|
|
48
|
-
// 3. Execute with Function, binding 'data' as 'this'
|
|
49
|
-
const func = new Function(`return ${jsExpression};`);
|
|
50
|
-
return !!func.call(data || {});
|
|
51
|
-
}
|
|
52
|
-
catch (e) {
|
|
53
|
-
// console.warn(`Failed to evaluate expression: "${expression}"`, e);
|
|
54
|
-
return false;
|
|
55
|
-
}
|
|
56
|
-
}
|
package/dist/utils.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/utils.test.js
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2025 Sisters Inspire Sdn Bhd
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { describe, it, expect } from 'vitest';
|
|
17
|
-
import { getPastMonthLabel, getPastYearLabel, evaluateExpression } from './utils.js';
|
|
18
|
-
describe('getPastMonthLabel', () => {
|
|
19
|
-
it('should return a month name string', () => {
|
|
20
|
-
const label = getPastMonthLabel(1);
|
|
21
|
-
expect(typeof label).toBe('string');
|
|
22
|
-
expect(label.length).toBeGreaterThan(0);
|
|
23
|
-
});
|
|
24
|
-
it('should return a different month for different offsets', () => {
|
|
25
|
-
const month1 = getPastMonthLabel(1);
|
|
26
|
-
const month2 = getPastMonthLabel(2);
|
|
27
|
-
// These could theoretically collide if run at exact month boundary, but
|
|
28
|
-
// for offsets 1 and 2 they should always differ
|
|
29
|
-
expect(month1).not.toBe(month2);
|
|
30
|
-
});
|
|
31
|
-
it('should handle offset of 0 (current month)', () => {
|
|
32
|
-
const label = getPastMonthLabel(0);
|
|
33
|
-
const expected = new Date().toLocaleString('default', { month: 'long' });
|
|
34
|
-
expect(label).toBe(expected);
|
|
35
|
-
});
|
|
36
|
-
it('should wrap around years correctly (e.g., 12 months ago)', () => {
|
|
37
|
-
const label = getPastMonthLabel(12);
|
|
38
|
-
// 12 months ago should be the same month name as now
|
|
39
|
-
const expected = new Date().toLocaleString('default', { month: 'long' });
|
|
40
|
-
expect(label).toBe(expected);
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
describe('getPastYearLabel', () => {
|
|
44
|
-
it('should return the current year for offset 0', () => {
|
|
45
|
-
const label = getPastYearLabel(0);
|
|
46
|
-
expect(label).toBe(new Date().getFullYear().toString());
|
|
47
|
-
});
|
|
48
|
-
it('should return last year for offset 1', () => {
|
|
49
|
-
const label = getPastYearLabel(1);
|
|
50
|
-
expect(label).toBe((new Date().getFullYear() - 1).toString());
|
|
51
|
-
});
|
|
52
|
-
it('should return a year string for any offset', () => {
|
|
53
|
-
const label = getPastYearLabel(5);
|
|
54
|
-
expect(label).toBe((new Date().getFullYear() - 5).toString());
|
|
55
|
-
});
|
|
56
|
-
});
|
|
57
|
-
describe('evaluateExpression', () => {
|
|
58
|
-
it('should return true for empty/falsy expression', () => {
|
|
59
|
-
expect(evaluateExpression('', {})).toBe(true);
|
|
60
|
-
expect(evaluateExpression(null, {})).toBe(true);
|
|
61
|
-
expect(evaluateExpression(undefined, {})).toBe(true);
|
|
62
|
-
});
|
|
63
|
-
describe('variable substitution', () => {
|
|
64
|
-
it('should resolve {variable} references from data', () => {
|
|
65
|
-
expect(evaluateExpression('{age} > 18', { age: 25 })).toBe(true);
|
|
66
|
-
expect(evaluateExpression('{age} > 18', { age: 10 })).toBe(false);
|
|
67
|
-
});
|
|
68
|
-
it('should handle string comparisons', () => {
|
|
69
|
-
expect(evaluateExpression("{status} == 'active'", { status: 'active' })).toBe(true);
|
|
70
|
-
expect(evaluateExpression("{status} == 'active'", { status: 'inactive' })).toBe(false);
|
|
71
|
-
});
|
|
72
|
-
it('should handle undefined variables gracefully', () => {
|
|
73
|
-
// Undefined variables should not throw, expression evaluates to false
|
|
74
|
-
expect(evaluateExpression('{missing} > 0', {})).toBe(false);
|
|
75
|
-
});
|
|
76
|
-
});
|
|
77
|
-
describe('SurveyJS operator mapping', () => {
|
|
78
|
-
it('should convert single = to == for equality checks', () => {
|
|
79
|
-
expect(evaluateExpression('{value} = 5', { value: 5 })).toBe(true);
|
|
80
|
-
expect(evaluateExpression('{value} = 5', { value: 10 })).toBe(false);
|
|
81
|
-
});
|
|
82
|
-
it('should preserve != operator', () => {
|
|
83
|
-
expect(evaluateExpression('{value} != 5', { value: 10 })).toBe(true);
|
|
84
|
-
expect(evaluateExpression('{value} != 5', { value: 5 })).toBe(false);
|
|
85
|
-
});
|
|
86
|
-
it('should preserve >= operator', () => {
|
|
87
|
-
expect(evaluateExpression('{value} >= 10', { value: 10 })).toBe(true);
|
|
88
|
-
expect(evaluateExpression('{value} >= 10', { value: 5 })).toBe(false);
|
|
89
|
-
});
|
|
90
|
-
it('should preserve <= operator', () => {
|
|
91
|
-
expect(evaluateExpression('{value} <= 10', { value: 10 })).toBe(true);
|
|
92
|
-
expect(evaluateExpression('{value} <= 10', { value: 15 })).toBe(false);
|
|
93
|
-
});
|
|
94
|
-
it('should preserve == operator', () => {
|
|
95
|
-
expect(evaluateExpression('{value} == 10', { value: 10 })).toBe(true);
|
|
96
|
-
});
|
|
97
|
-
});
|
|
98
|
-
describe('boolean expressions', () => {
|
|
99
|
-
it('should evaluate boolean true/false values', () => {
|
|
100
|
-
expect(evaluateExpression('{flag} = true', { flag: true })).toBe(true);
|
|
101
|
-
expect(evaluateExpression('{flag} = true', { flag: false })).toBe(false);
|
|
102
|
-
});
|
|
103
|
-
it('should handle truthy/falsy coercion', () => {
|
|
104
|
-
expect(evaluateExpression('{value} > 0', { value: 1 })).toBe(true);
|
|
105
|
-
expect(evaluateExpression('{value} > 0', { value: 0 })).toBe(false);
|
|
106
|
-
});
|
|
107
|
-
});
|
|
108
|
-
describe('comparison operators', () => {
|
|
109
|
-
it('should handle > operator', () => {
|
|
110
|
-
expect(evaluateExpression('{totalFinancing} > 50000', { totalFinancing: 100000 })).toBe(true);
|
|
111
|
-
expect(evaluateExpression('{totalFinancing} > 50000', { totalFinancing: 30000 })).toBe(false);
|
|
112
|
-
});
|
|
113
|
-
it('should handle < operator', () => {
|
|
114
|
-
expect(evaluateExpression('{amount} < 100', { amount: 50 })).toBe(true);
|
|
115
|
-
expect(evaluateExpression('{amount} < 100', { amount: 200 })).toBe(false);
|
|
116
|
-
});
|
|
117
|
-
});
|
|
118
|
-
describe('edge cases', () => {
|
|
119
|
-
it('should handle null data', () => {
|
|
120
|
-
// Should not throw, returns false
|
|
121
|
-
expect(evaluateExpression('{x} > 0', null)).toBe(false);
|
|
122
|
-
});
|
|
123
|
-
it('should handle malformed expressions gracefully', () => {
|
|
124
|
-
expect(evaluateExpression('{{invalid', {})).toBe(false);
|
|
125
|
-
expect(evaluateExpression('not a valid expression !!!', {})).toBe(false);
|
|
126
|
-
});
|
|
127
|
-
it('should handle keys with spaces', () => {
|
|
128
|
-
expect(evaluateExpression('{my field} = 5', { 'my field': 5 })).toBe(true);
|
|
129
|
-
});
|
|
130
|
-
});
|
|
131
|
-
});
|
package/dist/validator.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ErrorObject } from "ajv";
|
|
2
|
-
export interface ValidationResult {
|
|
3
|
-
valid: boolean;
|
|
4
|
-
errors?: ErrorObject[];
|
|
5
|
-
message?: string;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Validates a unified form-config.json object against its schema
|
|
9
|
-
*/
|
|
10
|
-
export declare function validateFormConfig(data: unknown): ValidationResult;
|
|
11
|
-
/** @deprecated Use validateFormConfig instead */
|
|
12
|
-
export declare function validateFormSpec(data: unknown): ValidationResult;
|
|
13
|
-
/** @deprecated Use validateFormConfig instead */
|
|
14
|
-
export declare function validatePagesConfig(data: unknown): ValidationResult;
|
package/dist/validator.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2025 Sisters Inspire Sdn Bhd
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import AjvModule from "ajv";
|
|
17
|
-
import addFormats from "ajv-formats";
|
|
18
|
-
import unifiedFormSchema from "./schema/unified-form.schema.json" with { type: "json" };
|
|
19
|
-
// Interop for Ajv which can be exported differently in ESM/CJS
|
|
20
|
-
const Ajv = AjvModule.default || AjvModule;
|
|
21
|
-
const ajv = new Ajv({ allErrors: true, strict: false });
|
|
22
|
-
// Interop for ajv-formats
|
|
23
|
-
const addFormatsFn = addFormats.default || addFormats;
|
|
24
|
-
addFormatsFn(ajv);
|
|
25
|
-
// Register the unified schema
|
|
26
|
-
ajv.addSchema(unifiedFormSchema, "unified-form.schema.json");
|
|
27
|
-
/**
|
|
28
|
-
* Validates a unified form-config.json object against its schema
|
|
29
|
-
*/
|
|
30
|
-
export function validateFormConfig(data) {
|
|
31
|
-
const validate = ajv.getSchema("unified-form.schema.json");
|
|
32
|
-
if (!validate) {
|
|
33
|
-
return { valid: false, message: "Could not load unified form schema" };
|
|
34
|
-
}
|
|
35
|
-
const valid = validate(data);
|
|
36
|
-
return {
|
|
37
|
-
valid: !!valid,
|
|
38
|
-
errors: validate.errors || undefined,
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
// Legacy exports - these now just call validateFormConfig
|
|
42
|
-
/** @deprecated Use validateFormConfig instead */
|
|
43
|
-
export function validateFormSpec(data) {
|
|
44
|
-
return validateFormConfig(data);
|
|
45
|
-
}
|
|
46
|
-
/** @deprecated Use validateFormConfig instead */
|
|
47
|
-
export function validatePagesConfig(data) {
|
|
48
|
-
return validateFormConfig(data);
|
|
49
|
-
}
|
package/dist/validator.test.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/dist/validator.test.js
DELETED
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Copyright 2025 Sisters Inspire Sdn Bhd
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { describe, it, expect } from 'vitest';
|
|
17
|
-
import { validateFormConfig, validateFormSpec, validatePagesConfig } from './validator.js';
|
|
18
|
-
describe('validateFormConfig', () => {
|
|
19
|
-
const validConfig = {
|
|
20
|
-
categories: [{ id: 'general', name: 'General' }],
|
|
21
|
-
fields: {
|
|
22
|
-
fullName: {
|
|
23
|
-
type: 'text',
|
|
24
|
-
displayName: 'Full Name',
|
|
25
|
-
category: 'general'
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
pages: [
|
|
29
|
-
{
|
|
30
|
-
id: 'page1',
|
|
31
|
-
fields: ['fullName']
|
|
32
|
-
}
|
|
33
|
-
]
|
|
34
|
-
};
|
|
35
|
-
it('should validate a correct form config', () => {
|
|
36
|
-
const result = validateFormConfig(validConfig);
|
|
37
|
-
expect(result.valid).toBe(true);
|
|
38
|
-
expect(result.errors).toBeUndefined();
|
|
39
|
-
});
|
|
40
|
-
it('should reject config missing required "categories"', () => {
|
|
41
|
-
const result = validateFormConfig({
|
|
42
|
-
fields: { name: { type: 'text' } },
|
|
43
|
-
pages: [{ id: 'p1', fields: ['name'] }]
|
|
44
|
-
});
|
|
45
|
-
expect(result.valid).toBe(false);
|
|
46
|
-
expect(result.errors).toBeDefined();
|
|
47
|
-
expect(result.errors.some(e => e.instancePath === '' || e.params?.missingProperty === 'categories')).toBe(true);
|
|
48
|
-
});
|
|
49
|
-
it('should reject config missing required "fields"', () => {
|
|
50
|
-
const result = validateFormConfig({
|
|
51
|
-
categories: [{ id: 'general', name: 'General' }],
|
|
52
|
-
pages: [{ id: 'p1', fields: [] }]
|
|
53
|
-
});
|
|
54
|
-
expect(result.valid).toBe(false);
|
|
55
|
-
expect(result.errors).toBeDefined();
|
|
56
|
-
});
|
|
57
|
-
it('should reject config missing required "pages"', () => {
|
|
58
|
-
const result = validateFormConfig({
|
|
59
|
-
categories: [{ id: 'general', name: 'General' }],
|
|
60
|
-
fields: { name: { type: 'text' } }
|
|
61
|
-
});
|
|
62
|
-
expect(result.valid).toBe(false);
|
|
63
|
-
});
|
|
64
|
-
it('should accept config with optional properties', () => {
|
|
65
|
-
const result = validateFormConfig({
|
|
66
|
-
...validConfig,
|
|
67
|
-
$schema: './schema/unified-form.schema.json',
|
|
68
|
-
schemaVersion: 'v2.0.0',
|
|
69
|
-
displayName: 'Test Form',
|
|
70
|
-
templateIcon: 'loan-icon'
|
|
71
|
-
});
|
|
72
|
-
expect(result.valid).toBe(true);
|
|
73
|
-
});
|
|
74
|
-
it('should validate field types against allowed enum', () => {
|
|
75
|
-
const result = validateFormConfig({
|
|
76
|
-
categories: [{ id: 'general', name: 'General' }],
|
|
77
|
-
fields: {
|
|
78
|
-
name: { type: 'invalid_type' }
|
|
79
|
-
},
|
|
80
|
-
pages: [{ id: 'p1', fields: ['name'] }]
|
|
81
|
-
});
|
|
82
|
-
expect(result.valid).toBe(false);
|
|
83
|
-
});
|
|
84
|
-
it('should accept complex field definitions', () => {
|
|
85
|
-
const result = validateFormConfig({
|
|
86
|
-
categories: [{ id: 'general', name: 'General' }],
|
|
87
|
-
fields: {
|
|
88
|
-
amount: {
|
|
89
|
-
type: 'number',
|
|
90
|
-
displayName: 'Loan Amount',
|
|
91
|
-
min: 1000,
|
|
92
|
-
max: 500000,
|
|
93
|
-
required: true,
|
|
94
|
-
visibleIf: '{employmentType} = "employed"',
|
|
95
|
-
validators: [
|
|
96
|
-
{ type: 'numeric', minValue: 1000, maxValue: 500000, text: 'Must be between 1000 and 500000' }
|
|
97
|
-
]
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
pages: [{ id: 'p1', fields: ['amount'] }]
|
|
101
|
-
});
|
|
102
|
-
expect(result.valid).toBe(true);
|
|
103
|
-
});
|
|
104
|
-
it('should reject a completely invalid input', () => {
|
|
105
|
-
const result = validateFormConfig('not an object');
|
|
106
|
-
expect(result.valid).toBe(false);
|
|
107
|
-
});
|
|
108
|
-
it('should reject null input', () => {
|
|
109
|
-
const result = validateFormConfig(null);
|
|
110
|
-
expect(result.valid).toBe(false);
|
|
111
|
-
});
|
|
112
|
-
it('should provide errors array on validation failure', () => {
|
|
113
|
-
const result = validateFormConfig({});
|
|
114
|
-
expect(result.valid).toBe(false);
|
|
115
|
-
expect(result.errors).toBeDefined();
|
|
116
|
-
expect(Array.isArray(result.errors)).toBe(true);
|
|
117
|
-
expect(result.errors.length).toBeGreaterThan(0);
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
describe('deprecated aliases', () => {
|
|
121
|
-
const validConfig = {
|
|
122
|
-
categories: [{ id: 'general', name: 'General' }],
|
|
123
|
-
fields: { name: { type: 'text' } },
|
|
124
|
-
pages: [{ id: 'p1', fields: ['name'] }]
|
|
125
|
-
};
|
|
126
|
-
it('validateFormSpec should delegate to validateFormConfig', () => {
|
|
127
|
-
const result = validateFormSpec(validConfig);
|
|
128
|
-
expect(result.valid).toBe(true);
|
|
129
|
-
});
|
|
130
|
-
it('validatePagesConfig should delegate to validateFormConfig', () => {
|
|
131
|
-
const result = validatePagesConfig(validConfig);
|
|
132
|
-
expect(result.valid).toBe(true);
|
|
133
|
-
});
|
|
134
|
-
it('deprecated aliases should return same errors as validateFormConfig', () => {
|
|
135
|
-
const invalid = {};
|
|
136
|
-
const base = validateFormConfig(invalid);
|
|
137
|
-
const spec = validateFormSpec(invalid);
|
|
138
|
-
const pages = validatePagesConfig(invalid);
|
|
139
|
-
expect(spec.valid).toBe(base.valid);
|
|
140
|
-
expect(pages.valid).toBe(base.valid);
|
|
141
|
-
});
|
|
142
|
-
});
|