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

Commit 2c6cf2d

Browse files
Merge pull request #255 from apiaryio/254-duplicate-values
Removes "values" from field error messages
2 parents 413f426 + 70584cc commit 2c6cf2d

12 files changed

+12
-101
lines changed

lib/units/validateBody.js

Lines changed: 4 additions & 8 deletions
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

Lines changed: 1 addition & 2 deletions
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

Lines changed: 1 addition & 2 deletions
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

Lines changed: 1 addition & 2 deletions
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

Lines changed: 1 addition & 2 deletions
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

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"eslint-config-airbnb-base": "13.2.0",
6161
"eslint-config-prettier": "6.0.0",
6262
"eslint-plugin-import": "2.18.2",
63-
"gavel-spec": "4.0.0",
63+
"gavel-spec": "4.1.0",
6464
"husky": "3.0.2",
6565
"lint-staged": "9.2.1",
6666
"mocha": "6.2.0",

test/integration/validate.test.js

Lines changed: 0 additions & 9 deletions
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

Lines changed: 0 additions & 9 deletions
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

Lines changed: 0 additions & 18 deletions
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
});

0 commit comments

Comments
 (0)