-
Notifications
You must be signed in to change notification settings - Fork 2
GPII-4410: Making links work without the extension #2
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
base: master
Are you sure you want to change the base?
Changes from all commits
1b315c6
c893cc3
2031d29
1718730
4c727d1
ea1a2c1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -96,7 +96,7 @@ | |
| blankTab: { | ||
| id: 1 | ||
| }, | ||
| url: "https://actual.org/url", | ||
| url: new URL("https://actual.org/url"), | ||
| queryURL: "*://actual.org/url" | ||
| }; | ||
|
|
||
|
|
@@ -134,7 +134,7 @@ | |
| jqUnit.assertTrue("Tab isn't highlighted", browser.tabs.highlight.notCalled); | ||
| jqUnit.assertTrue("Loading tab isnt' removed", browser.tabs.remove.notCalled); | ||
| jqUnit.assertTrue("Tab isn't reloaded", browser.tabs.reload.notCalled); | ||
| let isUpdatedCalled = browser.tabs.update.calledOnceWithExactly(loadingTab.id, {url: openTabTestsProps.url}); | ||
| let isUpdatedCalled = browser.tabs.update.calledOnceWithExactly(loadingTab.id, {url: openTabTestsProps.url.href}); | ||
| jqUnit.assertTrue("Loading tab is updated with correct URL", isUpdatedCalled); | ||
| } | ||
|
|
||
|
|
@@ -151,29 +151,38 @@ | |
| const handlestRequestTestCases = [{ | ||
| name: "Open same tab", | ||
| details: { | ||
| url: "https://opensametab.morphic.org/actual.org/url" | ||
| url: "https://opensametab.morphic.org/redirect/https%3A%2F%2Factual.org/url" | ||
| }, | ||
| expected: { | ||
| response: {cancel: true}, | ||
| args: ["https://actual.org/url", false] | ||
| args: [new URL("https://actual.org/url"), false] | ||
| } | ||
| }, { | ||
| name: "Refresh tab", | ||
| details: { | ||
| url: "http://refreshsametab.morphic.org/actual.org/url" | ||
| url: "http://refreshsametab.morphic.org/redirect/http%3A%2F%2Factual.org/url" | ||
| }, | ||
| expected: { | ||
| response: {cancel: true}, | ||
| args: ["http://actual.org/url", true] | ||
| args: [new URL("http://actual.org/url"), true] | ||
| } | ||
| }, { | ||
| name: "Unfiltered URL", | ||
| details: { | ||
| url: "http://morphic.org/actual.org/url" | ||
| url: "http://morphic.org/redirect/https%3A%2F%2Factual.org/url" | ||
| }, | ||
| expected: { | ||
| response: {cancel: true}, | ||
| args: ["http://morphic.org/actual.org/url", false] | ||
| args: [new URL("http://morphic.org/redirect/https%3A%2F%2Factual.org/url"), false] | ||
| } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need test cases for when the response is
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done |
||
| }, { | ||
| name: "Bad URL", | ||
| details: { | ||
| url: "http://morphic.org/redirect/stupid" | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see where you're going with this, but wonder if it would be more appropriate to replace "stupid" with something like "incorrect", "broken", "invalid" or something along those lines. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes please change to what you think is most accurate term |
||
| }, | ||
| expected: { | ||
| response: {cancel: false}, | ||
| args: null | ||
| } | ||
| }]; | ||
|
|
||
|
|
@@ -184,7 +193,7 @@ | |
| let response = openURLs.handleRequest(testCase.details); | ||
| jqUnit.assertDeepEq(`${testCase.name}: the response is returned correctly`, testCase.expected.response, response); | ||
|
|
||
| let isOpenTabCalledProperly = openTabStub.calledOnceWithExactly.apply(openTabStub, testCase.expected.args); | ||
| let isOpenTabCalledProperly = !testCase.expected.args || openTabStub.calledOnceWithExactly.apply(openTabStub, testCase.expected.args); | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I worry that by just passing any test that has a falsey value for args would allow tests that forget to add the args value to keep erroneously pass. Instead, I think we should provide an |
||
| jqUnit.assertTrue(`${testCase.name}: the openURLs.openTab method was called with the correct args`, isOpenTabCalledProperly); | ||
|
|
||
| // clean up | ||
|
|
||
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 wonder if it might be helpful to log the error in a meaningful way. It likely won't make a difference for most end users, but for someone who is developing and runs into this case, it will hopefully help track things down quicker.