-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue 442 - blacklisting hosts with config.json #1062
Conversation
@@ -103,6 +104,7 @@ defaults = { | |||
validationRules = { | |||
animationDistanceThreshold: v.isNumber | |||
baseUrl: v.isFullyQualifiedUrl | |||
blacklistHosts: v.isStringOrArrayOfStrings |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
string or array of strings here
## else return the host | ||
return host | ||
|
||
matches = (urlToCheck, blacklistHosts) -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would check blackListHosts
type here - if type is not string or array of strings, something went wrong. Throw
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also, what does this return? needs a jsdoc block I feel, because this is so reusable
expectedHeader = (res, val) -> | ||
expect(res.headers["x-cypress-matched-blacklisted-host"]).to.eq(val) | ||
|
||
Promise.all([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can also use https://github.com/bahmutov/snap-shot-it#data-driven-testing to make the test simpler here
|
||
matchesStr = (url, host, val) -> | ||
m = blacklist.matches(url, host) | ||
expect(!!m).to.eq(val, "url: '#{url}' did not pass") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ohhh, the !!m
notation
… localhost was causing ws connection issues
close #442