@valbuild/core 0.26.0 → 0.27.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/package.json +12 -3
- package/CHANGELOG.md +0 -0
- package/ROADMAP.md +0 -106
- package/jest.config.js +0 -4
- package/src/Json.ts +0 -4
- package/src/ValApi.ts +0 -81
- package/src/expr/README.md +0 -193
- package/src/expr/eval.test.ts +0 -198
- package/src/expr/eval.ts +0 -251
- package/src/expr/expr.ts +0 -91
- package/src/expr/index.ts +0 -3
- package/src/expr/parser.test.ts +0 -158
- package/src/expr/parser.ts +0 -229
- package/src/expr/repl.ts +0 -88
- package/src/expr/tokenizer.test.ts +0 -539
- package/src/expr/tokenizer.ts +0 -117
- package/src/fp/array.ts +0 -30
- package/src/fp/index.ts +0 -3
- package/src/fp/result.ts +0 -214
- package/src/fp/util.ts +0 -52
- package/src/future/fetchVal.test.ts +0 -164
- package/src/future/fetchVal.ts +0 -206
- package/src/getSha256.ts +0 -8
- package/src/index.ts +0 -132
- package/src/initSchema.ts +0 -50
- package/src/initVal.ts +0 -73
- package/src/module.test.ts +0 -170
- package/src/module.ts +0 -397
- package/src/patch/deref.test.ts +0 -298
- package/src/patch/deref.ts +0 -136
- package/src/patch/index.ts +0 -12
- package/src/patch/json.test.ts +0 -582
- package/src/patch/json.ts +0 -304
- package/src/patch/operation.ts +0 -86
- package/src/patch/ops.ts +0 -83
- package/src/patch/parse.test.ts +0 -202
- package/src/patch/parse.ts +0 -202
- package/src/patch/patch.ts +0 -49
- package/src/patch/util.ts +0 -74
- package/src/schema/array.ts +0 -93
- package/src/schema/boolean.ts +0 -49
- package/src/schema/future/i18n.ts +0 -69
- package/src/schema/future/oneOf.ts +0 -63
- package/src/schema/image.ts +0 -137
- package/src/schema/index.ts +0 -70
- package/src/schema/keyOf.ts +0 -167
- package/src/schema/literal.ts +0 -63
- package/src/schema/number.ts +0 -56
- package/src/schema/object.ts +0 -110
- package/src/schema/record.ts +0 -103
- package/src/schema/richtext.ts +0 -44
- package/src/schema/string.ts +0 -95
- package/src/schema/union.ts +0 -63
- package/src/schema/validation/ValidationError.ts +0 -16
- package/src/schema/validation/ValidationFix.ts +0 -6
- package/src/schema/validation.test.ts +0 -291
- package/src/selector/SelectorProxy.ts +0 -238
- package/src/selector/array.ts +0 -13
- package/src/selector/boolean.ts +0 -4
- package/src/selector/file.ts +0 -6
- package/src/selector/future/ExprProxy.test.ts +0 -203
- package/src/selector/future/ExprProxy.ts +0 -216
- package/src/selector/future/SelectorProxy.test.ts +0 -172
- package/src/selector/future/SelectorProxy.ts +0 -238
- package/src/selector/future/array.ts +0 -37
- package/src/selector/future/boolean.ts +0 -4
- package/src/selector/future/file.ts +0 -14
- package/src/selector/future/i18n.ts +0 -13
- package/src/selector/future/index.ts +0 -169
- package/src/selector/future/number.ts +0 -4
- package/src/selector/future/object.ts +0 -22
- package/src/selector/future/primitive.ts +0 -17
- package/src/selector/future/remote.ts +0 -9
- package/src/selector/future/selector.test.ts +0 -429
- package/src/selector/future/selectorOf.ts +0 -7
- package/src/selector/future/string.ts +0 -4
- package/src/selector/index.ts +0 -121
- package/src/selector/number.ts +0 -4
- package/src/selector/object.ts +0 -5
- package/src/selector/primitive.ts +0 -4
- package/src/selector/string.ts +0 -4
- package/src/source/file.ts +0 -45
- package/src/source/future/i18n.ts +0 -60
- package/src/source/future/remote.ts +0 -54
- package/src/source/index.ts +0 -53
- package/src/source/link.ts +0 -14
- package/src/source/richtext.ts +0 -178
- package/src/val/array.ts +0 -10
- package/src/val/index.ts +0 -100
- package/src/val/object.ts +0 -13
- package/src/val/primitive.ts +0 -8
- package/tsconfig.json +0 -8
package/src/schema/richtext.ts
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
2
|
-
import { Schema, SerializedSchema } from ".";
|
3
|
-
import { RichTextSource, RichTextOptions } from "../source/richtext";
|
4
|
-
import { SourcePath } from "../val";
|
5
|
-
import { ValidationErrors } from "./validation/ValidationError";
|
6
|
-
|
7
|
-
export type SerializedRichTextSchema = RichTextOptions & {
|
8
|
-
type: "richtext";
|
9
|
-
opt: boolean;
|
10
|
-
};
|
11
|
-
|
12
|
-
export class RichTextSchema<
|
13
|
-
O extends RichTextOptions,
|
14
|
-
Src extends RichTextSource<O> | null
|
15
|
-
> extends Schema<Src> {
|
16
|
-
constructor(readonly options: O, readonly opt: boolean = false) {
|
17
|
-
super();
|
18
|
-
}
|
19
|
-
|
20
|
-
validate(path: SourcePath, src: Src): ValidationErrors {
|
21
|
-
return false; //TODO
|
22
|
-
}
|
23
|
-
|
24
|
-
assert(src: Src): boolean {
|
25
|
-
return true; // TODO
|
26
|
-
}
|
27
|
-
|
28
|
-
optional(): Schema<RichTextSource<O> | null> {
|
29
|
-
return new RichTextSchema(this.options, true);
|
30
|
-
}
|
31
|
-
|
32
|
-
serialize(): SerializedSchema {
|
33
|
-
return {
|
34
|
-
type: "richtext",
|
35
|
-
opt: this.opt,
|
36
|
-
};
|
37
|
-
}
|
38
|
-
}
|
39
|
-
|
40
|
-
export const richtext = <O extends RichTextOptions>(
|
41
|
-
options?: O
|
42
|
-
): Schema<RichTextSource<O>> => {
|
43
|
-
return new RichTextSchema<O, RichTextSource<O>>(options ?? ({} as O));
|
44
|
-
};
|
package/src/schema/string.ts
DELETED
@@ -1,95 +0,0 @@
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
2
|
-
import { Schema, SerializedSchema } from ".";
|
3
|
-
import { SourcePath } from "../val";
|
4
|
-
import { ValidationErrors } from "./validation/ValidationError";
|
5
|
-
|
6
|
-
type StringOptions = {
|
7
|
-
maxLength?: number;
|
8
|
-
minLength?: number;
|
9
|
-
};
|
10
|
-
|
11
|
-
export type SerializedStringSchema = {
|
12
|
-
type: "string";
|
13
|
-
options?: StringOptions;
|
14
|
-
opt: boolean;
|
15
|
-
raw: boolean;
|
16
|
-
};
|
17
|
-
|
18
|
-
const brand = Symbol("string");
|
19
|
-
export type RawString = string & { readonly [brand]: "raw" };
|
20
|
-
|
21
|
-
export class StringSchema<Src extends string | null> extends Schema<Src> {
|
22
|
-
constructor(
|
23
|
-
readonly options?: StringOptions,
|
24
|
-
readonly opt: boolean = false,
|
25
|
-
private readonly isRaw: boolean = false
|
26
|
-
) {
|
27
|
-
super();
|
28
|
-
}
|
29
|
-
|
30
|
-
validate(path: SourcePath, src: Src): ValidationErrors {
|
31
|
-
if (this.opt && (src === null || src === undefined)) {
|
32
|
-
return false;
|
33
|
-
}
|
34
|
-
if (typeof src !== "string") {
|
35
|
-
return {
|
36
|
-
[path]: [
|
37
|
-
{ message: `Expected 'string', got '${typeof src}'`, value: src },
|
38
|
-
],
|
39
|
-
} as ValidationErrors;
|
40
|
-
}
|
41
|
-
const errors = [];
|
42
|
-
if (this.options?.maxLength && src.length > this.options.maxLength) {
|
43
|
-
errors.push({
|
44
|
-
message: `Expected string to be at most ${this.options.maxLength} characters long, got ${src.length}`,
|
45
|
-
value: src,
|
46
|
-
});
|
47
|
-
}
|
48
|
-
if (this.options?.minLength && src.length < this.options.minLength) {
|
49
|
-
errors.push({
|
50
|
-
message: `Expected string to be at least ${this.options.minLength} characters long, got ${src.length}`,
|
51
|
-
value: src,
|
52
|
-
});
|
53
|
-
}
|
54
|
-
if (errors.length > 0) {
|
55
|
-
return {
|
56
|
-
[path]: errors,
|
57
|
-
} as ValidationErrors;
|
58
|
-
}
|
59
|
-
return false;
|
60
|
-
}
|
61
|
-
|
62
|
-
assert(src: Src): boolean {
|
63
|
-
if (this.opt && (src === null || src === undefined)) {
|
64
|
-
return true;
|
65
|
-
}
|
66
|
-
return typeof src === "string";
|
67
|
-
}
|
68
|
-
|
69
|
-
optional(): StringSchema<Src | null> {
|
70
|
-
return new StringSchema<Src | null>(this.options, true, this.isRaw);
|
71
|
-
}
|
72
|
-
|
73
|
-
raw(): StringSchema<Src extends null ? RawString | null : RawString> {
|
74
|
-
return new StringSchema<Src extends null ? RawString | null : RawString>(
|
75
|
-
this.options,
|
76
|
-
this.opt,
|
77
|
-
true
|
78
|
-
);
|
79
|
-
}
|
80
|
-
|
81
|
-
serialize(): SerializedSchema {
|
82
|
-
return {
|
83
|
-
type: "string",
|
84
|
-
options: this.options,
|
85
|
-
opt: this.opt,
|
86
|
-
raw: this.isRaw,
|
87
|
-
};
|
88
|
-
}
|
89
|
-
}
|
90
|
-
|
91
|
-
export const string = <T extends string>(
|
92
|
-
options?: StringOptions
|
93
|
-
): StringSchema<T> => {
|
94
|
-
return new StringSchema(options);
|
95
|
-
};
|
package/src/schema/union.ts
DELETED
@@ -1,63 +0,0 @@
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-unused-vars */
|
2
|
-
import { Schema, SerializedSchema } from ".";
|
3
|
-
import { SelectorSource } from "../selector/index";
|
4
|
-
import { SourceObject } from "../source";
|
5
|
-
import { SourcePath } from "../val";
|
6
|
-
import { ValidationErrors } from "./validation/ValidationError";
|
7
|
-
|
8
|
-
export type SerializedUnionSchema = {
|
9
|
-
type: "union";
|
10
|
-
key: string;
|
11
|
-
items: SerializedSchema[];
|
12
|
-
opt: boolean;
|
13
|
-
};
|
14
|
-
|
15
|
-
type SourceOf<
|
16
|
-
Key extends string,
|
17
|
-
T extends Schema<SourceObject & { [k in Key]: string }>[]
|
18
|
-
> = T extends Schema<infer S>[]
|
19
|
-
? S extends SelectorSource
|
20
|
-
? S
|
21
|
-
: never
|
22
|
-
: never;
|
23
|
-
|
24
|
-
export class UnionSchema<
|
25
|
-
Key extends string,
|
26
|
-
T extends Schema<SourceObject & { [k in Key]: string }>[]
|
27
|
-
> extends Schema<SourceOf<Key, T>> {
|
28
|
-
validate(path: SourcePath, src: SourceOf<Key, T>): ValidationErrors {
|
29
|
-
throw new Error("Method not implemented.");
|
30
|
-
}
|
31
|
-
assert(src: SourceOf<Key, T>): boolean {
|
32
|
-
throw new Error("Method not implemented.");
|
33
|
-
}
|
34
|
-
optional(): Schema<SourceOf<Key, T> | null> {
|
35
|
-
throw new Error("Method not implemented.");
|
36
|
-
}
|
37
|
-
serialize(): SerializedSchema {
|
38
|
-
return {
|
39
|
-
type: "union",
|
40
|
-
key: this.key,
|
41
|
-
items: this.items.map((o) => o.serialize()),
|
42
|
-
opt: this.opt,
|
43
|
-
};
|
44
|
-
}
|
45
|
-
|
46
|
-
constructor(
|
47
|
-
readonly key: Key,
|
48
|
-
readonly items: T,
|
49
|
-
readonly opt: boolean = false
|
50
|
-
) {
|
51
|
-
super();
|
52
|
-
}
|
53
|
-
}
|
54
|
-
|
55
|
-
export const union = <
|
56
|
-
Key extends string,
|
57
|
-
T extends Schema<SourceObject & { [k in Key]: string }>[]
|
58
|
-
>(
|
59
|
-
key: Key,
|
60
|
-
...objects: T
|
61
|
-
): Schema<SourceOf<Key, T>> => {
|
62
|
-
return new UnionSchema(key, objects);
|
63
|
-
};
|
@@ -1,16 +0,0 @@
|
|
1
|
-
import { SourcePath } from "../../val";
|
2
|
-
import { ValidationFix } from "./ValidationFix";
|
3
|
-
|
4
|
-
export type ValidationError = {
|
5
|
-
message: string;
|
6
|
-
value?: unknown;
|
7
|
-
fixes?: ValidationFix[];
|
8
|
-
};
|
9
|
-
|
10
|
-
/**
|
11
|
-
* Equals `false` if no validation errors were found.
|
12
|
-
* Errors are indexed by the full source path.
|
13
|
-
*
|
14
|
-
* Global errors have the path `"/"`.
|
15
|
-
*/
|
16
|
-
export type ValidationErrors = false | Record<SourcePath, ValidationError[]>;
|
@@ -1,291 +0,0 @@
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
2
|
-
|
3
|
-
import { createValPathOfItem } from "../selector/future/SelectorProxy";
|
4
|
-
import { SourcePath } from "../val";
|
5
|
-
import { array } from "./array";
|
6
|
-
import { boolean } from "./boolean";
|
7
|
-
import { literal } from "./literal";
|
8
|
-
import { number } from "./number";
|
9
|
-
import { object } from "./object";
|
10
|
-
import { string } from "./string";
|
11
|
-
import { file as fileVal } from "../source/file";
|
12
|
-
import { richtext as richtextVal } from "../source/richtext";
|
13
|
-
import { image } from "./image";
|
14
|
-
import { ValidationFix } from "./validation/ValidationFix";
|
15
|
-
import {
|
16
|
-
ValidationError,
|
17
|
-
ValidationErrors,
|
18
|
-
} from "./validation/ValidationError";
|
19
|
-
import { richtext } from "./richtext";
|
20
|
-
import { record } from "./record";
|
21
|
-
import { keyOf } from "./keyOf";
|
22
|
-
import { content } from "../module";
|
23
|
-
|
24
|
-
const testPath = "/test" as SourcePath;
|
25
|
-
const pathOf = (p: string | symbol | number) => {
|
26
|
-
return createValPathOfItem(testPath, p);
|
27
|
-
};
|
28
|
-
const ValidationTestCases: {
|
29
|
-
description: string;
|
30
|
-
input: any;
|
31
|
-
schema: any;
|
32
|
-
expected: [SourcePath | undefined] | false;
|
33
|
-
fixes?: {
|
34
|
-
[path: string]: ValidationFix[];
|
35
|
-
};
|
36
|
-
}[] = [
|
37
|
-
// boolean
|
38
|
-
{
|
39
|
-
description: "basic boolean (true)",
|
40
|
-
input: true,
|
41
|
-
schema: boolean(),
|
42
|
-
expected: false,
|
43
|
-
},
|
44
|
-
{
|
45
|
-
description: "basic boolean (false)",
|
46
|
-
input: false,
|
47
|
-
schema: boolean(),
|
48
|
-
expected: false,
|
49
|
-
},
|
50
|
-
{
|
51
|
-
description: "failing boolean (null)",
|
52
|
-
input: null,
|
53
|
-
schema: boolean(),
|
54
|
-
expected: [testPath],
|
55
|
-
},
|
56
|
-
{
|
57
|
-
description: "optional boolean (null)",
|
58
|
-
input: null,
|
59
|
-
schema: boolean().optional(),
|
60
|
-
expected: false,
|
61
|
-
},
|
62
|
-
{
|
63
|
-
description: "failing boolean",
|
64
|
-
input: "false",
|
65
|
-
schema: boolean(),
|
66
|
-
expected: [testPath],
|
67
|
-
},
|
68
|
-
// number
|
69
|
-
{
|
70
|
-
description: "basic number (0)",
|
71
|
-
input: 0,
|
72
|
-
schema: number(),
|
73
|
-
expected: false,
|
74
|
-
},
|
75
|
-
{
|
76
|
-
description: "basic number (-1)",
|
77
|
-
input: -1,
|
78
|
-
schema: number(),
|
79
|
-
expected: false,
|
80
|
-
},
|
81
|
-
{
|
82
|
-
description: "basic number (1)",
|
83
|
-
input: 1,
|
84
|
-
schema: number(),
|
85
|
-
expected: false,
|
86
|
-
},
|
87
|
-
{
|
88
|
-
description: "basic number (1)",
|
89
|
-
input: 1,
|
90
|
-
schema: number(),
|
91
|
-
expected: false,
|
92
|
-
},
|
93
|
-
// string
|
94
|
-
{
|
95
|
-
description: "basic string",
|
96
|
-
input: "two",
|
97
|
-
schema: string(),
|
98
|
-
expected: false,
|
99
|
-
},
|
100
|
-
{
|
101
|
-
description: "failing string",
|
102
|
-
input: 1,
|
103
|
-
schema: string(),
|
104
|
-
expected: [testPath],
|
105
|
-
},
|
106
|
-
// literal
|
107
|
-
{
|
108
|
-
description: "basic literal",
|
109
|
-
input: "one",
|
110
|
-
schema: literal("one"),
|
111
|
-
expected: false,
|
112
|
-
},
|
113
|
-
{
|
114
|
-
description: "failing literal",
|
115
|
-
input: "two",
|
116
|
-
schema: literal("one"),
|
117
|
-
expected: [testPath],
|
118
|
-
},
|
119
|
-
// array
|
120
|
-
{
|
121
|
-
description: "basic array(string)",
|
122
|
-
input: ["one", "two"],
|
123
|
-
schema: array(string()),
|
124
|
-
expected: false,
|
125
|
-
},
|
126
|
-
{
|
127
|
-
description: "failing array(string)",
|
128
|
-
input: [true, "false"],
|
129
|
-
schema: array(string()),
|
130
|
-
expected: [pathOf(0)],
|
131
|
-
},
|
132
|
-
// object
|
133
|
-
{
|
134
|
-
description: "basic object(string)",
|
135
|
-
input: { one: "one val", two: 2 },
|
136
|
-
schema: object({
|
137
|
-
one: string(),
|
138
|
-
two: number(),
|
139
|
-
}),
|
140
|
-
expected: false,
|
141
|
-
},
|
142
|
-
{
|
143
|
-
description: "failing object(string)",
|
144
|
-
input: { one: "one val", two: 1 },
|
145
|
-
schema: object({
|
146
|
-
one: string(),
|
147
|
-
two: string(),
|
148
|
-
}),
|
149
|
-
expected: [pathOf("two")],
|
150
|
-
},
|
151
|
-
// record
|
152
|
-
{
|
153
|
-
description: "basic record(string)",
|
154
|
-
input: { one: "one val", two: "two val" },
|
155
|
-
schema: record(string()),
|
156
|
-
expected: false,
|
157
|
-
},
|
158
|
-
{
|
159
|
-
description: "failing record(string)",
|
160
|
-
input: { one: "one val", two: 1 },
|
161
|
-
schema: object({
|
162
|
-
one: string(),
|
163
|
-
two: string(),
|
164
|
-
}),
|
165
|
-
expected: [pathOf("two")],
|
166
|
-
},
|
167
|
-
// keyof
|
168
|
-
{
|
169
|
-
description: "basic keyOf(array)",
|
170
|
-
input: 1,
|
171
|
-
schema: keyOf(content("/keyof-module", array(string()), [])),
|
172
|
-
expected: false,
|
173
|
-
},
|
174
|
-
{
|
175
|
-
description: "failing keyOf(record)",
|
176
|
-
input: "1",
|
177
|
-
schema: keyOf(content("/keyof-module", array(string()), [])),
|
178
|
-
expected: [testPath],
|
179
|
-
},
|
180
|
-
{
|
181
|
-
description: "basic keyOf(record)",
|
182
|
-
input: "one",
|
183
|
-
schema: keyOf(content("/keyof-module", record(string()), {})),
|
184
|
-
expected: false,
|
185
|
-
},
|
186
|
-
{
|
187
|
-
description: "failing keyOf(record)",
|
188
|
-
input: 1,
|
189
|
-
schema: keyOf(content("/keyof-module", record(string()), {})),
|
190
|
-
expected: [testPath],
|
191
|
-
},
|
192
|
-
{
|
193
|
-
description: "basic keyOf(object)",
|
194
|
-
input: "test1",
|
195
|
-
schema: keyOf(
|
196
|
-
content("/keyof-module", object({ test1: string(), test2: string() }), {
|
197
|
-
test1: "",
|
198
|
-
test2: "",
|
199
|
-
})
|
200
|
-
),
|
201
|
-
expected: false,
|
202
|
-
},
|
203
|
-
{
|
204
|
-
description: "failing keyOf(object)",
|
205
|
-
input: "test",
|
206
|
-
schema: keyOf(
|
207
|
-
content("/keyof-module", object({ test1: string(), test2: string() }), {
|
208
|
-
test1: "",
|
209
|
-
test2: "",
|
210
|
-
})
|
211
|
-
),
|
212
|
-
expected: [testPath],
|
213
|
-
},
|
214
|
-
// image / file
|
215
|
-
{
|
216
|
-
description: "optional image",
|
217
|
-
input: null,
|
218
|
-
schema: image().optional(),
|
219
|
-
expected: false,
|
220
|
-
},
|
221
|
-
{
|
222
|
-
description: "failure image:: null",
|
223
|
-
input: null,
|
224
|
-
schema: image(),
|
225
|
-
expected: [testPath],
|
226
|
-
},
|
227
|
-
{
|
228
|
-
description: "failure image: replace metadata",
|
229
|
-
input: fileVal("test", {
|
230
|
-
width: 100,
|
231
|
-
height: 100,
|
232
|
-
sha256: "test",
|
233
|
-
}),
|
234
|
-
schema: image(),
|
235
|
-
expected: [testPath],
|
236
|
-
fixes: {
|
237
|
-
[testPath]: ["image:replace-metadata"],
|
238
|
-
},
|
239
|
-
},
|
240
|
-
{
|
241
|
-
description: "failure image: check metadata",
|
242
|
-
input: fileVal("test", {
|
243
|
-
width: 100,
|
244
|
-
height: 100,
|
245
|
-
sha256:
|
246
|
-
"9e420dc93157ab98338542ba6f1d34fcf829d646aa729a86720fa3f4cb2d0076",
|
247
|
-
}),
|
248
|
-
schema: image(),
|
249
|
-
expected: [testPath],
|
250
|
-
fixes: {
|
251
|
-
[testPath]: ["image:replace-metadata"],
|
252
|
-
},
|
253
|
-
},
|
254
|
-
// richtext
|
255
|
-
{
|
256
|
-
description: "basic richtext",
|
257
|
-
input: richtextVal`test`,
|
258
|
-
expected: false,
|
259
|
-
schema: richtext({ bold: true }),
|
260
|
-
},
|
261
|
-
// TODO: more richtext cases
|
262
|
-
// TODO: union
|
263
|
-
// TODO: oneOf
|
264
|
-
// TODO: i18n
|
265
|
-
];
|
266
|
-
|
267
|
-
describe("validation", () => {
|
268
|
-
test.each(ValidationTestCases)(
|
269
|
-
'validate ($description): "$expected"',
|
270
|
-
({ input, schema, expected, fixes }) => {
|
271
|
-
const result = schema.validate(testPath, input);
|
272
|
-
if (result) {
|
273
|
-
expect(Object.keys(result)).toStrictEqual(expected);
|
274
|
-
if (fixes) {
|
275
|
-
expect(
|
276
|
-
Object.fromEntries(
|
277
|
-
Object.entries(result as ValidationErrors).map(
|
278
|
-
([path, errors]) => [
|
279
|
-
path,
|
280
|
-
errors.flatMap((error: ValidationError) => error.fixes),
|
281
|
-
]
|
282
|
-
)
|
283
|
-
)
|
284
|
-
).toStrictEqual(fixes);
|
285
|
-
}
|
286
|
-
} else {
|
287
|
-
expect(result).toStrictEqual(expected);
|
288
|
-
}
|
289
|
-
}
|
290
|
-
);
|
291
|
-
});
|