From f8a014448441c613ea7680bd53ba5e835fa04261 Mon Sep 17 00:00:00 2001 From: Suren Atoyan Date: Wed, 19 Jun 2019 14:08:45 +0400 Subject: [PATCH] integrate jest and react-testing-library with test coverage --- package.json | 12 +- src/Editor/__snapshots__/index.spec.js.snap | 91 + src/Editor/index.spec.js | 14 + src/Loading/__snapshots__/index.spec.js.snap | 70 + src/Loading/index.spec.js | 36 + yarn.lock | 1889 +++++++++++++++++- 6 files changed, 2068 insertions(+), 44 deletions(-) create mode 100644 src/Editor/__snapshots__/index.spec.js.snap create mode 100644 src/Editor/index.spec.js create mode 100644 src/Loading/__snapshots__/index.spec.js.snap create mode 100644 src/Loading/index.spec.js diff --git a/package.json b/package.json index 250c11f..c6dba30 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "lint": "npx eslint src", "build": "npx babel src --out-dir lib", "prepublish": "npm test && npm run lint && npm run build", - "test": "echo \"Error: no test specified\" && exit 0" + "test": "npx jest" }, "repository": { "type": "git", @@ -39,7 +39,9 @@ "@babel/plugin-proposal-class-properties": "^7.4.4", "@babel/preset-env": "^7.4.5", "@babel/preset-react": "^7.0.0", + "@testing-library/react": "^8.0.1", "babel-eslint": "9.x", + "babel-jest": "^24.8.0", "eslint": "5.x", "eslint-config-react-app": "^4.0.1", "eslint-plugin-flowtype": "2.x", @@ -48,7 +50,10 @@ "eslint-plugin-react": "7.x", "eslint-plugin-react-hooks": "1.5.0", "husky": "^2.4.1", - "react": "^16.8.6" + "jest": "^24.8.0", + "jest-dom": "^3.5.0", + "react": "^16.8.6", + "react-dom": "^16.8.6" }, "babel": { "presets": [ @@ -68,5 +73,6 @@ "hooks": { "pre-commit": "npm test && npm run lint" } - } + }, + "dependencies": {} } diff --git a/src/Editor/__snapshots__/index.spec.js.snap b/src/Editor/__snapshots__/index.spec.js.snap new file mode 100644 index 0000000..2c5fceb --- /dev/null +++ b/src/Editor/__snapshots__/index.spec.js.snap @@ -0,0 +1,91 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[` should check render with snapshot 1`] = ` +Object { + "asFragment": [Function], + "baseElement": +
+
+
+ Loading... +
+
+
+
+