Write integration tests (#719)

* Scaffold a simple test case for debugging

* Set up Jest environment that works with React

- Install and set up react-testing-library
- "Unignore" roughjs and browser-nativejs transformations
- Separate App component from ReactDOM

* Write first passing test

- Mock canvas
- Remove App file and mount/unmount ReactDOM on import

* Add tests for drag create behavior

* Fix comments in dragCreate

* Pin jest-mock-canvas dependency

* Remove dependency range for testing library

* Add tests for multi point mode and selection element

* Fix all tests due to decrease in updates to canvas when changing tools

* Disable state updates if component is unmounted

- Remove all event listeners
- Disable storing scene in state if component is unmounted

* Add tests for move and element selection

* Merge branch 'master' into add-integration-tests

* Add tests for resizing rectangle

* move unmounted check to syncActionResult method

* Use a custom test renderer instead of default testing-library functions

* Add custom query for selecting tools

* move files around

Co-authored-by: David Luzar <luzar.david@gmail.com>
This commit is contained in:
Gasim Gasimzada 2020-02-12 02:19:43 +04:00 committed by GitHub
parent ad4ad238ef
commit 7183234895
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 1180 additions and 5 deletions

View file

@ -16,6 +16,8 @@
},
"description": "",
"devDependencies": {
"@testing-library/jest-dom": "5.1.1",
"@testing-library/react": "9.4.0",
"@types/jest": "25.1.2",
"@types/nanoid": "2.1.0",
"@types/react": "16.9.19",
@ -24,12 +26,18 @@
"eslint-config-prettier": "6.10.0",
"eslint-plugin-prettier": "3.1.2",
"husky": "4.2.1",
"jest-canvas-mock": "2.2.0",
"lint-staged": "10.0.7",
"node-sass": "4.13.1",
"prettier": "1.19.1",
"rewire": "4.0.1",
"typescript": "3.7.5"
},
"jest": {
"transformIgnorePatterns": [
"node_modules/(?!(roughjs|browser-nativefs)/)"
]
},
"eslintConfig": {
"extends": [
"prettier",