Skip to content

Commit

Permalink
Introduces react-testing-library. Replaces InputLiteral tests. Separa…
Browse files Browse the repository at this point in the history
…tes integration tests.
  • Loading branch information
justinlittman committed Sep 23, 2019
1 parent 6e6b6f9 commit 6adbc73
Show file tree
Hide file tree
Showing 27 changed files with 728 additions and 547 deletions.
6 changes: 6 additions & 0 deletions .eslintrc.js
Expand Up @@ -209,6 +209,12 @@ module.exports = {
"rules": {
"jsx-a11y/anchor-is-valid": "off"
}
},
{
"files": ["__tests__/components/editor/property/InputLiteral.test.js"],
"rules": {
"import/no-unresolved": "off"
}
}
]
}
16 changes: 7 additions & 9 deletions README.md
Expand Up @@ -74,7 +74,11 @@ We are using webpack as a build tool. See `webpack.config.js` for build depende

### Running Tests

Tests are written in jest, also utilizing puppeteer for end-to-end tests. Run them with `npm test`.
Tests are written with jest:
* Unit tests ("in jsdom") are written with enzyme and react-testing-library
* Integration tests ("in-browser") are written with puppeteer

We are currently in the process of switching tests to react-testing-library.

To properly run all of the tests (including integration), you'll have to provide a couple of environment variables,
so that the tests have valid user info with which to login. The env vars are:
Expand All @@ -90,16 +94,10 @@ Putting it all together, to run all of the tests:

```sh
npm test
npm integration
```

You can also run the tests together with the linter all in one, similar to what happens at CircleCI.

```sh
npm run ci
```

Note that if you have an instance of the dev server already running in a separate terminal, you may need to stop the server or you may get a port conflict
when running the integration tests.
Note that if you have an instance of the dev server already running in a separate terminal, you may need to stop the server or you may get a port conflict when running the integration tests.

#### Test coverage

Expand Down
1 change: 0 additions & 1 deletion __tests__/components/App.test.js
@@ -1,6 +1,5 @@
// Copyright 2019 Stanford University see LICENSE for license

import 'jsdom-global/register'
import 'isomorphic-fetch'
import React from 'react'
import { mount, shallow } from 'enzyme'
Expand Down
1 change: 0 additions & 1 deletion __tests__/components/RootComponent.test.js
@@ -1,6 +1,5 @@
// Copyright 2018 Stanford University see LICENSE for license

import 'jsdom-global/register'
import React from 'react'
import { shallow } from 'enzyme'
import { OffCanvas } from 'react-offcanvas'
Expand Down
1 change: 0 additions & 1 deletion __tests__/components/editor/ResourceTemplateForm.test.js
@@ -1,7 +1,6 @@
// Copyright 2018, 2019 Stanford University see LICENSE for license

import React from 'react'
import 'jsdom-global/register'
import { shallow } from 'enzyme'
import ResourceTemplateForm from 'components/editor/ResourceTemplateForm'

Expand Down

0 comments on commit 6adbc73

Please sign in to comment.