From 4043947f1e7251a4466f947f08a24816cb8643e4 Mon Sep 17 00:00:00 2001 From: rady-ben Date: Fri, 3 Sep 2021 22:01:25 +0100 Subject: [PATCH 01/18] add new config to jest --- __mocks__/App.test.js | 6 ++++++ __mocks__/fileMock.js | 1 + jest.enzyme.config.js | 9 +++++++++ package.json | 2 ++ yarn.lock | 2 +- 5 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 __mocks__/App.test.js create mode 100644 __mocks__/fileMock.js create mode 100644 jest.enzyme.config.js diff --git a/__mocks__/App.test.js b/__mocks__/App.test.js new file mode 100644 index 00000000..8a5283eb --- /dev/null +++ b/__mocks__/App.test.js @@ -0,0 +1,6 @@ +import React from "react"; +import ApplicationBar from '../src/components/application-bar/ApplicationBar'; + +test('render without error', () => { + +}); \ No newline at end of file diff --git a/__mocks__/fileMock.js b/__mocks__/fileMock.js new file mode 100644 index 00000000..84c1da6f --- /dev/null +++ b/__mocks__/fileMock.js @@ -0,0 +1 @@ +module.exports = 'test-file-stub'; \ No newline at end of file diff --git a/jest.enzyme.config.js b/jest.enzyme.config.js new file mode 100644 index 00000000..20dff1d8 --- /dev/null +++ b/jest.enzyme.config.js @@ -0,0 +1,9 @@ +module.exports = { + 'roots': [ + '/__mocks__', + ], + 'moduleNameMapper': { + "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "/__mocks__/fileMock.js", + "\\.(css|less)$": "identity-obj-proxy" + } + }; \ No newline at end of file diff --git a/package.json b/package.json index 8ff88f5d..bbb95699 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "test:e2e": "NODE_ENV=test start-test 6060 cypress:run && nyc report --reporter=json-summary", "test:unit": "NODE_ENV=test jest ./src/core --coverage && cat ./coverage/lcov.info | coveralls", "test": "nyc --exclude-after-remap=false npm run test:e2e", + "testJestEnzyme": "jest --watch -c ./jest.enzyme.config.js", "create-coverage-badge": "bash scripts/create-badge-json.sh" }, "browserslist": [ @@ -74,6 +75,7 @@ "eslint-plugin-cypress": "^2.11.1", "eslint-plugin-mdx": "1.0.1", "eslint-plugin-react": "7.19.0", + "identity-obj-proxy": "^3.0.0", "istanbul-lib-coverage": "2.0.5", "jest": "24.9.0", "lorem-ipsum": "2.0.1", diff --git a/yarn.lock b/yarn.lock index 025aa379..1531ff60 100644 --- a/yarn.lock +++ b/yarn.lock @@ -8592,7 +8592,7 @@ icss-utils@^4.0.0, icss-utils@^4.1.1: dependencies: postcss "^7.0.14" -identity-obj-proxy@3.0.0: +identity-obj-proxy@3.0.0, identity-obj-proxy@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/identity-obj-proxy/-/identity-obj-proxy-3.0.0.tgz#94d2bda96084453ef36fbc5aaec37e0f79f1fc14" integrity sha1-lNK9qWCERT7zb7xarsN+D3nx/BQ= From 3f2a646d96d3ffabeee8fbcd1372036538c3439a Mon Sep 17 00:00:00 2001 From: rady-ben Date: Fri, 3 Sep 2021 22:32:19 +0100 Subject: [PATCH 02/18] configure enzyme and test the render of FileForm --- __mocks__/App.test.js | 14 +- package.json | 2 + yarn.lock | 418 +++++++++++++++++++++++++++++++++++++++++- 3 files changed, 427 insertions(+), 7 deletions(-) diff --git a/__mocks__/App.test.js b/__mocks__/App.test.js index 8a5283eb..1e73a091 100644 --- a/__mocks__/App.test.js +++ b/__mocks__/App.test.js @@ -1,6 +1,16 @@ import React from "react"; -import ApplicationBar from '../src/components/application-bar/ApplicationBar'; +import Enzyme, {shallow} from 'enzyme'; +import Adapter from 'enzyme-adapter-react-16'; +import FileForm from '../src/components/file/FileForm'; +FileForm -test('render without error', () => { +Enzyme.configure({ + adapter: new Adapter(), +}) +test('render without error', () => { + const wrapper = shallow({}} + />); }); \ No newline at end of file diff --git a/package.json b/package.json index bbb95699..f4c4e0d1 100644 --- a/package.json +++ b/package.json @@ -69,6 +69,8 @@ "babel-plugin-istanbul": "6.0.0", "coveralls": "3.0.7", "cypress": "^6.8.0", + "enzyme": "^3.11.0", + "enzyme-adapter-react-16": "^1.15.6", "eslint": "6.6.0", "eslint-config-prettier": "6.5.0", "eslint-plugin-chai-friendly": "0.5.0", diff --git a/yarn.lock b/yarn.lock index 1531ff60..a488bf66 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2940,6 +2940,21 @@ aggregate-error@^3.0.0: clean-stack "^2.0.0" indent-string "^4.0.0" +airbnb-prop-types@^2.16.0: + version "2.16.0" + resolved "https://registry.yarnpkg.com/airbnb-prop-types/-/airbnb-prop-types-2.16.0.tgz#b96274cefa1abb14f623f804173ee97c13971dc2" + integrity sha512-7WHOFolP/6cS96PhKNrslCLMYAI8yB1Pp6u6XmxozQOiZbsI5ycglZr5cHhBFfuRcQQjzCMith5ZPZdYiJCxUg== + dependencies: + array.prototype.find "^2.1.1" + function.prototype.name "^1.1.2" + is-regex "^1.1.0" + object-is "^1.1.2" + object.assign "^4.1.0" + object.entries "^1.1.2" + prop-types "^15.7.2" + prop-types-exact "^1.2.0" + react-is "^16.13.1" + ajv-errors@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/ajv-errors/-/ajv-errors-1.0.1.tgz#f35986aceb91afadec4102fbd85014950cefa64d" @@ -3207,6 +3222,25 @@ array-unique@^0.3.2: resolved "https://registry.yarnpkg.com/array-unique/-/array-unique-0.3.2.tgz#a894b75d4bc4f6cd679ef3244a9fd8f46ae2d428" integrity sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg= +array.prototype.filter@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/array.prototype.filter/-/array.prototype.filter-1.0.0.tgz#24d63e38983cdc6bf023a3c574b2f2a3f384c301" + integrity sha512-TfO1gz+tLm+Bswq0FBOXPqAchtCr2Rn48T8dLJoRFl8NoEosjZmzptmuo1X8aZBzZcqsR1W8U761tjACJtngTQ== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + es-abstract "^1.18.0" + es-array-method-boxes-properly "^1.0.0" + is-string "^1.0.5" + +array.prototype.find@^2.1.1: + version "2.1.1" + resolved "https://registry.yarnpkg.com/array.prototype.find/-/array.prototype.find-2.1.1.tgz#3baca26108ca7affb08db06bf0be6cb3115a969c" + integrity sha512-mi+MYNJYLTx2eNYy+Yh6raoQacCsNeeMUaspFPh9Y141lFSsWxxB8V9mM2ye+eqiRs917J6/pJ4M9ZPzenWckA== + dependencies: + define-properties "^1.1.3" + es-abstract "^1.17.4" + array.prototype.flat@^1.2.1, array.prototype.flat@^1.2.3: version "1.2.4" resolved "https://registry.yarnpkg.com/array.prototype.flat/-/array.prototype.flat-1.2.4.tgz#6ef638b43312bd401b4c6199fdec7e2dc9e9a123" @@ -4515,6 +4549,30 @@ check-more-types@2.24.0, check-more-types@^2.24.0: resolved "https://registry.yarnpkg.com/check-more-types/-/check-more-types-2.24.0.tgz#1420ffb10fd444dcfc79b43891bbfffd32a84600" integrity sha1-FCD/sQ/URNz8ebQ4kbv//TKoRgA= +cheerio-select@^1.5.0: + version "1.5.0" + resolved "https://registry.yarnpkg.com/cheerio-select/-/cheerio-select-1.5.0.tgz#faf3daeb31b17c5e1a9dabcee288aaf8aafa5823" + integrity sha512-qocaHPv5ypefh6YNxvnbABM07KMxExbtbfuJoIie3iZXX1ERwYmJcIiRrr9H05ucQP1k28dav8rpdDgjQd8drg== + dependencies: + css-select "^4.1.3" + css-what "^5.0.1" + domelementtype "^2.2.0" + domhandler "^4.2.0" + domutils "^2.7.0" + +cheerio@^1.0.0-rc.3: + version "1.0.0-rc.10" + resolved "https://registry.yarnpkg.com/cheerio/-/cheerio-1.0.0-rc.10.tgz#2ba3dcdfcc26e7956fc1f440e61d51c643379f3e" + integrity sha512-g0J0q/O6mW8z5zxQ3A8E8J1hUgp4SMOvEoW/x84OwyHKe/Zccz83PVT4y5Crcr530FV6NgmKI1qvGTKVl9XXVw== + dependencies: + cheerio-select "^1.5.0" + dom-serializer "^1.3.2" + domhandler "^4.2.0" + htmlparser2 "^6.1.0" + parse5 "^6.0.1" + parse5-htmlparser2-tree-adapter "^6.0.1" + tslib "^2.2.0" + chokidar@^2.0.4, chokidar@^2.1.1, chokidar@^2.1.8: version "2.1.8" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-2.1.8.tgz#804b3a7b6a99358c3c5c61e71d8728f041cff917" @@ -5455,6 +5513,17 @@ css-select@^2.0.0, css-select@^2.0.2: domutils "^1.7.0" nth-check "^1.0.2" +css-select@^4.1.3: + version "4.1.3" + resolved "https://registry.yarnpkg.com/css-select/-/css-select-4.1.3.tgz#a70440f70317f2669118ad74ff105e65849c7067" + integrity sha512-gT3wBNd9Nj49rAbmtFHj1cljIAOLYSX1nZ8CB7TBO3INYckygm5B7LISU/szY//YmdiSLbJvDLOx9VnMVpMBxA== + dependencies: + boolbase "^1.0.0" + css-what "^5.0.0" + domhandler "^4.2.0" + domutils "^2.6.0" + nth-check "^2.0.0" + css-tree@1.0.0-alpha.37: version "1.0.0-alpha.37" resolved "https://registry.yarnpkg.com/css-tree/-/css-tree-1.0.0-alpha.37.tgz#98bebd62c4c1d9f960ec340cf9f7522e30709a22" @@ -5484,6 +5553,11 @@ css-what@^3.2.1: resolved "https://registry.yarnpkg.com/css-what/-/css-what-3.4.2.tgz#ea7026fcb01777edbde52124e21f327e7ae950e4" integrity sha512-ACUm3L0/jiZTqfzRM3Hi9Q8eZqd6IK37mMWPLz9PJxkLWllYeRf+EHUSHYEtFop2Eqytaq1FizFVh7XfBnXCDQ== +css-what@^5.0.0, css-what@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/css-what/-/css-what-5.0.1.tgz#3efa820131f4669a8ac2408f9c32e7c7de9f4cad" + integrity sha512-FYDTSHb/7KXsWICVsxdmiExPjCfRC4qRFBdVwv7Ax9hMnvMmEjP9RfxTEZ3qPZGmADDn2vAKSo9UcN1jKVYscg== + css@^2.0.0: version "2.2.4" resolved "https://registry.yarnpkg.com/css/-/css-2.2.4.tgz#c646755c73971f2bba6a601e2cf2fd71b1298929" @@ -6025,6 +6099,11 @@ dir-glob@^3.0.0, dir-glob@^3.0.1: dependencies: path-type "^4.0.0" +discontinuous-range@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/discontinuous-range/-/discontinuous-range-1.0.0.tgz#e38331f0844bba49b9a9cb71c771585aab1bc65a" + integrity sha1-44Mx8IRLukm5qctxx3FYWqsbxlo= + dns-equal@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/dns-equal/-/dns-equal-1.0.0.tgz#b39e7f1da6eb0a75ba9c17324b34753c47e0654d" @@ -6099,6 +6178,15 @@ dom-serializer@^1.0.1: domhandler "^4.0.0" entities "^2.0.0" +dom-serializer@^1.3.2: + version "1.3.2" + resolved "https://registry.yarnpkg.com/dom-serializer/-/dom-serializer-1.3.2.tgz#6206437d32ceefaec7161803230c7a20bc1b4d91" + integrity sha512-5c54Bk5Dw4qAxNOI1pFEizPSjVsx5+bpJKmL2kPn8JhBUq2q09tTCa3mjijun2NfK78NMouDYNMBkOrPZiS+ig== + dependencies: + domelementtype "^2.0.1" + domhandler "^4.2.0" + entities "^2.0.0" + domain-browser@^1.1.1, domain-browser@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.2.0.tgz#3d31f50191a6749dd1375a7f522e823d42e54eda" @@ -6114,6 +6202,11 @@ domelementtype@^2.0.1, domelementtype@^2.1.0: resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-2.1.0.tgz#a851c080a6d1c3d94344aed151d99f669edf585e" integrity sha512-LsTgx/L5VpD+Q8lmsXSHW2WpA+eBlZ9HPf3erD1IoPF00/3JKHZ3BknUVA2QGDNu69ZNmyFmCWBSO45XjYKC5w== +domelementtype@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/domelementtype/-/domelementtype-2.2.0.tgz#9a0b6c2782ed6a1c7323d42267183df9bd8b1d57" + integrity sha512-DtBMo82pv1dFtUmHyr48beiuq792Sxohr+8Hm9zoxklYPfa6n0Z3Byjj2IV7bmr2IyqClnqEQhfgHJJ5QF0R5A== + domexception@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/domexception/-/domexception-1.0.1.tgz#937442644ca6a31261ef36e3ec677fe805582c90" @@ -6142,6 +6235,13 @@ domhandler@^4.0.0: dependencies: domelementtype "^2.1.0" +domhandler@^4.2.0: + version "4.2.2" + resolved "https://registry.yarnpkg.com/domhandler/-/domhandler-4.2.2.tgz#e825d721d19a86b8c201a35264e226c678ee755f" + integrity sha512-PzE9aBMsdZO8TK4BnuJwH0QT41wgMbRzuZrHUcpYncEjmQazq8QEaBWgLG7ZyC/DAZKEgglpIA6j4Qn/HmxS3w== + dependencies: + domelementtype "^2.2.0" + domino@^2.1.6: version "2.1.6" resolved "https://registry.yarnpkg.com/domino/-/domino-2.1.6.tgz#fe4ace4310526e5e7b9d12c7de01b7f485a57ffe" @@ -6164,6 +6264,15 @@ domutils@^2.4.2: domelementtype "^2.0.1" domhandler "^4.0.0" +domutils@^2.5.2, domutils@^2.6.0, domutils@^2.7.0: + version "2.8.0" + resolved "https://registry.yarnpkg.com/domutils/-/domutils-2.8.0.tgz#4437def5db6e2d1f5d6ee859bd95ca7d02048135" + integrity sha512-w96Cjofp72M5IIhpjgobBimYEfoPjx1Vx0BSX9P30WBdZW2WIKU0T1Bd0kz2eNZ9ikjKgHbEyKx8BB6H1L3h3A== + dependencies: + dom-serializer "^1.0.1" + domelementtype "^2.2.0" + domhandler "^4.2.0" + dot-case@^2.1.0: version "2.1.1" resolved "https://registry.yarnpkg.com/dot-case/-/dot-case-2.1.1.tgz#34dcf37f50a8e93c2b3bca8bb7fb9155c7da3bee" @@ -6359,6 +6468,70 @@ env-paths@^2.2.0: resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-2.2.1.tgz#420399d416ce1fbe9bc0a07c62fa68d67fd0f8f2" integrity sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A== +enzyme-adapter-react-16@^1.15.6: + version "1.15.6" + resolved "https://registry.yarnpkg.com/enzyme-adapter-react-16/-/enzyme-adapter-react-16-1.15.6.tgz#fd677a658d62661ac5afd7f7f541f141f8085901" + integrity sha512-yFlVJCXh8T+mcQo8M6my9sPgeGzj85HSHi6Apgf1Cvq/7EL/J9+1JoJmJsRxZgyTvPMAqOEpRSu/Ii/ZpyOk0g== + dependencies: + enzyme-adapter-utils "^1.14.0" + enzyme-shallow-equal "^1.0.4" + has "^1.0.3" + object.assign "^4.1.2" + object.values "^1.1.2" + prop-types "^15.7.2" + react-is "^16.13.1" + react-test-renderer "^16.0.0-0" + semver "^5.7.0" + +enzyme-adapter-utils@^1.14.0: + version "1.14.0" + resolved "https://registry.yarnpkg.com/enzyme-adapter-utils/-/enzyme-adapter-utils-1.14.0.tgz#afbb0485e8033aa50c744efb5f5711e64fbf1ad0" + integrity sha512-F/z/7SeLt+reKFcb7597IThpDp0bmzcH1E9Oabqv+o01cID2/YInlqHbFl7HzWBl4h3OdZYedtwNDOmSKkk0bg== + dependencies: + airbnb-prop-types "^2.16.0" + function.prototype.name "^1.1.3" + has "^1.0.3" + object.assign "^4.1.2" + object.fromentries "^2.0.3" + prop-types "^15.7.2" + semver "^5.7.1" + +enzyme-shallow-equal@^1.0.1, enzyme-shallow-equal@^1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/enzyme-shallow-equal/-/enzyme-shallow-equal-1.0.4.tgz#b9256cb25a5f430f9bfe073a84808c1d74fced2e" + integrity sha512-MttIwB8kKxypwHvRynuC3ahyNc+cFbR8mjVIltnmzQ0uKGqmsfO4bfBuLxb0beLNPhjblUEYvEbsg+VSygvF1Q== + dependencies: + has "^1.0.3" + object-is "^1.1.2" + +enzyme@^3.11.0: + version "3.11.0" + resolved "https://registry.yarnpkg.com/enzyme/-/enzyme-3.11.0.tgz#71d680c580fe9349f6f5ac6c775bc3e6b7a79c28" + integrity sha512-Dw8/Gs4vRjxY6/6i9wU0V+utmQO9kvh9XLnz3LIudviOnVYDEe2ec+0k+NQoMamn1VrjKgCUOWj5jG/5M5M0Qw== + dependencies: + array.prototype.flat "^1.2.3" + cheerio "^1.0.0-rc.3" + enzyme-shallow-equal "^1.0.1" + function.prototype.name "^1.1.2" + has "^1.0.3" + html-element-map "^1.2.0" + is-boolean-object "^1.0.1" + is-callable "^1.1.5" + is-number-object "^1.0.4" + is-regex "^1.0.5" + is-string "^1.0.5" + is-subset "^0.1.1" + lodash.escape "^4.0.1" + lodash.isequal "^4.5.0" + object-inspect "^1.7.0" + object-is "^1.0.2" + object.assign "^4.1.0" + object.entries "^1.1.1" + object.values "^1.1.1" + raf "^3.4.1" + rst-selector-parser "^2.2.3" + string.prototype.trim "^1.2.1" + err-code@^1.0.0: version "1.1.2" resolved "https://registry.yarnpkg.com/err-code/-/err-code-1.1.2.tgz#06e0116d3028f6aef4806849eb0ea6a748ae6960" @@ -6400,6 +6573,34 @@ es-abstract@^1.17.2, es-abstract@^1.18.0-next.1, es-abstract@^1.18.0-next.2: string.prototype.trimstart "^1.0.4" unbox-primitive "^1.0.0" +es-abstract@^1.17.4, es-abstract@^1.18.0, es-abstract@^1.18.2: + version "1.18.5" + resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.18.5.tgz#9b10de7d4c206a3581fd5b2124233e04db49ae19" + integrity sha512-DDggyJLoS91CkJjgauM5c0yZMjiD1uK3KcaCeAmffGwZ+ODWzOkPN4QwRbsK5DOFf06fywmyLci3ZD8jLGhVYA== + dependencies: + call-bind "^1.0.2" + es-to-primitive "^1.2.1" + function-bind "^1.1.1" + get-intrinsic "^1.1.1" + has "^1.0.3" + has-symbols "^1.0.2" + internal-slot "^1.0.3" + is-callable "^1.2.3" + is-negative-zero "^2.0.1" + is-regex "^1.1.3" + is-string "^1.0.6" + object-inspect "^1.11.0" + object-keys "^1.1.1" + object.assign "^4.1.2" + string.prototype.trimend "^1.0.4" + string.prototype.trimstart "^1.0.4" + unbox-primitive "^1.0.1" + +es-array-method-boxes-properly@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/es-array-method-boxes-properly/-/es-array-method-boxes-properly-1.0.0.tgz#873f3e84418de4ee19c5be752990b2e44718d09e" + integrity sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA== + es-to-primitive@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.1.tgz#e55cd4c9cdc188bcefb03b366c736323fc5c898a" @@ -7787,11 +7988,26 @@ function.name-polyfill@^1.0.6: resolved "https://registry.yarnpkg.com/function.name-polyfill/-/function.name-polyfill-1.0.6.tgz#c54e37cae0a77dfcb49d47982815b0826b5c60d9" integrity sha512-ejQivNFbBPTY5O/waFta6D5AzV8GJiM/fMDaT6LrsYax1cb4eipxuQqKNlugF2jlcXIjifsqvju3wsgV35TELg== +function.prototype.name@^1.1.2, function.prototype.name@^1.1.3: + version "1.1.4" + resolved "https://registry.yarnpkg.com/function.prototype.name/-/function.prototype.name-1.1.4.tgz#e4ea839b9d3672ae99d0efd9f38d9191c5eaac83" + integrity sha512-iqy1pIotY/RmhdFZygSSlW0wko2yxkSCKqsuv4pr8QESohpYyG/Z7B/XXvPRKTJS//960rgguE5mSRUsDdaJrQ== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + es-abstract "^1.18.0-next.2" + functions-have-names "^1.2.2" + functional-red-black-tree@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc= +functions-have-names@^1.2.2: + version "1.2.2" + resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.2.tgz#98d93991c39da9361f8e50b337c4f6e41f120e21" + integrity sha512-bLgc3asbWdwPbx2mNk2S49kmJCuQeu0nfmaOgbs8WIyzzkw3r4htszdIi9Q9EMezDPTYuJx2wvjZ/EwgAthpnA== + gauge@~2.7.3: version "2.7.4" resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7" @@ -8203,6 +8419,13 @@ has-symbols@^1.0.1, has-symbols@^1.0.2: resolved "https://registry.yarnpkg.com/has-symbols/-/has-symbols-1.0.2.tgz#165d3070c00309752a1236a479331e3ac56f1423" integrity sha512-chXa79rL/UC2KlX17jo3vRGz0azaWEx5tGqZg5pO3NUyEJVB17dMruQlzCCOfUvElghKcm5194+BCRvi2Rv/Gw== +has-tostringtag@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/has-tostringtag/-/has-tostringtag-1.0.0.tgz#7e133818a7d394734f941e73c3d3f9291e658b25" + integrity sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ== + dependencies: + has-symbols "^1.0.2" + has-unicode@^2.0.0, has-unicode@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" @@ -8358,6 +8581,14 @@ html-comment-regex@^1.1.0: resolved "https://registry.yarnpkg.com/html-comment-regex/-/html-comment-regex-1.1.2.tgz#97d4688aeb5c81886a364faa0cad1dda14d433a7" integrity sha512-P+M65QY2JQ5Y0G9KKdlDpo0zK+/OHptU5AaBwUfAIDJZk1MYf32Frm84EcOytfJE0t5JvkAnKlmjsXDnWzCJmQ== +html-element-map@^1.2.0: + version "1.3.1" + resolved "https://registry.yarnpkg.com/html-element-map/-/html-element-map-1.3.1.tgz#44b2cbcfa7be7aa4ff59779e47e51012e1c73c08" + integrity sha512-6XMlxrAFX4UEEGxctfFnmrFaaZFNf9i5fNuV5wZ3WWQ4FVaNP1aX1LkX9j2mfEx1NpjeE/rL3nmgEn23GdFmrg== + dependencies: + array.prototype.filter "^1.0.0" + call-bind "^1.0.2" + html-encoding-sniffer@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/html-encoding-sniffer/-/html-encoding-sniffer-1.0.2.tgz#e70d84b94da53aa375e11fe3a351be6642ca46f8" @@ -8437,6 +8668,16 @@ htmlparser2@^5.0: domutils "^2.4.2" entities "^2.0.0" +htmlparser2@^6.1.0: + version "6.1.0" + resolved "https://registry.yarnpkg.com/htmlparser2/-/htmlparser2-6.1.0.tgz#c4d762b6c3371a05dbe65e94ae43a9f845fb8fb7" + integrity sha512-gyyPk6rgonLFEDGoeRgQNaEUvdJ4ktTmmUh/h2t7s+M8oPpIPxgNACWa+6ESR57kXstwqPiCut0V8NRpcwgU7A== + dependencies: + domelementtype "^2.0.1" + domhandler "^4.0.0" + domutils "^2.5.2" + entities "^2.0.0" + http-cache-semantics@^3.8.1: version "3.8.1" resolved "https://registry.yarnpkg.com/http-cache-semantics/-/http-cache-semantics-3.8.1.tgz#39b0e16add9b605bf0a9ef3d9daaf4843b4cacd2" @@ -8990,6 +9231,14 @@ is-binary-path@~2.1.0: dependencies: binary-extensions "^2.0.0" +is-boolean-object@^1.0.1: + version "1.1.2" + resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.1.2.tgz#5c6dc200246dd9321ae4b885a114bb1f75f63719" + integrity sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA== + dependencies: + call-bind "^1.0.2" + has-tostringtag "^1.0.0" + is-boolean-object@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.1.0.tgz#e2aaad3a3a8fca34c28f6eee135b156ed2587ff0" @@ -9012,6 +9261,11 @@ is-callable@^1.1.3, is-callable@^1.1.4, is-callable@^1.2.3: resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.3.tgz#8b1e0500b73a1d76c70487636f368e519de8db8e" integrity sha512-J1DcMe8UYTBSrKezuIUTUwjXsho29693unXM2YhJUTR2txK/eG47bvNa/wipPFmZFgr/N6f1GA66dv0mEyTIyQ== +is-callable@^1.1.5: + version "1.2.4" + resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.4.tgz#47301d58dd0259407865547853df6d61fe471945" + integrity sha512-nsuwtxZfMX67Oryl9LCQ+upnC0Z0BgpwntpS89m1H/TLF0zNfzfLMV/9Wa/6MZsj0acpEjAO0KF1xT6ZdLl95w== + is-ci@^1.0.10: version "1.2.1" resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-1.2.1.tgz#e3779c8ee17fccf428488f6e281187f2e632841c" @@ -9310,6 +9564,14 @@ is-regex@^1.0.4, is-regex@^1.1.2: call-bind "^1.0.2" has-symbols "^1.0.1" +is-regex@^1.0.5, is-regex@^1.1.0, is-regex@^1.1.3: + version "1.1.4" + resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.4.tgz#eef5663cd59fa4c0ae339505323df6854bb15958" + integrity sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg== + dependencies: + call-bind "^1.0.2" + has-tostringtag "^1.0.0" + is-regexp@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-regexp/-/is-regexp-1.0.0.tgz#fd2d883545c46bac5a633e7b9a09e87fa2cb5069" @@ -9345,6 +9607,18 @@ is-string@^1.0.5: resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.5.tgz#40493ed198ef3ff477b8c7f92f644ec82a5cd3a6" integrity sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ== +is-string@^1.0.6: + version "1.0.7" + resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.7.tgz#0dd12bf2006f255bb58f695110eff7491eebc0fd" + integrity sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg== + dependencies: + has-tostringtag "^1.0.0" + +is-subset@^0.1.1: + version "0.1.1" + resolved "https://registry.yarnpkg.com/is-subset/-/is-subset-0.1.1.tgz#8a59117d932de1de00f245fcdd39ce43f1e939a6" + integrity sha1-ilkRfZMt4d4A8kX83TnOQ/HpOaY= + is-svg@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-svg/-/is-svg-3.0.0.tgz#9321dbd29c212e5ca99c4fa9794c714bcafa2f75" @@ -10752,6 +11026,11 @@ lodash.debounce@^4.0.8: resolved "https://registry.yarnpkg.com/lodash.debounce/-/lodash.debounce-4.0.8.tgz#82d79bff30a67c4005ffd5e2515300ad9ca4d7af" integrity sha1-gteb/zCmfEAF/9XiUVMArZyk168= +lodash.escape@^4.0.1: + version "4.0.1" + resolved "https://registry.yarnpkg.com/lodash.escape/-/lodash.escape-4.0.1.tgz#c9044690c21e04294beaa517712fded1fa88de98" + integrity sha1-yQRGkMIeBClL6qUXcS/e0fqI3pg= + lodash.escaperegexp@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/lodash.escaperegexp/-/lodash.escaperegexp-4.1.2.tgz#64762c48618082518ac3df4ccf5d5886dae20347" @@ -10772,6 +11051,11 @@ lodash.get@^4.4.2: resolved "https://registry.yarnpkg.com/lodash.get/-/lodash.get-4.4.2.tgz#2d177f652fa31e939b4438d5341499dfa3825e99" integrity sha1-LRd/ZS+jHpObRDjVNBSZ36OCXpk= +lodash.isequal@^4.5.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0" + integrity sha1-QVxEePK8wwEgwizhDtMib30+GOA= + lodash.ismatch@^4.4.0: version "4.4.0" resolved "https://registry.yarnpkg.com/lodash.ismatch/-/lodash.ismatch-4.4.0.tgz#756cb5150ca3ba6f11085a78849645f188f85f37" @@ -11555,6 +11839,11 @@ moment@^2.29.1: resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.1.tgz#b2be769fa31940be9eeea6469c075e35006fa3d3" integrity sha512-kHmoybcPV8Sqy59DwNDY3Jefr64lK/by/da0ViFcuA4DH0vQg5Q6Ze5VimxkfQNSC+Mls/Kx53s7TjP1RhFEDQ== +moo@^0.5.0: + version "0.5.1" + resolved "https://registry.yarnpkg.com/moo/-/moo-0.5.1.tgz#7aae7f384b9b09f620b6abf6f74ebbcd1b65dbc4" + integrity sha512-I1mnb5xn4fO80BH9BLcF0yLypy2UKl+Cb01Fu0hJRkJjlCRtxZMWkTdAtDd5ZqCOxtCkhmRwyI57vWT+1iZ67w== + move-concurrently@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92" @@ -11642,6 +11931,16 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc= +nearley@^2.7.10: + version "2.20.1" + resolved "https://registry.yarnpkg.com/nearley/-/nearley-2.20.1.tgz#246cd33eff0d012faf197ff6774d7ac78acdd474" + integrity sha512-+Mc8UaAebFzgV+KpI5n7DasuuQCHA89dmwm7JXw3TV43ukfNQ9DnBH3Mdb2g/I4Fdxc26pwimBWvjIw0UAILSQ== + dependencies: + commander "^2.19.0" + moo "^0.5.0" + railroad-diagrams "^1.0.0" + randexp "0.4.6" + negotiator@0.6.2: version "0.6.2" resolved "https://registry.yarnpkg.com/negotiator/-/negotiator-0.6.2.tgz#feacf7ccf525a77ae9634436a64883ffeca346fb" @@ -12122,6 +12421,13 @@ nth-check@^1.0.2: dependencies: boolbase "~1.0.0" +nth-check@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/nth-check/-/nth-check-2.0.0.tgz#1bb4f6dac70072fc313e8c9cd1417b5074c0a125" + integrity sha512-i4sc/Kj8htBrAiH1viZ0TgU8Y5XqCaV/FziYK6TBczxmeKm3AEFWqqF3195yKudrarqy7Zu80Ra5dobFjn9X/Q== + dependencies: + boolbase "^1.0.0" + num2fraction@^1.2.2: version "1.2.2" resolved "https://registry.yarnpkg.com/num2fraction/-/num2fraction-1.2.2.tgz#6f682b6a027a4e9ddfa4564cd2589d1d4e669ede" @@ -12192,12 +12498,17 @@ object-hash@^2.0.1: resolved "https://registry.yarnpkg.com/object-hash/-/object-hash-2.1.1.tgz#9447d0279b4fcf80cff3259bf66a1dc73afabe09" integrity sha512-VOJmgmS+7wvXf8CjbQmimtCnEx3IAoLxI3fp2fbWehxrWBcAQFbk+vcwb6vzR0VZv/eNCJ/27j151ZTwqW/JeQ== +object-inspect@^1.11.0, object-inspect@^1.7.0: + version "1.11.0" + resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.11.0.tgz#9dceb146cedd4148a0d9e51ab88d34cf509922b1" + integrity sha512-jp7ikS6Sd3GxQfZJPyH3cjcbJF6GZPClgdV+EFygjFLQ5FmW/dRUnTd9PQ9k0JhoNDabWFbpF1yCdSWCC6gexg== + object-inspect@^1.9.0: version "1.9.0" resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.9.0.tgz#c90521d74e1127b67266ded3394ad6116986533a" integrity sha512-i3Bp9iTqwhaLZBxGkRfo5ZbE07BQRT7MGu8+nNgwW9ItGp1TzCTw2DLEoWwjClxBjOFI/hWljTAmYGCEwmtnOw== -object-is@^1.0.1: +object-is@^1.0.1, object-is@^1.0.2, object-is@^1.1.2: version "1.1.5" resolved "https://registry.yarnpkg.com/object-is/-/object-is-1.1.5.tgz#b9deeaa5fc7f1846a0faecdceec138e5778f53ac" integrity sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw== @@ -12237,7 +12548,16 @@ object.entries@^1.1.0, object.entries@^1.1.1, object.entries@^1.1.3: es-abstract "^1.18.0-next.1" has "^1.0.3" -object.fromentries@^2.0.2, object.fromentries@^2.0.4: +object.entries@^1.1.2: + version "1.1.4" + resolved "https://registry.yarnpkg.com/object.entries/-/object.entries-1.1.4.tgz#43ccf9a50bc5fd5b649d45ab1a579f24e088cafd" + integrity sha512-h4LWKWE+wKQGhtMjZEBud7uLGhqyLwj8fpHOarZhD2uY3C9cRtk57VQ89ke3moByLXMedqs3XCHzyb4AmA2DjA== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + es-abstract "^1.18.2" + +object.fromentries@^2.0.2, object.fromentries@^2.0.3, object.fromentries@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/object.fromentries/-/object.fromentries-2.0.4.tgz#26e1ba5c4571c5c6f0890cef4473066456a120b8" integrity sha512-EsFBshs5RUUpQEY1D4q/m59kMfz4YJvxuNCJcv/jWwOJr34EaVnG11ZrZa0UHB3wnzV1wx8m58T4hQL8IuNXlQ== @@ -12273,6 +12593,15 @@ object.values@^1.1.0, object.values@^1.1.1, object.values@^1.1.3: es-abstract "^1.18.0-next.2" has "^1.0.3" +object.values@^1.1.2: + version "1.1.4" + resolved "https://registry.yarnpkg.com/object.values/-/object.values-1.1.4.tgz#0d273762833e816b693a637d30073e7051535b30" + integrity sha512-TnGo7j4XSnKQoK3MfvkzqKCi0nVe/D9I9IjwTNYdb/fxYHpjrluHVOgw0AF6jrRFGMPHdfuidR09tIDiIvnaSg== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + es-abstract "^1.18.2" + obuf@^1.0.0, obuf@^1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/obuf/-/obuf-1.1.2.tgz#09bea3343d41859ebd446292d11c9d4db619084e" @@ -12740,6 +13069,13 @@ parse-json@^5.0.0: json-parse-even-better-errors "^2.3.0" lines-and-columns "^1.1.6" +parse5-htmlparser2-tree-adapter@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/parse5-htmlparser2-tree-adapter/-/parse5-htmlparser2-tree-adapter-6.0.1.tgz#2cdf9ad823321140370d4dbf5d3e92c7c8ddc6e6" + integrity sha512-qPuWvbLgvDGilKc5BoicRovlT4MtYT6JfJyBOMDsKoiT+GiuP5qyrPCnR9HcPECIJJmZh5jRndyNThnhhb/vlA== + dependencies: + parse5 "^6.0.1" + parse5@4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/parse5/-/parse5-4.0.0.tgz#6d78656e3da8d78b4ec0b906f7c08ef1dfe3f608" @@ -12750,6 +13086,11 @@ parse5@5.1.0: resolved "https://registry.yarnpkg.com/parse5/-/parse5-5.1.0.tgz#c59341c9723f414c452975564c7c00a68d58acd2" integrity sha512-fxNG2sQjHvlVAYmzBZS9YlDp6PTSSDwa98vkD4QgVDDCAo84z5X1t5XyJQ62ImdLXx5NdIIfihey6xpum9/gRQ== +parse5@^6.0.1: + version "6.0.1" + resolved "https://registry.yarnpkg.com/parse5/-/parse5-6.0.1.tgz#e1a1c085c569b3dc08321184f19a39cc27f7c30b" + integrity sha512-Ofn/CTFzRGTTxwpNEs9PP93gXShHcTq255nzRYSKe8AkVpZY7e1fpmTfOyoIvjP5HG7Z2ZM7VS9PPhQGW2pOpw== + parseurl@~1.3.2, parseurl@~1.3.3: version "1.3.3" resolved "https://registry.yarnpkg.com/parseurl/-/parseurl-1.3.3.tgz#9da19e7bee8d12dff0513ed5b76957793bc2e8d4" @@ -13802,6 +14143,15 @@ promzard@^0.3.0: dependencies: read "1" +prop-types-exact@^1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/prop-types-exact/-/prop-types-exact-1.2.0.tgz#825d6be46094663848237e3925a98c6e944e9869" + integrity sha512-K+Tk3Kd9V0odiXFP9fwDHUYRyvK3Nun3GVyPapSIs5OBkITAm15W0CPFD/YKTkMUAbc0b9CUwRQp2ybiBIq+eA== + dependencies: + has "^1.0.3" + object.assign "^4.1.0" + reflect.ownkeys "^0.2.0" + prop-types@15.7.2, prop-types@^15.5.8, prop-types@^15.6.1, prop-types@^15.6.2, prop-types@^15.7.2: version "15.7.2" resolved "https://registry.yarnpkg.com/prop-types/-/prop-types-15.7.2.tgz#52c41e75b8c87e72b9d9360e0206b99dcbffa6c5" @@ -13994,11 +14344,24 @@ raf@^3.3.0, raf@^3.4.1: dependencies: performance-now "^2.1.0" +railroad-diagrams@^1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/railroad-diagrams/-/railroad-diagrams-1.0.0.tgz#eb7e6267548ddedfb899c1b90e57374559cddb7e" + integrity sha1-635iZ1SN3t+4mcG5Dlc3RVnN234= + ramda@^0.27.1, ramda@~0.27.1: version "0.27.1" resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.27.1.tgz#66fc2df3ef873874ffc2da6aa8984658abacf5c9" integrity sha512-PgIdVpn5y5Yns8vqb8FzBUEYn98V3xcPgawAkkgj0YJ0qDsnHCiNmZYfOGMgOvoB0eWFLpYbhxUR3mxfDIMvpw== +randexp@0.4.6: + version "0.4.6" + resolved "https://registry.yarnpkg.com/randexp/-/randexp-0.4.6.tgz#e986ad5e5e31dae13ddd6f7b3019aa7c87f60ca3" + integrity sha512-80WNmd9DA0tmZrw9qQa62GPPWfuXJknrmVmLcxvq4uZBdYqb1wYoKTmnlGUchvVWe0XiLupYkBoXVOxz3C8DYQ== + dependencies: + discontinuous-range "1.0.0" + ret "~0.1.10" + randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5, randombytes@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" @@ -14180,7 +14543,7 @@ react-icons@^3.8.0: dependencies: camelcase "^5.0.0" -react-is@^16.12.0, react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4: +react-is@^16.12.0, react-is@^16.13.1, react-is@^16.7.0, react-is@^16.8.1, react-is@^16.8.4, react-is@^16.8.6: version "16.13.1" resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4" integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ== @@ -14335,6 +14698,16 @@ react-styleguidist@^10.6.2: webpack-dev-server "^3.9.0" webpack-merge "^4.2.2" +react-test-renderer@^16.0.0-0: + version "16.14.0" + resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-16.14.0.tgz#e98360087348e260c56d4fe2315e970480c228ae" + integrity sha512-L8yPjqPE5CZO6rKsKXRO/rVPiaCOy0tQQJbC+UjPNlobl5mad59lvPjwFsQHTvL03caVDIVr9x9/OSgDe6I5Eg== + dependencies: + object-assign "^4.1.1" + prop-types "^15.6.2" + react-is "^16.8.6" + scheduler "^0.19.1" + react-transition-group@^4.4.0: version "4.4.1" resolved "https://registry.yarnpkg.com/react-transition-group/-/react-transition-group-4.4.1.tgz#63868f9325a38ea5ee9535d828327f85773345c9" @@ -14568,6 +14941,11 @@ redeyed@~2.1.0: dependencies: esprima "~4.0.0" +reflect.ownkeys@^0.2.0: + version "0.2.0" + resolved "https://registry.yarnpkg.com/reflect.ownkeys/-/reflect.ownkeys-0.2.0.tgz#749aceec7f3fdf8b63f927a04809e90c5c0b3460" + integrity sha1-dJrO7H8/34tj+SegSAnpDFwLNGA= + regenerate-unicode-properties@^8.2.0: version "8.2.0" resolved "https://registry.yarnpkg.com/regenerate-unicode-properties/-/regenerate-unicode-properties-8.2.0.tgz#e5de7111d655e7ba60c057dbe9ff37c87e65cdec" @@ -15048,6 +15426,14 @@ ripemd160@^2.0.0, ripemd160@^2.0.1: hash-base "^3.0.0" inherits "^2.0.1" +rst-selector-parser@^2.2.3: + version "2.2.3" + resolved "https://registry.yarnpkg.com/rst-selector-parser/-/rst-selector-parser-2.2.3.tgz#81b230ea2fcc6066c89e3472de794285d9b03d91" + integrity sha1-gbIw6i/MYGbInjRy3nlChdmwPZE= + dependencies: + lodash.flattendeep "^4.4.0" + nearley "^2.7.10" + rsvp@^4.8.4: version "4.8.5" resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-4.8.5.tgz#c8f155311d167f68f21e168df71ec5b083113734" @@ -15157,6 +15543,14 @@ scheduler@^0.17.0: loose-envify "^1.1.0" object-assign "^4.1.1" +scheduler@^0.19.1: + version "0.19.1" + resolved "https://registry.yarnpkg.com/scheduler/-/scheduler-0.19.1.tgz#4f3e2ed2c1a7d65681f4c854fa8c5a1ccb40f196" + integrity sha512-n/zwRWRYSUj0/3g/otKDRPMh6qv2SYMWNq85IEa8iZyAv8od9zDYpGSnpBEjNgcMNq6Scbu5KfIPxNF72R/2EA== + dependencies: + loose-envify "^1.1.0" + object-assign "^4.1.1" + schema-utils@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-1.0.0.tgz#0b79a93204d7b600d4b2850d1f66c2a34951c770" @@ -15236,7 +15630,7 @@ semver-regex@^2.0.0: resolved "https://registry.yarnpkg.com/semver-regex/-/semver-regex-2.0.0.tgz#a93c2c5844539a770233379107b38c7b4ac9d338" integrity sha512-mUdIBBvdn0PLOeP3TEkMH7HHeUP3GjsXCwKarjv/kGmUFOYg1VqEemKhoQpWMu6X2I8kHeuVdGibLGkVK+/5Qw== -"semver@2 || 3 || 4 || 5", "semver@2.x || 3.x || 4 || 5", "semver@^2.3.0 || 3.x || 4 || 5", semver@^5.0.3, semver@^5.1.0, semver@^5.4.1, semver@^5.5, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0, semver@^5.7.1: +"semver@2 || 3 || 4 || 5", "semver@2.x || 3.x || 4 || 5", "semver@^2.3.0 || 3.x || 4 || 5", semver@^5.0.3, semver@^5.1.0, semver@^5.4.1, semver@^5.5, semver@^5.5.0, semver@^5.5.1, semver@^5.6.0, semver@^5.7.0, semver@^5.7.1: version "5.7.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" integrity sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ== @@ -16044,6 +16438,15 @@ string.prototype.matchall@^4.0.2, string.prototype.matchall@^4.0.4: regexp.prototype.flags "^1.3.1" side-channel "^1.0.4" +string.prototype.trim@^1.2.1: + version "1.2.4" + resolved "https://registry.yarnpkg.com/string.prototype.trim/-/string.prototype.trim-1.2.4.tgz#6014689baf5efaf106ad031a5fa45157666ed1bd" + integrity sha512-hWCk/iqf7lp0/AgTF7/ddO1IWtSNPASjlzCicV5irAVdE1grjsneK26YG6xACMBEdCvO8fUST0UzDMh/2Qy+9Q== + dependencies: + call-bind "^1.0.2" + define-properties "^1.1.3" + es-abstract "^1.18.0-next.2" + string.prototype.trimend@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.4.tgz#e75ae90c2942c63504686c18b287b4a0b1a45f80" @@ -16715,6 +17118,11 @@ tslib@^2.0.1, tslib@^2.0.3: resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.1.0.tgz#da60860f1c2ecaa5703ab7d39bc05b6bf988b97a" integrity sha512-hcVC3wYEziELGGmEEXue7D75zbwIIVUMWAVbHItGPx0ziyXxrOMQx4rQEVEV45Ut/1IotuEvwqPopzIOkDMf0A== +tslib@^2.2.0: + version "2.3.1" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.3.1.tgz#e8a335add5ceae51aa261d32a490158ef042ef01" + integrity sha512-77EbyPPpMz+FRFRuAFlWMtmgUWGe9UOG2Z25NqCwiIjRhOf5iKGuzSe5P2w1laq+FkRy4p+PCuVkJSGkzTEKVw== + tsutils@^3.17.1: version "3.21.0" resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623" @@ -16853,7 +17261,7 @@ umd@^3.0.0: resolved "https://registry.yarnpkg.com/umd/-/umd-3.0.3.tgz#aa9fe653c42b9097678489c01000acb69f0b26cf" integrity sha512-4IcGSufhFshvLNcMCV80UnQVlZ5pMOC8mvNPForqwA4+lzYQuetTESLDQkeLmihq8bRcnpbQa48Wb8Lh16/xow== -unbox-primitive@^1.0.0: +unbox-primitive@^1.0.0, unbox-primitive@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/unbox-primitive/-/unbox-primitive-1.0.1.tgz#085e215625ec3162574dc8859abee78a59b14471" integrity sha512-tZU/3NqK3dA5gpE1KtyiJUrEB0lxnGkMFHptJ7q6ewdZ8s12QrODwNbhIJStmJkd1QDXa1NRA8aF2A1zk/Ypyw== From b7b096070677a53c889670372d43cf982af32072 Mon Sep 17 00:00:00 2001 From: rady-ben Date: Sun, 5 Sep 2021 07:02:58 +0100 Subject: [PATCH 03/18] remove unused componenent --- __mocks__/App.test.js | 1 - 1 file changed, 1 deletion(-) diff --git a/__mocks__/App.test.js b/__mocks__/App.test.js index 1e73a091..827265de 100644 --- a/__mocks__/App.test.js +++ b/__mocks__/App.test.js @@ -2,7 +2,6 @@ import React from "react"; import Enzyme, {shallow} from 'enzyme'; import Adapter from 'enzyme-adapter-react-16'; import FileForm from '../src/components/file/FileForm'; -FileForm Enzyme.configure({ adapter: new Adapter(), From 75f927e3b3f8fff4b7869a97c34781006721f427 Mon Sep 17 00:00:00 2001 From: rady-ben Date: Mon, 6 Sep 2021 01:13:37 +0100 Subject: [PATCH 04/18] test the render of the element inside FileForm component --- __mocks__/App.test.js | 15 ----------- __mocks__/FileForm.test.js | 46 +++++++++++++++++++++++++++++++++ src/components/file/FileForm.js | 11 ++++++-- 3 files changed, 55 insertions(+), 17 deletions(-) delete mode 100644 __mocks__/App.test.js create mode 100644 __mocks__/FileForm.test.js diff --git a/__mocks__/App.test.js b/__mocks__/App.test.js deleted file mode 100644 index 827265de..00000000 --- a/__mocks__/App.test.js +++ /dev/null @@ -1,15 +0,0 @@ -import React from "react"; -import Enzyme, {shallow} from 'enzyme'; -import Adapter from 'enzyme-adapter-react-16'; -import FileForm from '../src/components/file/FileForm'; - -Enzyme.configure({ - adapter: new Adapter(), -}) - -test('render without error', () => { - const wrapper = shallow({}} - />); -}); \ No newline at end of file diff --git a/__mocks__/FileForm.test.js b/__mocks__/FileForm.test.js new file mode 100644 index 00000000..bfcb4cbb --- /dev/null +++ b/__mocks__/FileForm.test.js @@ -0,0 +1,46 @@ +import React from "react"; +import Enzyme, {shallow} from 'enzyme'; +import Adapter from 'enzyme-adapter-react-16'; +import FileForm from '../src/components/file/FileForm'; + +Enzyme.configure({ + adapter: new Adapter(), +}); + +const setupWrapper = () => shallow( { }} + branch="branch" +/>) + +const findByAttribute = (wrapper, attribute) => wrapper.find(`[data-test='${attribute}']`) + +test('render fileForm', () => { + const wrapper = setupWrapper(); + const fileForm = findByAttribute(wrapper, 'component-fileForm'); + expect(fileForm.length).toBe(1); +}); + +test('render branch-textField', () => { + const wrapper = setupWrapper(); + const branch = findByAttribute(wrapper, 'branch-textField'); + expect(branch.length).toBe(1); +}); + +test('render filepath-textField', () => { + const wrapper = setupWrapper(); + const filepath = findByAttribute(wrapper, 'filepath-textField'); + expect(filepath.length).toBe(1); +}); + +test('render defaultContent-textField', () => { + const wrapper = setupWrapper(); + const defaultContent = findByAttribute(wrapper, 'defaultContent-textField'); + expect(defaultContent.length).toBe(1); +}); + +test('render submit-button', () => { + const wrapper = setupWrapper(); + const submit = findByAttribute(wrapper, 'submit-button'); + expect(submit.length).toBe(1); +}); \ No newline at end of file diff --git a/src/components/file/FileForm.js b/src/components/file/FileForm.js index 040e18c8..36c3f64d 100644 --- a/src/components/file/FileForm.js +++ b/src/components/file/FileForm.js @@ -17,28 +17,35 @@ function FileForm({ const disabled = !(filepath); return ( - +
setBranch(e.target.value)} + data-test="branch-textField" /> setFilepath(e.target.value)} + data-test="filepath-textField" /> setDefaultContent(e.target.value)} + data-test="defaultContent-textField" /> From c05a2ec548a2405db794ac7718f25be902ee01b4 Mon Sep 17 00:00:00 2001 From: rady-ben Date: Wed, 8 Sep 2021 00:23:16 +0100 Subject: [PATCH 05/18] add propTypes tests --- __mocks__/FileForm.test.js | 17 +++++++++++++++-- package.json | 1 + src/components/file/FileForm.js | 3 +++ yarn.lock | 5 +++++ 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/__mocks__/FileForm.test.js b/__mocks__/FileForm.test.js index bfcb4cbb..8dbbd6d8 100644 --- a/__mocks__/FileForm.test.js +++ b/__mocks__/FileForm.test.js @@ -1,6 +1,7 @@ import React from "react"; import Enzyme, {shallow} from 'enzyme'; import Adapter from 'enzyme-adapter-react-16'; +import checkPropTypes from 'check-prop-types'; import FileForm from '../src/components/file/FileForm'; Enzyme.configure({ @@ -8,13 +9,12 @@ Enzyme.configure({ }); const setupWrapper = () => shallow( { }} - branch="branch" />) const findByAttribute = (wrapper, attribute) => wrapper.find(`[data-test='${attribute}']`) +// render tests test('render fileForm', () => { const wrapper = setupWrapper(); const fileForm = findByAttribute(wrapper, 'component-fileForm'); @@ -43,4 +43,17 @@ test('render submit-button', () => { const wrapper = setupWrapper(); const submit = findByAttribute(wrapper, 'submit-button'); expect(submit.length).toBe(1); +}); + +// PropTypes tests +test('PropTypes', () => { + const expectedProps = { + submitText: "text", + onSubmit: () => {}, + branch: 'branch', + filepath: 'filepath', + defaultContent: 'defaultContent', + } + let propError = checkPropTypes(FileForm.propTypes, expectedProps, 'prop', FileForm.name); + expect(propError).toBeUndefined(); }); \ No newline at end of file diff --git a/package.json b/package.json index f4c4e0d1..b6b074bc 100644 --- a/package.json +++ b/package.json @@ -67,6 +67,7 @@ "babel-jest": "24.9.0", "babel-loader": "^8.0.6", "babel-plugin-istanbul": "6.0.0", + "check-prop-types": "^1.1.2", "coveralls": "3.0.7", "cypress": "^6.8.0", "enzyme": "^3.11.0", diff --git a/src/components/file/FileForm.js b/src/components/file/FileForm.js index 36c3f64d..cb5e1a9d 100644 --- a/src/components/file/FileForm.js +++ b/src/components/file/FileForm.js @@ -59,6 +59,9 @@ FileForm.propTypes = { submitText: PropTypes.string, /** Function run when submit button is clicked */ onSubmit: PropTypes.func.isRequired, + branch: PropTypes.string, + filepath: PropTypes.string, + defaultContent: PropTypes.string, }; FileForm.defaultProps = { submitText: 'Submit' }; diff --git a/yarn.lock b/yarn.lock index a488bf66..15ed1912 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4549,6 +4549,11 @@ check-more-types@2.24.0, check-more-types@^2.24.0: resolved "https://registry.yarnpkg.com/check-more-types/-/check-more-types-2.24.0.tgz#1420ffb10fd444dcfc79b43891bbfffd32a84600" integrity sha1-FCD/sQ/URNz8ebQ4kbv//TKoRgA= +check-prop-types@^1.1.2: + version "1.1.2" + resolved "https://registry.yarnpkg.com/check-prop-types/-/check-prop-types-1.1.2.tgz#c42df4fbdb509fbd4d8a102d113bb0ca01c21e67" + integrity sha512-hGDrZ1yhRgKuP1yzZ5sUX/PPmlKBLOF1GyF0Z008Sienko3BFZmlCXnmq+npRTIL/WlFCUzThyd+F5PQnnT1ug== + cheerio-select@^1.5.0: version "1.5.0" resolved "https://registry.yarnpkg.com/cheerio-select/-/cheerio-select-1.5.0.tgz#faf3daeb31b17c5e1a9dabcee288aaf8aafa5823" From dfb0c789e9369cda6cdf9aecee24644a66b07c5e Mon Sep 17 00:00:00 2001 From: rady-ben Date: Wed, 8 Sep 2021 01:02:57 +0100 Subject: [PATCH 06/18] add default propos --- __mocks__/FileForm.test.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/__mocks__/FileForm.test.js b/__mocks__/FileForm.test.js index 8dbbd6d8..77057362 100644 --- a/__mocks__/FileForm.test.js +++ b/__mocks__/FileForm.test.js @@ -8,9 +8,12 @@ Enzyme.configure({ adapter: new Adapter(), }); -const setupWrapper = () => shallow( { }} -/>) +const defaultProps = { onSubmit: () => {} } + +const setupWrapper = (props = {}) => { + const setupProps = {...defaultProps, ...props} + return shallow() +} const findByAttribute = (wrapper, attribute) => wrapper.find(`[data-test='${attribute}']`) From 24846a93830d8140c2b336e7e1a20e50e4ceb02f Mon Sep 17 00:00:00 2001 From: rady-ben Date: Wed, 8 Sep 2021 02:47:20 +0100 Subject: [PATCH 07/18] add text input behaviour tests --- __mocks__/FileForm.test.js | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/__mocks__/FileForm.test.js b/__mocks__/FileForm.test.js index 77057362..8779461b 100644 --- a/__mocks__/FileForm.test.js +++ b/__mocks__/FileForm.test.js @@ -15,6 +15,13 @@ const setupWrapper = (props = {}) => { return shallow() } +const mockSetBranch = jest.fn(); + +jest.mock('react', () => ({ + ...jest.requireActual('react'), + useState: (initialState) => [initialState, mockSetBranch] +})) + const findByAttribute = (wrapper, attribute) => wrapper.find(`[data-test='${attribute}']`) // render tests @@ -59,4 +66,32 @@ test('PropTypes', () => { } let propError = checkPropTypes(FileForm.propTypes, expectedProps, 'prop', FileForm.name); expect(propError).toBeUndefined(); -}); \ No newline at end of file +}); + + +// input text +describe('text input change',() => { + test('update the state with the input value of branch', () => { + const wrapper = setupWrapper(); + const textField = findByAttribute(wrapper, 'branch-textField'); + const mockEvent = { target: { value: 'branch' } }; + textField.simulate('change', mockEvent); + expect(mockSetBranch).toBeCalledWith('branch') + }); + + test('update the state with the input value of filepath', () => { + const wrapper = setupWrapper(); + const textField = findByAttribute(wrapper, 'filepath-textField'); + const mockEvent = { target: { value: 'filepath' } }; + textField.simulate('change', mockEvent); + expect(mockSetBranch).toBeCalledWith('filepath') + }); + + test('update the state with the input value of defaultContent', () => { + const wrapper = setupWrapper(); + const textField = findByAttribute(wrapper, 'defaultContent-textField'); + const mockEvent = { target: { value: 'defaultContent' } }; + textField.simulate('change', mockEvent); + expect(mockSetBranch).toBeCalledWith('defaultContent') + }); +}) \ No newline at end of file From 2ffcbde0162885d42ef6880b9139e302a6b05e72 Mon Sep 17 00:00:00 2001 From: rady-ben Date: Thu, 9 Sep 2021 18:58:18 +0100 Subject: [PATCH 08/18] refractor the Enzyme utils in separate file to not repeat the config in each test fine --- __mocks__/FileForm.test.js | 69 +++++++++++++++++++------------------- __mocks__/testUtils.js | 12 +++++++ 2 files changed, 46 insertions(+), 35 deletions(-) create mode 100644 __mocks__/testUtils.js diff --git a/__mocks__/FileForm.test.js b/__mocks__/FileForm.test.js index 8779461b..25e5ae8a 100644 --- a/__mocks__/FileForm.test.js +++ b/__mocks__/FileForm.test.js @@ -1,8 +1,8 @@ import React from "react"; import Enzyme, {shallow} from 'enzyme'; import Adapter from 'enzyme-adapter-react-16'; -import checkPropTypes from 'check-prop-types'; import FileForm from '../src/components/file/FileForm'; +import { findByAttribute, checkProps } from './testUtils'; Enzyme.configure({ adapter: new Adapter(), @@ -22,50 +22,49 @@ jest.mock('react', () => ({ useState: (initialState) => [initialState, mockSetBranch] })) -const findByAttribute = (wrapper, attribute) => wrapper.find(`[data-test='${attribute}']`) - // render tests -test('render fileForm', () => { - const wrapper = setupWrapper(); - const fileForm = findByAttribute(wrapper, 'component-fileForm'); - expect(fileForm.length).toBe(1); -}); - -test('render branch-textField', () => { - const wrapper = setupWrapper(); - const branch = findByAttribute(wrapper, 'branch-textField'); - expect(branch.length).toBe(1); -}); - -test('render filepath-textField', () => { - const wrapper = setupWrapper(); - const filepath = findByAttribute(wrapper, 'filepath-textField'); - expect(filepath.length).toBe(1); -}); - -test('render defaultContent-textField', () => { - const wrapper = setupWrapper(); - const defaultContent = findByAttribute(wrapper, 'defaultContent-textField'); - expect(defaultContent.length).toBe(1); -}); - -test('render submit-button', () => { - const wrapper = setupWrapper(); - const submit = findByAttribute(wrapper, 'submit-button'); - expect(submit.length).toBe(1); +describe('render fileForm elements',() => { + test('render fileForm', () => { + const wrapper = setupWrapper(); + const fileForm = findByAttribute(wrapper, 'component-fileForm'); + expect(fileForm.length).toBe(1); + }); + + test('render branch-textField', () => { + const wrapper = setupWrapper(); + const branch = findByAttribute(wrapper, 'branch-textField'); + expect(branch.length).toBe(1); + }); + + test('render filepath-textField', () => { + const wrapper = setupWrapper(); + const filepath = findByAttribute(wrapper, 'filepath-textField'); + expect(filepath.length).toBe(1); + }); + + test('render defaultContent-textField', () => { + const wrapper = setupWrapper(); + const defaultContent = findByAttribute(wrapper, 'defaultContent-textField'); + expect(defaultContent.length).toBe(1); + }); + + test('render submit-button', () => { + const wrapper = setupWrapper(); + const submit = findByAttribute(wrapper, 'submit-button'); + expect(submit.length).toBe(1); + }); }); // PropTypes tests -test('PropTypes', () => { - const expectedProps = { +test('FileForm PropTypes', () => { + const conformingProps = { submitText: "text", onSubmit: () => {}, branch: 'branch', filepath: 'filepath', defaultContent: 'defaultContent', } - let propError = checkPropTypes(FileForm.propTypes, expectedProps, 'prop', FileForm.name); - expect(propError).toBeUndefined(); + checkProps(FileForm, conformingProps) }); diff --git a/__mocks__/testUtils.js b/__mocks__/testUtils.js new file mode 100644 index 00000000..8f353d68 --- /dev/null +++ b/__mocks__/testUtils.js @@ -0,0 +1,12 @@ +import checkPropTypes from 'check-prop-types'; + +export const findByAttribute = (wrapper, attribute) => wrapper.find(`[data-test='${attribute}']`) + +export const checkProps = (component, conformingProps) => { + const propError = checkPropTypes( + component.propTypes, + conformingProps, + 'prop', + component.name); + expect(propError).toBeUndefined(); +} \ No newline at end of file From 6390bb4b4c27945088e47ff6adb76c24b7f81148 Mon Sep 17 00:00:00 2001 From: rady-ben Date: Thu, 9 Sep 2021 23:49:29 +0100 Subject: [PATCH 09/18] add some messing propTypes to FileCard --- src/components/file/FileCard.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/components/file/FileCard.js b/src/components/file/FileCard.js index 7e6a965d..2875f26a 100644 --- a/src/components/file/FileCard.js +++ b/src/components/file/FileCard.js @@ -106,6 +106,11 @@ FileCard.propTypes = { }), name: PropTypes.string.isRequired, avatar_url: PropTypes.string, + permissions: PropTypes.shape({ + push: PropTypes.bool, + }).isRequired, + full_name: PropTypes.string.isRequired, + default_branch: PropTypes.string.isRequired, }).isRequired, /** Pass a previously returned file object to bypass the selection. */ file: PropTypes.shape({ @@ -115,6 +120,9 @@ FileCard.propTypes = { content: PropTypes.string, branch: PropTypes.string, filepath: PropTypes.string, + save: PropTypes.func.isRequired, + dangerouslyDelete: PropTypes.func.isRequired, + close: PropTypes.func.isRequired }), /** Pass a previously returned authentication object to bypass login. */ authentication: PropTypes.shape({ From 99bf78d1bb63a4b7528c0a0fb23b161a56da046c Mon Sep 17 00:00:00 2001 From: rady-ben Date: Fri, 10 Sep 2021 01:43:49 +0100 Subject: [PATCH 10/18] replace the authentication props by is authenticated --- src/components/file/FileCard.js | 10 +++------- src/components/file/useFile.js | 2 +- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/components/file/FileCard.js b/src/components/file/FileCard.js index 2875f26a..68a6e583 100644 --- a/src/components/file/FileCard.js +++ b/src/components/file/FileCard.js @@ -22,7 +22,7 @@ const useStyles = makeStyles(theme => ({ })); function FileCard({ - authentication, + isAuthenticated, repository, file, }) { @@ -52,7 +52,7 @@ function FileCard({ preview={preview} markdown={markdown} onEdit={setMarkdown} - editable={!!authentication} + editable={isAuthenticated} /> @@ -125,11 +125,7 @@ FileCard.propTypes = { close: PropTypes.func.isRequired }), /** Pass a previously returned authentication object to bypass login. */ - authentication: PropTypes.shape({ - user: PropTypes.object.isRequired, - token: PropTypes.object.isRequired, - config: PropTypes.object.isRequired, - }), + isAuthenticated: PropTypes.bool, }; export default FileCard; diff --git a/src/components/file/useFile.js b/src/components/file/useFile.js index 121d3963..91ef6a97 100644 --- a/src/components/file/useFile.js +++ b/src/components/file/useFile.js @@ -187,7 +187,7 @@ function useFile({ browse: repository && blobComponents.browse, fileCard: repository && file && ( From afbd3d70193523b8f919887f539a3bd750865473 Mon Sep 17 00:00:00 2001 From: rady-ben Date: Fri, 10 Sep 2021 12:03:33 +0100 Subject: [PATCH 11/18] add the render tests fot the FileCard --- __mocks__/FileCard.test.js | 91 +++++++++++++++++++++++++++++++++ src/components/file/FileCard.js | 16 +++++- 2 files changed, 105 insertions(+), 2 deletions(-) create mode 100644 __mocks__/FileCard.test.js diff --git a/__mocks__/FileCard.test.js b/__mocks__/FileCard.test.js new file mode 100644 index 00000000..d1b746bd --- /dev/null +++ b/__mocks__/FileCard.test.js @@ -0,0 +1,91 @@ +import React from "react"; +import Enzyme, {shallow} from 'enzyme'; +import Adapter from 'enzyme-adapter-react-16'; +import FileCard from '../src/components/file/FileCard'; +import { findByAttribute, checkProps } from './testUtils'; + +Enzyme.configure({ + adapter: new Adapter(), +}); + +const defaultProps = { + repository: { + owner: { + username: 'username', + avatar_url: 'avatar_url', + }, + name: 'name', + avatar_url: 'avatar_url', + permissions: { + push: true, + }, + full_name: 'full_name', + default_branch: 'default_branch' + }, + file:{ + name: 'file.name', + path: 'file.path', + sha: 'file.sha', + content: 'file.content', + branch: 'file.branch', + filepath: 'filepath', + save: () => {}, + dangerouslyDelete: () => {}, + close: () => {} + }, + authentication: { + user: 'user', + token: 'token', + config: 'config', + } +} + +const setupWrapper = (props = {}) => { + const setupProps = {...defaultProps, ...props} + return shallow() +} + +// render tests +describe('render fileCard elements',() => { + test('render fileCard', () => { + const wrapper = setupWrapper(); + const fileCard = findByAttribute(wrapper, 'component-fileCard'); + expect(fileCard.length).toBe(1); + }); + + test('render cardHeader', () => { + const wrapper = setupWrapper(); + const cardHeader = findByAttribute(wrapper, 'cardHeader'); + expect(cardHeader.length).toBe(1); + }); + + test('render blockEditable', () => { + const wrapper = setupWrapper(); + const blockEditable = findByAttribute(wrapper, 'blockEditable'); + expect(blockEditable.length).toBe(1); + }); + + test('render previewButton', () => { + const wrapper = setupWrapper(); + const previewButton = findByAttribute(wrapper, 'previewButton'); + expect(previewButton.length).toBe(1); + }); + + test('render saveButton', () => { + const wrapper = setupWrapper(); + const saveButton = findByAttribute(wrapper, 'saveButton'); + expect(saveButton.length).toBe(1); + }); + + test('render deleteButton', () => { + const wrapper = setupWrapper(); + const deleteButton = findByAttribute(wrapper, 'deleteButton'); + expect(deleteButton.length).toBe(1); + }); + + test('render closeButton', () => { + const wrapper = setupWrapper(); + const closeButton = findByAttribute(wrapper, 'closeButton'); + expect(closeButton.length).toBe(1); + }); +}); \ No newline at end of file diff --git a/src/components/file/FileCard.js b/src/components/file/FileCard.js index 68a6e583..72708faf 100644 --- a/src/components/file/FileCard.js +++ b/src/components/file/FileCard.js @@ -40,11 +40,14 @@ function FileCard({ const branch = (file && file.branch) ? file.branch : repository.default_branch; return ( - + } title={{file && file.path}} subheader={repository.full_name + '/' + branch} + data-test="cardHeader" /> @@ -53,12 +56,18 @@ function FileCard({ markdown={markdown} onEdit={setMarkdown} editable={isAuthenticated} + data-test="blockEditable" />
- setPreview(!preview)}> + setPreview(!preview)} + data-test="previewButton" + > {!preview ? : } { if (changed) file.save(markdown); }} + data-test="saveButton" > {changed ? : } @@ -82,12 +92,14 @@ function FileCard({ if (confirmation) file.dangerouslyDelete(); }} + data-test="deleteButton" > From b9e0e770fc214f462012264cdb851bec52e65b61 Mon Sep 17 00:00:00 2001 From: rady-ben Date: Fri, 10 Sep 2021 12:32:23 +0100 Subject: [PATCH 12/18] add prop types test for theFileCard --- __mocks__/FileCard.test.js | 37 ++++++++++++++++++++++++++++++++----- 1 file changed, 32 insertions(+), 5 deletions(-) diff --git a/__mocks__/FileCard.test.js b/__mocks__/FileCard.test.js index d1b746bd..3489df16 100644 --- a/__mocks__/FileCard.test.js +++ b/__mocks__/FileCard.test.js @@ -33,11 +33,7 @@ const defaultProps = { dangerouslyDelete: () => {}, close: () => {} }, - authentication: { - user: 'user', - token: 'token', - config: 'config', - } + isAuthenticated: true } const setupWrapper = (props = {}) => { @@ -45,6 +41,37 @@ const setupWrapper = (props = {}) => { return shallow() } +test('FileForm PropTypes', () => { + const conformingProps = { + repository: { + owner: { + username: 'username', + avatar_url: 'avatar_url', + }, + name: 'name', + avatar_url: 'avatar_url', + permissions: { + push: true, + }, + full_name: 'full_name', + default_branch: 'default_branch' + }, + file:{ + name: 'file.name', + path: 'file.path', + sha: 'file.sha', + content: 'file.content', + branch: 'file.branch', + filepath: 'filepath', + save: () => {}, + dangerouslyDelete: () => {}, + close: () => {} + }, + isAuthenticated: true, + } + checkProps(FileCard, conformingProps); +}); + // render tests describe('render fileCard elements',() => { test('render fileCard', () => { From 6a0dd50129bd2818a07241c10dbee54a52bd396e Mon Sep 17 00:00:00 2001 From: rady-ben Date: Sat, 11 Sep 2021 00:35:54 +0100 Subject: [PATCH 13/18] add unit test for the useState on FileCard --- __mocks__/FileCard.test.js | 17 +++++++++++++++++ src/components/file/FileCard.js | 1 + 2 files changed, 18 insertions(+) diff --git a/__mocks__/FileCard.test.js b/__mocks__/FileCard.test.js index 3489df16..0ef6d289 100644 --- a/__mocks__/FileCard.test.js +++ b/__mocks__/FileCard.test.js @@ -41,6 +41,13 @@ const setupWrapper = (props = {}) => { return shallow() } +const mockSetPreview = jest.fn(); + +jest.mock('react', () => ({ + ...jest.requireActual('react'), + useState: (initialState) => [initialState, mockSetPreview] +})) + test('FileForm PropTypes', () => { const conformingProps = { repository: { @@ -115,4 +122,14 @@ describe('render fileCard elements',() => { const closeButton = findByAttribute(wrapper, 'closeButton'); expect(closeButton.length).toBe(1); }); +}); + +test('switch the preview state', () => { + const wrapper = setupWrapper(); + const blockEditable = findByAttribute(wrapper, 'blockEditable'); + expect(blockEditable.props().preview).toBeTruthy(); + const previewButton = findByAttribute(wrapper, 'previewButton'); + previewButton.simulate('click'); + expect(mockSetPreview).toBeCalledWith(false); + // NEED HELP }); \ No newline at end of file diff --git a/src/components/file/FileCard.js b/src/components/file/FileCard.js index 72708faf..9f82cc04 100644 --- a/src/components/file/FileCard.js +++ b/src/components/file/FileCard.js @@ -54,6 +54,7 @@ function FileCard({ Date: Mon, 13 Sep 2021 01:54:44 +0100 Subject: [PATCH 14/18] use deferents initials states on jest tests --- __mocks__/FileCard.test.js | 20 ++++++++++++-------- src/components/file/FileCard.js | 9 ++++----- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/__mocks__/FileCard.test.js b/__mocks__/FileCard.test.js index 0ef6d289..4f05c6e7 100644 --- a/__mocks__/FileCard.test.js +++ b/__mocks__/FileCard.test.js @@ -41,12 +41,6 @@ const setupWrapper = (props = {}) => { return shallow() } -const mockSetPreview = jest.fn(); - -jest.mock('react', () => ({ - ...jest.requireActual('react'), - useState: (initialState) => [initialState, mockSetPreview] -})) test('FileForm PropTypes', () => { const conformingProps = { @@ -124,12 +118,22 @@ describe('render fileCard elements',() => { }); }); -test('switch the preview state', () => { +test('switch the preview state from true to false', () => { + const mockSetPreview = jest.fn(); + jest.spyOn(React, 'useState').mockImplementation(() => [true, mockSetPreview]) const wrapper = setupWrapper(); const blockEditable = findByAttribute(wrapper, 'blockEditable'); expect(blockEditable.props().preview).toBeTruthy(); const previewButton = findByAttribute(wrapper, 'previewButton'); previewButton.simulate('click'); expect(mockSetPreview).toBeCalledWith(false); - // NEED HELP +}); + +test('switch the preview state from false to true', () => { + const mockSetPreview = jest.fn(); + jest.spyOn(React, 'useState').mockImplementation(() => [false, mockSetPreview]) + const wrapper = setupWrapper(); + const previewButton = findByAttribute(wrapper, 'previewButton'); + previewButton.simulate('click'); + expect(mockSetPreview).toBeCalledWith(true); }); \ No newline at end of file diff --git a/src/components/file/FileCard.js b/src/components/file/FileCard.js index 9f82cc04..66ebf539 100644 --- a/src/components/file/FileCard.js +++ b/src/components/file/FileCard.js @@ -1,5 +1,5 @@ /* eslint-disable camelcase */ -import React, { useState, useEffect } from 'react'; +import React, { useEffect } from 'react'; import PropTypes from 'prop-types'; import { makeStyles } from '@material-ui/core/styles'; import { @@ -27,14 +27,14 @@ function FileCard({ file, }) { const classes = useStyles(); - const [preview, setPreview] = useState(true); - const [markdown, setMarkdown] = useState(file ? file.content : ''); + const [preview, setPreview] = React.useState(true); + const [markdown, setMarkdown] = React.useState(''); const changed = (markdown !== (file && file.content)); const avatarUrl = repository.avatar_url || repository.owner.avatar_url; const access = repository.permissions.push; useEffect(() => { - setMarkdown(file && file.content); + setMarkdown(file && file.content ? file.content : ''); }, [file]); const branch = (file && file.branch) ? file.branch : repository.default_branch; @@ -54,7 +54,6 @@ function FileCard({ Date: Tue, 14 Sep 2021 01:36:24 +0100 Subject: [PATCH 15/18] allow useing the destructuring import of useState without breaking tests --- __mocks__/FileCard.test.js | 111 +++++++------------------------- src/components/file/FileCard.js | 6 +- 2 files changed, 25 insertions(+), 92 deletions(-) diff --git a/__mocks__/FileCard.test.js b/__mocks__/FileCard.test.js index 4f05c6e7..439bcc53 100644 --- a/__mocks__/FileCard.test.js +++ b/__mocks__/FileCard.test.js @@ -8,6 +8,15 @@ Enzyme.configure({ adapter: new Adapter(), }); +const mockSetPreview = jest.fn(); + +jest.mock('react', () => ({ + ...jest.requireActual('react'), + useState: jest.fn(), +})) + +import { useState } from 'react'; + const defaultProps = { repository: { owner: { @@ -41,99 +50,23 @@ const setupWrapper = (props = {}) => { return shallow() } - -test('FileForm PropTypes', () => { - const conformingProps = { - repository: { - owner: { - username: 'username', - avatar_url: 'avatar_url', - }, - name: 'name', - avatar_url: 'avatar_url', - permissions: { - push: true, - }, - full_name: 'full_name', - default_branch: 'default_branch' - }, - file:{ - name: 'file.name', - path: 'file.path', - sha: 'file.sha', - content: 'file.content', - branch: 'file.branch', - filepath: 'filepath', - save: () => {}, - dangerouslyDelete: () => {}, - close: () => {} - }, - isAuthenticated: true, - } - checkProps(FileCard, conformingProps); -}); - -// render tests -describe('render fileCard elements',() => { - test('render fileCard', () => { - const wrapper = setupWrapper(); - const fileCard = findByAttribute(wrapper, 'component-fileCard'); - expect(fileCard.length).toBe(1); - }); - - test('render cardHeader', () => { - const wrapper = setupWrapper(); - const cardHeader = findByAttribute(wrapper, 'cardHeader'); - expect(cardHeader.length).toBe(1); - }); - - test('render blockEditable', () => { +describe('switch the preview state',() => { + test('switch the preview state from true to false', () => { + useState.mockReturnValue([true, mockSetPreview]); const wrapper = setupWrapper(); const blockEditable = findByAttribute(wrapper, 'blockEditable'); - expect(blockEditable.length).toBe(1); - }); - - test('render previewButton', () => { - const wrapper = setupWrapper(); + expect(blockEditable.props().preview).toBeTruthy(); const previewButton = findByAttribute(wrapper, 'previewButton'); - expect(previewButton.length).toBe(1); - }); - - test('render saveButton', () => { - const wrapper = setupWrapper(); - const saveButton = findByAttribute(wrapper, 'saveButton'); - expect(saveButton.length).toBe(1); - }); - - test('render deleteButton', () => { - const wrapper = setupWrapper(); - const deleteButton = findByAttribute(wrapper, 'deleteButton'); - expect(deleteButton.length).toBe(1); + previewButton.simulate('click'); + expect(mockSetPreview).toBeCalledWith(false); }); - test('render closeButton', () => { + test('switch the preview state from false to true', () => { + useState.mockReturnValue([false, mockSetPreview]); const wrapper = setupWrapper(); - const closeButton = findByAttribute(wrapper, 'closeButton'); - expect(closeButton.length).toBe(1); + const blockEditable = findByAttribute(wrapper, 'blockEditable'); + const previewButton = findByAttribute(wrapper, 'previewButton'); + previewButton.simulate('click'); + expect(mockSetPreview).toBeCalledWith(true); }); -}); - -test('switch the preview state from true to false', () => { - const mockSetPreview = jest.fn(); - jest.spyOn(React, 'useState').mockImplementation(() => [true, mockSetPreview]) - const wrapper = setupWrapper(); - const blockEditable = findByAttribute(wrapper, 'blockEditable'); - expect(blockEditable.props().preview).toBeTruthy(); - const previewButton = findByAttribute(wrapper, 'previewButton'); - previewButton.simulate('click'); - expect(mockSetPreview).toBeCalledWith(false); -}); - -test('switch the preview state from false to true', () => { - const mockSetPreview = jest.fn(); - jest.spyOn(React, 'useState').mockImplementation(() => [false, mockSetPreview]) - const wrapper = setupWrapper(); - const previewButton = findByAttribute(wrapper, 'previewButton'); - previewButton.simulate('click'); - expect(mockSetPreview).toBeCalledWith(true); -}); \ No newline at end of file +}) diff --git a/src/components/file/FileCard.js b/src/components/file/FileCard.js index 66ebf539..fb12f25c 100644 --- a/src/components/file/FileCard.js +++ b/src/components/file/FileCard.js @@ -1,5 +1,5 @@ /* eslint-disable camelcase */ -import React, { useEffect } from 'react'; +import React, { useState, useEffect } from 'react'; import PropTypes from 'prop-types'; import { makeStyles } from '@material-ui/core/styles'; import { @@ -27,8 +27,8 @@ function FileCard({ file, }) { const classes = useStyles(); - const [preview, setPreview] = React.useState(true); - const [markdown, setMarkdown] = React.useState(''); + const [preview, setPreview] = useState(true); + const [markdown, setMarkdown] = useState(''); const changed = (markdown !== (file && file.content)); const avatarUrl = repository.avatar_url || repository.owner.avatar_url; const access = repository.permissions.push; From 0aadb90673d9f9d0064a507a18d96a9d691578b8 Mon Sep 17 00:00:00 2001 From: rady-ben Date: Tue, 14 Sep 2021 22:02:43 +0100 Subject: [PATCH 16/18] return the tests removed by mistake --- __mocks__/FileCard.test.js | 77 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/__mocks__/FileCard.test.js b/__mocks__/FileCard.test.js index 439bcc53..66823d9f 100644 --- a/__mocks__/FileCard.test.js +++ b/__mocks__/FileCard.test.js @@ -50,6 +50,83 @@ const setupWrapper = (props = {}) => { return shallow() } + +test('FileForm PropTypes', () => { + const conformingProps = { + repository: { + owner: { + username: 'username', + avatar_url: 'avatar_url', + }, + name: 'name', + avatar_url: 'avatar_url', + permissions: { + push: true, + }, + full_name: 'full_name', + default_branch: 'default_branch' + }, + file:{ + name: 'file.name', + path: 'file.path', + sha: 'file.sha', + content: 'file.content', + branch: 'file.branch', + filepath: 'filepath', + save: () => {}, + dangerouslyDelete: () => {}, + close: () => {} + }, + isAuthenticated: true, + } + checkProps(FileCard, conformingProps); +}); + +// render tests +describe('render fileCard elements',() => { + test('render fileCard', () => { + const wrapper = setupWrapper(); + const fileCard = findByAttribute(wrapper, 'component-fileCard'); + expect(fileCard.length).toBe(1); + }); + + test('render cardHeader', () => { + const wrapper = setupWrapper(); + const cardHeader = findByAttribute(wrapper, 'cardHeader'); + expect(cardHeader.length).toBe(1); + }); + + test('render blockEditable', () => { + const wrapper = setupWrapper(); + const blockEditable = findByAttribute(wrapper, 'blockEditable'); + expect(blockEditable.length).toBe(1); + }); + + test('render previewButton', () => { + const wrapper = setupWrapper(); + const previewButton = findByAttribute(wrapper, 'previewButton'); + expect(previewButton.length).toBe(1); + }); + + test('render saveButton', () => { + const wrapper = setupWrapper(); + const saveButton = findByAttribute(wrapper, 'saveButton'); + expect(saveButton.length).toBe(1); + }); + + test('render deleteButton', () => { + const wrapper = setupWrapper(); + const deleteButton = findByAttribute(wrapper, 'deleteButton'); + expect(deleteButton.length).toBe(1); + }); + + test('render closeButton', () => { + const wrapper = setupWrapper(); + const closeButton = findByAttribute(wrapper, 'closeButton'); + expect(closeButton.length).toBe(1); + }); +}); + describe('switch the preview state',() => { test('switch the preview state from true to false', () => { useState.mockReturnValue([true, mockSetPreview]); From 1313723b9145c3e450792f2e0258732817b95046 Mon Sep 17 00:00:00 2001 From: rady-ben Date: Tue, 14 Sep 2021 22:39:01 +0100 Subject: [PATCH 17/18] reset useState to its initial value befor run rendering tests --- __mocks__/FileCard.test.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/__mocks__/FileCard.test.js b/__mocks__/FileCard.test.js index 66823d9f..1cc81577 100644 --- a/__mocks__/FileCard.test.js +++ b/__mocks__/FileCard.test.js @@ -84,6 +84,9 @@ test('FileForm PropTypes', () => { // render tests describe('render fileCard elements',() => { + beforeEach(()=>{ + useState.mockImplementation(jest.requireActual('react').useState); + }) test('render fileCard', () => { const wrapper = setupWrapper(); const fileCard = findByAttribute(wrapper, 'component-fileCard'); From fe79d019c8381d2ef73662647e0805bb18e769a1 Mon Sep 17 00:00:00 2001 From: rady-ben Date: Wed, 15 Sep 2021 00:41:30 +0100 Subject: [PATCH 18/18] test the conditionel rendering of Pageview icon --- __mocks__/FileCard.test.js | 22 +++++++++++++++++++++- src/components/file/FileCard.js | 6 +++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/__mocks__/FileCard.test.js b/__mocks__/FileCard.test.js index 1cc81577..6d08f362 100644 --- a/__mocks__/FileCard.test.js +++ b/__mocks__/FileCard.test.js @@ -130,6 +130,27 @@ describe('render fileCard elements',() => { }); }); + +// conditional rendering +describe('conditional rendering',() => { + beforeEach(()=>{ + useState.mockImplementation(jest.requireActual('react').useState); + }) + test('conditional rendering preview', () => { + const wrapper = setupWrapper(); + let previewIcon = findByAttribute(wrapper, 'previewIcon'); + let previewIconOutlined = findByAttribute(wrapper, 'previewIconOutlined'); + expect(previewIcon.length).toBe(0); + expect(previewIconOutlined.length).toBe(1); + const previewButton = findByAttribute(wrapper, 'previewButton'); + previewButton.simulate('click'); + previewIcon = findByAttribute(wrapper, 'previewIcon'); + previewIconOutlined = findByAttribute(wrapper, 'previewIconOutlined'); + expect(previewIcon.length).toBe(1); + expect(previewIconOutlined.length).toBe(0); + }); +}); + describe('switch the preview state',() => { test('switch the preview state from true to false', () => { useState.mockReturnValue([true, mockSetPreview]); @@ -144,7 +165,6 @@ describe('switch the preview state',() => { test('switch the preview state from false to true', () => { useState.mockReturnValue([false, mockSetPreview]); const wrapper = setupWrapper(); - const blockEditable = findByAttribute(wrapper, 'blockEditable'); const previewButton = findByAttribute(wrapper, 'previewButton'); previewButton.simulate('click'); expect(mockSetPreview).toBeCalledWith(true); diff --git a/src/components/file/FileCard.js b/src/components/file/FileCard.js index fb12f25c..4cba1964 100644 --- a/src/components/file/FileCard.js +++ b/src/components/file/FileCard.js @@ -68,7 +68,11 @@ function FileCard({ onClick={() => setPreview(!preview)} data-test="previewButton" > - {!preview ? : } + { + !preview ? + : + + }