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

[WIP][web] Add tests for components/ContentView #2365

Merged
merged 4 commits into from Jun 2, 2017

Conversation

Projects
None yet
2 participants
@MatthewShao
Contributor

MatthewShao commented Jun 1, 2017

  • CodeEditor.jsx
  • ContentLoader.jsx
  • ContentViewOptions.jsx
  • ContentView.jsx
  • DownloadContentButton.jsx
  • MetaView.jsx
  • ShowFullContentButton.jsx
  • UploadContentButton.jsx
  • ViewSelector.jsx
Show outdated Hide outdated web/src/js/components/ContentView/ContentViewOptions.jsx
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`CodeEditor Component should render correctly 1`] = `
<div

This comment has been minimized.

@mhils

mhils Jun 1, 2017

Member

It looks like all CodeMirror is missing entirely here?

@mhils

mhils Jun 1, 2017

Member

It looks like all CodeMirror is missing entirely here?

This comment has been minimized.

@MatthewShao

MatthewShao Jun 2, 2017

Contributor

CodeMirror itself is too complex, it use React.findDOMNode and ref tricks to implement its logic. Unfortunately, react-test-render has poor support for these two statements. It will throw some strange exceptions.
The only way that came up to me is mock the whole CodeMirror, as a dependency, it should have been fully tested, right? Or we could turn to TestUtils.renderIntoDocument to do DOM test, but we need to mock many other functions like document.createRange for CodeMirror, basically doing another render test for CodeMirror component.
Do you have any idea about how to deal with this CodeMirror ?
BTW, I don't understand why the codecov coverge dropped.

@MatthewShao

MatthewShao Jun 2, 2017

Contributor

CodeMirror itself is too complex, it use React.findDOMNode and ref tricks to implement its logic. Unfortunately, react-test-render has poor support for these two statements. It will throw some strange exceptions.
The only way that came up to me is mock the whole CodeMirror, as a dependency, it should have been fully tested, right? Or we could turn to TestUtils.renderIntoDocument to do DOM test, but we need to mock many other functions like document.createRange for CodeMirror, basically doing another render test for CodeMirror component.
Do you have any idea about how to deal with this CodeMirror ?
BTW, I don't understand why the codecov coverge dropped.

This comment has been minimized.

@mhils

mhils Jun 2, 2017

Member

BTW, I don't understand why the codecov coverge dropped.

Codecov bug.

Other than that, looking at the issues you are describing the current test is good enough. I'll add a comment and we're good to go! :)

@mhils

mhils Jun 2, 2017

Member

BTW, I don't understand why the codecov coverge dropped.

Codecov bug.

Other than that, looking at the issues you are describing the current test is good enough. I'll add a comment and we're good to go! :)

@mhils mhils merged commit a71f763 into mitmproxy:master Jun 2, 2017

0 of 2 checks passed

continuous-integration/appveyor/pr Waiting for AppVeyor build to complete
Details
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment