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

Commit 4b24fb6

Browse files
test: adjusts tests for "error[n].location" property
1 parent 96956ec commit 4b24fb6

File tree

5 files changed

+12
-5
lines changed

5 files changed

+12
-5
lines changed

lib/units/validateBody.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ function validateBody(expected, actual) {
245245
actual.body,
246246
usesJsonSchema ? expected.bodySchema : expected.body
247247
);
248+
248249
// Without ".validate()" it cannot evaluate output to result.
249250
// TODO Re-do this.
250251
validator && validator.validate();

test/chai.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ ${JSON.stringify(target)}
5252
};
5353

5454
createErrorPropertyAssertion('message', 'withMessage');
55-
createErrorPropertyAssertion('pointer', 'withPointer');
55+
createErrorPropertyAssertion('location', 'withLocation');
5656
createErrorPropertyAssertion('values', 'withValues');
5757

5858
//

test/integration/validate.test.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,10 @@ describe('validate', () => {
237237
it('has pointer to missing "Content-Type"', () => {
238238
expect(result.fields.headers)
239239
.to.have.errorAtIndex(0)
240-
.withPointer('/content-type');
240+
.withLocation({
241+
pointer: '/content-type',
242+
property: ['content-type']
243+
});
241244
});
242245

243246
it('has explanatory message', () => {

test/unit/support/amanda-to-gavel-shared.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ exports.shouldBehaveLikeAmandaToGavel = (instance) => {
4545
assert.isObject(item);
4646
});
4747

48-
const props = ['message', 'pointer'];
48+
const props = ['message', 'location'];
4949
props.forEach((key) => {
5050
it('should have "' + key + '"', () => {
5151
assert.include(Object.keys(item), key);
@@ -55,7 +55,7 @@ exports.shouldBehaveLikeAmandaToGavel = (instance) => {
5555
describe('pointer key value', () => {
5656
value = null;
5757
before(() => {
58-
value = item['pointer'];
58+
value = item.location.pointer;
5959
});
6060

6161
it('should be a string', () => {

test/unit/units/validateHeaders.test.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,10 @@ describe('validateHeaders', () => {
6868
it('has pointer to header name', () => {
6969
expect(result)
7070
.to.have.errorAtIndex(index)
71-
.withPointer(`/${headerName}`);
71+
.withLocation({
72+
pointer: `/${headerName}`,
73+
property: [headerName]
74+
});
7275
});
7376

7477
it('has explanatory message', () => {

0 commit comments

Comments
 (0)