Skip to content

Commit 8755286

Browse files
committed
test: Update test cases
1 parent dc409e7 commit 8755286

10 files changed

Lines changed: 634 additions & 615 deletions

File tree

packages/project/test/lib/validation/schema/specVersion/kind/extension.js

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ async function assertValidation(t, config, expectedErrors = undefined) {
1515
});
1616
validationError.errors.forEach((error) => {
1717
delete error.schemaPath;
18+
delete error.emUsed;
1819
});
1920
t.deepEqual(validationError.errors, expectedErrors);
2021
} else {
@@ -32,10 +33,10 @@ test.before((t) => {
3233
test.after.always((t) => {
3334
t.context.ajvCoverage.createReport("html", {dir: "coverage/ajv-extension"});
3435
const thresholds = {
35-
statements: 80,
36-
branches: 70,
36+
statements: 70,
37+
branches: 60,
3738
functions: 100,
38-
lines: 80
39+
lines: 70
3940
};
4041
t.context.ajvCoverage.verify(thresholds);
4142
});
@@ -89,9 +90,9 @@ SpecificationVersion.getVersionsForRange(">=2.0").forEach((specVersion) => {
8990
"name": "my-project"
9091
}
9192
}, [{
92-
dataPath: "",
93+
instancePath: "",
9394
keyword: "required",
94-
message: "should have required property 'type'",
95+
message: "must have required property 'type'",
9596
params: {
9697
missingProperty: "type",
9798
}
@@ -107,9 +108,9 @@ SpecificationVersion.getVersionsForRange(">=2.0").forEach((specVersion) => {
107108
"name": "my-project"
108109
}
109110
}, [{
110-
dataPath: "/type",
111+
instancePath: "/type",
111112
keyword: "enum",
112-
message: "should be equal to one of the allowed values",
113+
message: "must be equal to one of the allowed values",
113114
params: {
114115
allowedValues: [
115116
"task",
@@ -129,9 +130,9 @@ SpecificationVersion.getVersionsForRange(">=2.0").forEach((specVersion) => {
129130
},
130131
"shims": {}
131132
}, [{
132-
dataPath: "",
133+
instancePath: "",
133134
keyword: "required",
134-
message: "should have required property 'specVersion'",
135+
message: "must have required property 'specVersion'",
135136
params: {
136137
missingProperty: "specVersion",
137138
}
@@ -145,9 +146,9 @@ SpecificationVersion.getVersionsForRange(">=2.0").forEach((specVersion) => {
145146
"type": "project-shim",
146147
"shims": {}
147148
}, [{
148-
dataPath: "",
149+
instancePath: "",
149150
keyword: "required",
150-
message: "should have required property 'metadata'",
151+
message: "must have required property 'metadata'",
151152
params: {
152153
missingProperty: "metadata",
153154
}

packages/project/test/lib/validation/schema/specVersion/kind/extension/project-shim.js

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ async function assertValidation(t, config, expectedErrors = undefined) {
1616
});
1717
validationError.errors.forEach((error) => {
1818
delete error.schemaPath;
19+
delete error.emUsed;
1920
if (error.params && Array.isArray(error.params.errors)) {
2021
error.params.errors.forEach(($) => {
2122
delete $.schemaPath;
23+
delete $.emUsed;
2224
});
2325
}
2426
});
@@ -38,10 +40,10 @@ test.before((t) => {
3840
test.after.always((t) => {
3941
t.context.ajvCoverage.createReport("html", {dir: "coverage/ajv-extension-project-shim"});
4042
const thresholds = {
41-
statements: 75,
42-
branches: 60,
43+
statements: 50,
44+
branches: 55,
4345
functions: 100,
44-
lines: 70
46+
lines: 50
4547
};
4648
t.context.ajvCoverage.verify(thresholds);
4749
});
@@ -85,41 +87,41 @@ SpecificationVersion.getVersionsForRange(">=2.0").forEach((specVersion) => {
8587
"middleware": {}
8688
}, [
8789
{
88-
dataPath: "",
90+
instancePath: "",
8991
keyword: "additionalProperties",
90-
message: "should NOT have additional properties",
92+
message: "must NOT have additional properties",
9193
params: {
9294
"additionalProperty": "middleware"
9395
}
9496
},
9597
{
96-
dataPath: "/shims",
98+
instancePath: "/shims",
9799
keyword: "additionalProperties",
98-
message: "should NOT have additional properties",
100+
message: "must NOT have additional properties",
99101
params: {
100102
additionalProperty: "notAllowed",
101103
}
102104
},
103105
{
104-
dataPath: "/shims/dependencies/my-dependency",
106+
instancePath: "/shims/dependencies/my-dependency",
105107
keyword: "type",
106-
message: "should be array",
108+
message: "must be array",
107109
params: {
108110
type: "array",
109111
}
110112
},
111113
{
112-
dataPath: "/shims/collections/foo",
114+
instancePath: "/shims/collections/foo",
113115
keyword: "additionalProperties",
114-
message: "should NOT have additional properties",
116+
message: "must NOT have additional properties",
115117
params: {
116118
additionalProperty: "notAllowed",
117119
}
118120
},
119121
{
120-
dataPath: "/shims/collections/foo/modules/lib-1",
122+
instancePath: "/shims/collections/foo/modules/lib-1",
121123
keyword: "type",
122-
message: "should be string",
124+
message: "must be string",
123125
params: {
124126
type: "string",
125127
}
@@ -139,14 +141,14 @@ SpecificationVersion.getVersionsForRange(">=3.0").forEach(function(specVersion)
139141
},
140142
"shims": {}
141143
}, [{
142-
dataPath: "/metadata/name",
144+
instancePath: "/metadata/name",
143145
keyword: "errorMessage",
144146
message: `Not a valid extension name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Configuration/#name`,
145147
params: {
146148
errors: [{
147-
dataPath: "/metadata/name",
149+
instancePath: "/metadata/name",
148150
keyword: "pattern",
149-
message: `should match pattern "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$"`,
151+
message: `must match pattern "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$"`,
150152
params: {
151153
pattern: "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$",
152154
}
@@ -162,14 +164,14 @@ SpecificationVersion.getVersionsForRange(">=3.0").forEach(function(specVersion)
162164
},
163165
"shims": {}
164166
}, [{
165-
dataPath: "/metadata/name",
167+
instancePath: "/metadata/name",
166168
keyword: "errorMessage",
167169
message: `Not a valid extension name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Configuration/#name`,
168170
params: {
169171
errors: [{
170-
dataPath: "/metadata/name",
172+
instancePath: "/metadata/name",
171173
keyword: "minLength",
172-
message: "should NOT be shorter than 3 characters",
174+
message: "must NOT have fewer than 3 characters",
173175
params: {
174176
limit: 3,
175177
}
@@ -185,14 +187,14 @@ SpecificationVersion.getVersionsForRange(">=3.0").forEach(function(specVersion)
185187
},
186188
"shims": {}
187189
}, [{
188-
dataPath: "/metadata/name",
190+
instancePath: "/metadata/name",
189191
keyword: "errorMessage",
190192
message: `Not a valid extension name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Configuration/#name`,
191193
params: {
192194
errors: [{
193-
dataPath: "/metadata/name",
195+
instancePath: "/metadata/name",
194196
keyword: "maxLength",
195-
message: "should NOT be longer than 80 characters",
197+
message: "must NOT have more than 80 characters",
196198
params: {
197199
limit: 80,
198200
}

packages/project/test/lib/validation/schema/specVersion/kind/extension/server-middleware.js

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ async function assertValidation(t, config, expectedErrors = undefined) {
1616
});
1717
validationError.errors.forEach((error) => {
1818
delete error.schemaPath;
19+
delete error.emUsed;
1920
if (error.params && Array.isArray(error.params.errors)) {
2021
error.params.errors.forEach(($) => {
2122
delete $.schemaPath;
23+
delete $.emUsed;
2224
});
2325
}
2426
});
@@ -38,10 +40,10 @@ test.before((t) => {
3840
test.after.always((t) => {
3941
t.context.ajvCoverage.createReport("html", {dir: "coverage/ajv-extension-server-middleware"});
4042
const thresholds = {
41-
statements: 70,
42-
branches: 55,
43+
statements: 50,
44+
branches: 50,
4345
functions: 100,
44-
lines: 70
46+
lines: 50
4547
};
4648
t.context.ajvCoverage.verify(thresholds);
4749
});
@@ -59,14 +61,14 @@ SpecificationVersion.getVersionsForRange(">=3.0").forEach(function(specVersion)
5961
"path": "/bar"
6062
}
6163
}, [{
62-
dataPath: "/metadata/name",
64+
instancePath: "/metadata/name",
6365
keyword: "errorMessage",
6466
message: `Not a valid extension name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Configuration/#name`,
6567
params: {
6668
errors: [{
67-
dataPath: "/metadata/name",
69+
instancePath: "/metadata/name",
6870
keyword: "pattern",
69-
message: `should match pattern "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$"`,
71+
message: `must match pattern "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$"`,
7072
params: {
7173
pattern: "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$",
7274
}
@@ -84,14 +86,14 @@ SpecificationVersion.getVersionsForRange(">=3.0").forEach(function(specVersion)
8486
"path": "/bar"
8587
}
8688
}, [{
87-
dataPath: "/metadata/name",
89+
instancePath: "/metadata/name",
8890
keyword: "errorMessage",
8991
message: `Not a valid extension name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Configuration/#name`,
9092
params: {
9193
errors: [{
92-
dataPath: "/metadata/name",
94+
instancePath: "/metadata/name",
9395
keyword: "minLength",
94-
message: "should NOT be shorter than 3 characters",
96+
message: "must NOT have fewer than 3 characters",
9597
params: {
9698
limit: 3,
9799
}
@@ -109,14 +111,14 @@ SpecificationVersion.getVersionsForRange(">=3.0").forEach(function(specVersion)
109111
"path": "/bar"
110112
}
111113
}, [{
112-
dataPath: "/metadata/name",
114+
instancePath: "/metadata/name",
113115
keyword: "errorMessage",
114116
message: `Not a valid extension name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Configuration/#name`,
115117
params: {
116118
errors: [{
117-
dataPath: "/metadata/name",
119+
instancePath: "/metadata/name",
118120
keyword: "maxLength",
119-
message: "should NOT be longer than 80 characters",
121+
message: "must NOT have more than 80 characters",
120122
params: {
121123
limit: 80,
122124
}

packages/project/test/lib/validation/schema/specVersion/kind/extension/task.js

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ async function assertValidation(t, config, expectedErrors = undefined) {
1616
});
1717
validationError.errors.forEach((error) => {
1818
delete error.schemaPath;
19+
delete error.emUsed;
1920
if (error.params && Array.isArray(error.params.errors)) {
2021
error.params.errors.forEach(($) => {
2122
delete $.schemaPath;
23+
delete $.emUsed;
2224
});
2325
}
2426
});
@@ -38,10 +40,10 @@ test.before((t) => {
3840
test.after.always((t) => {
3941
t.context.ajvCoverage.createReport("html", {dir: "coverage/ajv-extension-task"});
4042
const thresholds = {
41-
statements: 70,
42-
branches: 55,
43+
statements: 50,
44+
branches: 50,
4345
functions: 100,
44-
lines: 70
46+
lines: 50
4547
};
4648
t.context.ajvCoverage.verify(thresholds);
4749
});
@@ -59,14 +61,14 @@ SpecificationVersion.getVersionsForRange(">=3.0").forEach(function(specVersion)
5961
"path": "/bar"
6062
}
6163
}, [{
62-
dataPath: "/metadata/name",
64+
instancePath: "/metadata/name",
6365
keyword: "errorMessage",
6466
message: `Not a valid extension name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Configuration/#name`,
6567
params: {
6668
errors: [{
67-
dataPath: "/metadata/name",
69+
instancePath: "/metadata/name",
6870
keyword: "pattern",
69-
message: `should match pattern "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$"`,
71+
message: `must match pattern "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$"`,
7072
params: {
7173
pattern: "^(?:@[0-9a-z-_.]+\\/)?[a-z][0-9a-z-_.]*$",
7274
}
@@ -84,14 +86,14 @@ SpecificationVersion.getVersionsForRange(">=3.0").forEach(function(specVersion)
8486
"path": "/bar"
8587
}
8688
}, [{
87-
dataPath: "/metadata/name",
89+
instancePath: "/metadata/name",
8890
keyword: "errorMessage",
8991
message: `Not a valid extension name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Configuration/#name`,
9092
params: {
9193
errors: [{
92-
dataPath: "/metadata/name",
94+
instancePath: "/metadata/name",
9395
keyword: "minLength",
94-
message: "should NOT be shorter than 3 characters",
96+
message: "must NOT have fewer than 3 characters",
9597
params: {
9698
limit: 3,
9799
}
@@ -109,14 +111,14 @@ SpecificationVersion.getVersionsForRange(">=3.0").forEach(function(specVersion)
109111
"path": "/bar"
110112
}
111113
}, [{
112-
dataPath: "/metadata/name",
114+
instancePath: "/metadata/name",
113115
keyword: "errorMessage",
114116
message: `Not a valid extension name. It must consist of lowercase alphanumeric characters, dash, underscore, and period only. Additionally, it may contain an npm-style package scope. For details, see: https://ui5.github.io/cli/stable/pages/Configuration/#name`,
115117
params: {
116118
errors: [{
117-
dataPath: "/metadata/name",
119+
instancePath: "/metadata/name",
118120
keyword: "maxLength",
119-
message: "should NOT be longer than 80 characters",
121+
message: "must NOT have more than 80 characters",
120122
params: {
121123
limit: 80,
122124
}

0 commit comments

Comments
 (0)