Skip to content

Commit

Permalink
fix: escape dot in example.com match pattern (#246)
Browse files Browse the repository at this point in the history
  • Loading branch information
P0lip authored Jun 4, 2019
1 parent a8b0e5f commit e2dcfa3
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 58 deletions.
26 changes: 0 additions & 26 deletions src/rulesets/oas2/__tests__/__snapshots__/host-not-example.ts.snap

This file was deleted.

8 changes: 7 additions & 1 deletion src/rulesets/oas2/__tests__/host-not-example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ describe('host-not-example', () => {
paths: {},
host: 'https://example.com',
});
expect(results).toMatchSnapshot();
expect(results).toEqual([
expect.objectContaining({
code: 'host-not-example',
message: 'Server URL should not point at `example.com`.',
path: ['host'],
}),
]);
});
});
2 changes: 1 addition & 1 deletion src/rulesets/oas2/ruleset.json
Original file line number Diff line number Diff line change
Expand Up @@ -1681,7 +1681,7 @@
"field": "host",
"function": "pattern",
"functionOptions": {
"notMatch": "example.com"
"notMatch": "example\\.com"
}
}
},
Expand Down

This file was deleted.

8 changes: 7 additions & 1 deletion src/rulesets/oas3/__tests__/server-not-example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ describe('server-not-example.com', () => {
},
],
});
expect(results).toMatchSnapshot();
expect(results).toEqual([
expect.objectContaining({
code: 'server-not-example.com',
message: 'Server URL should not point at `example.com`.',
path: ['servers', 0, 'url'],
}),
]);
});
});
2 changes: 1 addition & 1 deletion src/rulesets/oas3/ruleset.json
Original file line number Diff line number Diff line change
Expand Up @@ -2372,7 +2372,7 @@
"field": "url",
"function": "pattern",
"functionOptions": {
"notMatch": "example.com"
"notMatch": "example\\.com"
}
}
},
Expand Down

0 comments on commit e2dcfa3

Please sign in to comment.