-
-
Notifications
You must be signed in to change notification settings - Fork 89
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
Add MDN examples to tests. #42
Conversation
@domenic It looks like on master, the behavior is already OK. I added some explicit tests to ensure this. @mightyguava I'm not sure why your situation isn't working. |
Can you rebase on master? Apparently jshint broke the config file in a non-major... |
@Sebmaster ah, I was just fixing the |
@Sebmaster @domenic I just did a little more investigation into why @mightyguava is experiencing errors. It looks like the "built"
This code snippet will throw the error:
Opening an issue also about this, I don't think I can fix this on my own. |
The packages on npm haven't been updated to the new rework yet since I'll still have to review the url PR on jsdom to see how they interface with each other. The tests are executed against the built file (the source file actually contains an undefined function, so wouldn't actually work). |
describe("MDN examples", () => { | ||
it("Checking all examples on MDN pass", () => { | ||
const a = new URL("/", "https://developer.mozilla.org"); | ||
assert.strictEqual(a.href, "https://developer.mozilla.org/", "a"); |
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.
please get rid of these "a", "b", ... "j" strings.
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.
May I ask why? They correspond to the MDN examples and help determine which of the assert
statements are actually failing. Without them, it would be difficult to see since many of the expected strings are identical.
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.
They don't help me as a developer at all. They cause the assertion message to be "a" instead of "asdfasdf did not strict equal https://developer.mozilla.org/"
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 can tell which assert is failing from the line number.
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.
Sounds good. I'll remove them.
const h = new URL("/en-US/docs", a); | ||
assert.strictEqual(h.href, "https://developer.mozilla.org/en-US/docs"); | ||
|
||
// Raises a SYNTAX ERROR exception as "/en-US/docs" is not valid |
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.
This comment is incorrect (maybe MDN is incorrect). It should be a TypeError.
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.
It's possible that MDN is incorrect. I'll just remove the comment.
This helps ensure that passing in a URL object instead of a string to the 2nd argument of the constructor works as expected.
Hmm, |
Hmm, Travis seems to have been stuck on |
Yeah, seems like it has a bit of a problem, I'll get to reviewing all changes tomorrow at the earliest anyways though so maybe it'll be fixed by then. |
This helps ensure that passing in a URL object instead of a string to the 2nd argument of the constructor works as expected.
Related issue: whatwg/url#80