Skip to content
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

Chore: Add util tests and fix file tests #702

Closed
wants to merge 2 commits into from

Conversation

tonyjin
Copy link
Contributor

@tonyjin tonyjin commented Mar 7, 2018

Add Babel Rewire plugin so we can properly test inBoxWebApp() and fix canDownload() tests

Depends on #696

Tony Jin added 2 commits March 6, 2018 14:18
- Contact Us redirect to Box support page should only show up in the Box web application
- Fix non-wrapping error text in IE11
- Consolidate download checks into util function
- Move file-specific util method into file.js
Add Babel Rewire plugin so we can properly test `inBoxWebApp()` and fix `canDownload()` tests
@boxcla
Copy link

boxcla commented Mar 7, 2018

Verified that @tonyjin has signed the CLA. Thanks for the pull request!

@tonyjin tonyjin requested a review from DanDeMicco March 7, 2018 00:00
[false, true, false, false, false],
[true, false, false, false, false],
[true, true, true, true, true],
].forEach(([isDownloadable, isDownloadEnabled, havePermission, isBrowserSupported, expectedResult]) => {
Copy link
Contributor Author

@tonyjin tonyjin Mar 7, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't have the [] here before wrapping the arguments at first, but the test still passed since an array for the first param and undefined for all of the others still passed the test...

*/
export function getHostname() {
return window.location.hostname || '';
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now hostname is stub-able for tests

@tonyjin
Copy link
Contributor Author

tonyjin commented Mar 7, 2018

Huh, looks like Rewire may be causing a bunch of other issues with our tests... Will re-visit after #696 is merged.

@tonyjin
Copy link
Contributor Author

tonyjin commented Mar 8, 2018

Closing in favor of #709

Babel rewire was causing issues with a lot of other tests. Essentially any other test that stubbed out something imported from file, util, or any other function that exported functions needed to be rewritten with Babel rewire.

@tonyjin tonyjin closed this Mar 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants