Skip to content
This repository was archived by the owner on Nov 8, 2024. It is now read-only.

Commit 70584cc

Browse files
feat: removes "values" from field error messages
1 parent a48594f commit 70584cc

10 files changed

+8
-97
lines changed

lib/units/validateBody.js

+4-8
Original file line numberDiff line numberDiff line change
@@ -197,15 +197,13 @@ function validateBody(expected, actual) {
197197

198198
if (realTypeError) {
199199
errors.push({
200-
message: realTypeError,
201-
values
200+
message: realTypeError
202201
});
203202
}
204203

205204
if (expectedTypeError) {
206205
errors.push({
207-
message: expectedTypeError,
208-
values
206+
message: expectedTypeError
209207
});
210208
}
211209

@@ -227,13 +225,11 @@ function validateBody(expected, actual) {
227225
errors.push({
228226
message: `Expected "body" of "${mediaTyper.format(
229227
expectedType
230-
)}" media type, but actual "body" is missing.`,
231-
values
228+
)}" media type, but actual "body" is missing.`
232229
});
233230
} else {
234231
errors.push({
235-
message: validatorError,
236-
values
232+
message: validatorError
237233
});
238234
}
239235
}

lib/units/validateHeaders.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ No validator found for real data media type
4343
"${actualType}"
4444
and expected data media type
4545
"${expectedType}".\
46-
`,
47-
values
46+
`
4847
});
4948
}
5049

lib/units/validateMethod.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ function validateMethod(expected, actual) {
88

99
if (!valid) {
1010
errors.push({
11-
message: `Expected method '${values.expected}', but got '${values.actual}'.`,
12-
values
11+
message: `Expected method '${values.expected}', but got '${values.actual}'.`
1312
});
1413
}
1514

lib/units/validateStatusCode.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ function validateStatusCode(expected, actual) {
1313

1414
if (!valid) {
1515
errors.push({
16-
message: `Expected status code '${values.expected}', but got '${values.actual}'.`,
17-
values
16+
message: `Expected status code '${values.expected}', but got '${values.actual}'.`
1817
});
1918
}
2019

lib/units/validateURI.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ const validateURI = (expected, actual) => {
3737

3838
if (!valid) {
3939
errors.push({
40-
message: `Expected URI '${values.expected}', but got '${values.actual}'.`,
41-
values
40+
message: `Expected URI '${values.expected}', but got '${values.actual}'.`
4241
});
4342
}
4443

test/integration/validate.test.js

-9
Original file line numberDiff line numberDiff line change
@@ -297,15 +297,6 @@ describe('validate', () => {
297297
.to.have.errorAtIndex(0)
298298
.withMessage(`Expected method 'POST', but got 'PUT'.`);
299299
});
300-
301-
it('includes values', () => {
302-
expect(result.fields.method)
303-
.to.have.errorAtIndex(0)
304-
.withValues({
305-
expected: 'POST',
306-
actual: 'PUT'
307-
});
308-
});
309300
});
310301
});
311302
});

test/unit/units/validateBody.test.js

-9
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,6 @@ describe('validateBody', () => {
5151
`Can't validate actual media type 'application/json' against the expected media type 'text/plain'.`
5252
);
5353
});
54-
55-
it('includes values', () => {
56-
expect(result)
57-
.to.have.errorAtIndex(0)
58-
.withValues({
59-
expected: '',
60-
actual: '{ "foo": "bar" }'
61-
});
62-
});
6354
});
6455
});
6556

test/unit/units/validateMethod.test.js

-18
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,6 @@ describe('validateMethod', () => {
5353
.to.have.errorAtIndex(0)
5454
.withMessage(`Expected method 'POST', but got 'GET'.`);
5555
});
56-
57-
it('includes values', () => {
58-
expect(result)
59-
.to.have.errorAtIndex(0)
60-
.withValues({
61-
expected: 'POST',
62-
actual: 'GET'
63-
});
64-
});
6556
});
6657
});
6758

@@ -93,15 +84,6 @@ describe('validateMethod', () => {
9384
.to.have.errorAtIndex(0)
9485
.withMessage(`Expected method 'PATCH', but got ''.`);
9586
});
96-
97-
it('includes values', () => {
98-
expect(result)
99-
.to.have.errorAtIndex(0)
100-
.withValues({
101-
expected: 'PATCH',
102-
actual: ''
103-
});
104-
});
10587
});
10688
});
10789
});

test/unit/units/validateStatusCode.test.js

-9
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,6 @@ describe('validateStatusCode', () => {
5353
.to.have.errorAtIndex(0)
5454
.withMessage(`Expected status code '400', but got '200'.`);
5555
});
56-
57-
it('includes values', () => {
58-
expect(result)
59-
.to.have.errorAtIndex(0)
60-
.withValues({
61-
expected: '400',
62-
actual: '200'
63-
});
64-
});
6556
});
6657
});
6758
});

test/unit/units/validateURI.test.js

-36
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,6 @@ describe('validateURI', () => {
129129
.to.have.errorAtIndex(0)
130130
.withMessage(`Expected URI '/dashboard', but got '/profile'.`);
131131
});
132-
133-
it('includes values', () => {
134-
expect(result)
135-
.to.have.errorAtIndex(0)
136-
.withValues({
137-
expected: '/dashboard',
138-
actual: '/profile'
139-
});
140-
});
141132
});
142133
});
143134

@@ -172,15 +163,6 @@ describe('validateURI', () => {
172163
`Expected URI '/account?id=123', but got '/account'.`
173164
);
174165
});
175-
176-
it('includes values', () => {
177-
expect(result)
178-
.to.have.errorAtIndex(0)
179-
.withValues({
180-
expected: '/account?id=123',
181-
actual: '/account'
182-
});
183-
});
184166
});
185167
});
186168

@@ -214,15 +196,6 @@ describe('validateURI', () => {
214196
`Expected URI '/account?name=user', but got '/account?nAmE=usEr'.`
215197
);
216198
});
217-
218-
it('includes values', () => {
219-
expect(result)
220-
.to.have.errorAtIndex(0)
221-
.withValues({
222-
expected: '/account?name=user',
223-
actual: '/account?nAmE=usEr'
224-
});
225-
});
226199
});
227200
});
228201

@@ -256,15 +229,6 @@ describe('validateURI', () => {
256229
`Expected URI '/zoo?type=cats&type=dogs', but got '/zoo?type=dogs&type=cats'.`
257230
);
258231
});
259-
260-
it('includes values', () => {
261-
expect(result)
262-
.to.have.errorAtIndex(0)
263-
.withValues({
264-
expected: '/zoo?type=cats&type=dogs',
265-
actual: '/zoo?type=dogs&type=cats'
266-
});
267-
});
268232
});
269233
});
270234
});

0 commit comments

Comments
 (0)