qualityfaster icon indicating copy to clipboard operation
qualityfaster copied to clipboard

This sample repo does not seem to be testing React components

Open andersr opened this issue 9 years ago • 1 comments

I was reviewing this repo and trying to understand how React components are being tested. However, it appears as if React components are not being tested at all.

UI/React Components do not appear in the velocity test summary: The following files, even though they are in the test directory, are not listed in the velocity test summary:

/tests/components/ui/account-summary-spec.jsx:

describe('Bank Transfer Component', function () {
  describe('doTransfer', function () { ...

/tests/components/ui/bank-transfer-spec.jsx:

describe('Account Summary Component', function () { ...
screen shot 2016-02-17 at 3 52 23 pm

Removing everything (except the required render call) has no impact on test results:

I made the following changes. All tests still pass.

/src/client/components/bank-transfer.jsx


BankTransfer = React.createClass({
  render() {
    return (
       <div className="bank-transfer">
     FOO
       </div>
    );
  }
});

/src/client/components/account-summary.jsx


AccountSummary = React.createClass({
  render() {
    return (
       <div className="account-summary">
         $ <span className="account-summary__balance">FOO</span>
       </div>
    );
  }
});

So, my questions are:

  • Why do the tests above not appear in the test summary?
  • Why do tests pass even when removing all code from the components?
  • Should a best practices repo like this not also include tests of the actual components?

andersr avatar Feb 17 '16 21:02 andersr

Hi @andersr, this repo actually uses several different tools to run tests, including chimp, karma & velocity. Currently velocity only runs jasmine unit tests, and UI tests are run using karma or wallaby.

Take a look at the docs: https://github.com/xolvio/automated-testing-best-practices#installation--usage you'll need to look at your console for the results to both feature & UI tests (unless you're using wallaby in which case UI tests will show up in wallaby).

cwohlman avatar Feb 24 '16 15:02 cwohlman