From 9907a768a0e9660549821e77918fea6f0d04c467 Mon Sep 17 00:00:00 2001
From: Cassidy Schaufele
Date: Mon, 10 Jan 2022 23:32:08 -0700
Subject: [PATCH 01/10] DOP-2642: Update low/mid complexity tests to use RTL,
not enzyme
---
package-lock.json | 652 ++--
package.json | 3 +
tests/unit/Admonition.test.js | 6 +-
tests/unit/Banner.test.js | 6 +-
tests/unit/BlockQuote.test.js | 6 +-
tests/unit/BreadcrumbContainer.test.js | 11 +-
tests/unit/BreadcrumbSchema.test.js | 42 -
tests/unit/Breadcrumbs.test.js | 20 +-
tests/unit/Button.test.js | 6 +-
tests/unit/Card.test.js | 6 +-
tests/unit/CardGroup.test.js | 6 +-
tests/unit/CardRef.test.js | 8 +-
tests/unit/Chapter.test.js | 12 +-
tests/unit/Chapters.test.js | 37 +-
tests/unit/DefinitionList.test.js | 4 +-
tests/unit/Emphasis.test.js | 6 +-
tests/unit/Field.test.js | 6 +-
tests/unit/FieldList.test.js | 6 +-
tests/unit/Figure.test.js | 8 +-
tests/unit/Footnote.test.js | 6 +-
tests/unit/FootnoteReference.test.js | 6 +-
tests/unit/GuidesLandingTree.test.js | 6 +-
tests/unit/Heading.test.js | 4 +-
tests/unit/InternalPageNav.test.js | 8 +-
tests/unit/Line.test.js | 10 +-
tests/unit/LineBlock.test.js | 6 +-
tests/unit/Link.test.js | 16 +-
tests/unit/List.test.js | 4 +-
tests/unit/Literal.test.js | 6 +-
tests/unit/LiteralInclude.test.js | 6 +-
tests/unit/MongoWebShell.test.js | 6 +-
tests/unit/Paragraph.test.js | 6 +-
tests/unit/Procedure.test.js | 6 +-
tests/unit/QuizWidget.test.js | 31 +-
tests/unit/Reference.test.js | 4 +-
tests/unit/ReleaseSpecification.test.js | 4 +-
tests/unit/Role.test.js | 12 +-
tests/unit/Section.test.js | 6 +-
tests/unit/SiteBanner.test.js | 12 +-
tests/unit/Step.test.js | 6 +-
tests/unit/StepYAML.test.js | 6 +-
tests/unit/Strong.test.js | 6 +-
tests/unit/Target.test.js | 6 +-
tests/unit/Text.test.js | 6 +-
tests/unit/TitleReference.test.js | 6 +-
tests/unit/VersionModified.test.js | 10 +-
.../__snapshots__/Admonition.test.js.snap | 131 +-
tests/unit/__snapshots__/Banner.test.js.snap | 130 +-
.../__snapshots__/BlockQuote.test.js.snap | 208 +-
.../BreadcrumbContainer.test.js.snap | 257 +-
.../BreadcrumbSchema.test.js.snap | 14 -
.../__snapshots__/Breadcrumbs.test.js.snap | 199 +-
tests/unit/__snapshots__/Button.test.js.snap | 132 +-
tests/unit/__snapshots__/CardRef.test.js.snap | 2700 +----------------
tests/unit/__snapshots__/Chapter.test.js.snap | 428 +--
.../__snapshots__/DefinitionList.test.js.snap | 34 +-
.../unit/__snapshots__/Emphasis.test.js.snap | 8 +-
tests/unit/__snapshots__/Field.test.js.snap | 94 +-
tests/unit/__snapshots__/Figure.test.js.snap | 74 +-
.../unit/__snapshots__/Footnote.test.js.snap | 129 +-
.../FootnoteReference.test.js.snap | 18 +-
.../GuidesLandingTree.test.js.snap | 339 ++-
tests/unit/__snapshots__/Heading.test.js.snap | 36 +-
.../InternalPageNav.test.js.snap | 128 +-
tests/unit/__snapshots__/Line.test.js.snap | 75 +-
.../unit/__snapshots__/LineBlock.test.js.snap | 25 +-
tests/unit/__snapshots__/Link.test.js.snap | 92 +-
tests/unit/__snapshots__/List.test.js.snap | 48 +-
tests/unit/__snapshots__/Literal.test.js.snap | 49 +-
.../__snapshots__/LiteralInclude.test.js.snap | 210 +-
.../__snapshots__/MongoWebShell.test.js.snap | 40 +-
.../unit/__snapshots__/Paragraph.test.js.snap | 23 +-
.../unit/__snapshots__/Procedure.test.js.snap | 292 +-
.../__snapshots__/QuizWidget.test.js.snap | 277 ++
.../unit/__snapshots__/Reference.test.js.snap | 14 +-
.../ReleaseSpecification.test.js.snap | 64 +-
tests/unit/__snapshots__/Role.test.js.snap | 42 +-
tests/unit/__snapshots__/Section.test.js.snap | 135 +-
.../__snapshots__/SiteBanner.test.js.snap | 28 +-
tests/unit/__snapshots__/Step.test.js.snap | 158 +-
.../unit/__snapshots__/StepYAML.test.js.snap | 154 +-
tests/unit/__snapshots__/Strong.test.js.snap | 8 +-
tests/unit/__snapshots__/Target.test.js.snap | 112 +-
tests/unit/__snapshots__/Text.test.js.snap | 4 +-
.../__snapshots__/TitleReference.test.js.snap | 8 +-
.../VersionModified.test.js.snap | 206 +-
86 files changed, 2997 insertions(+), 5188 deletions(-)
delete mode 100644 tests/unit/BreadcrumbSchema.test.js
delete mode 100644 tests/unit/__snapshots__/BreadcrumbSchema.test.js.snap
diff --git a/package-lock.json b/package-lock.json
index 75a036d13..70c210585 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -69,6 +69,9 @@
},
"devDependencies": {
"@babel/core": "^7.12.9",
+ "@testing-library/dom": "^8.11.1",
+ "@testing-library/react": "^12.1.2",
+ "@testing-library/user-event": "^13.5.0",
"auto-changelog": "^2.2.1",
"babel-jest": "^26.6.3",
"babel-plugin-emotion": "^10.0.33",
@@ -107,11 +110,15 @@
"integrity": "sha512-uZtkfKblCEQtZKBF6EBXVZeQNl82yqtDQdv+eck8u7tdPxjLu2/lp5/uPW+um2tpuxINHWy3GhiccY7QgEaVHQ=="
},
"node_modules/@babel/code-frame": {
- "version": "7.5.5",
- "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz",
- "integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==",
+ "version": "7.16.7",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/@babel/code-frame/-/code-frame-7.16.7.tgz",
+ "integrity": "sha1-REFra9diS5mPWxr11HCFbEATh4k=",
+ "license": "MIT",
"dependencies": {
- "@babel/highlight": "^7.0.0"
+ "@babel/highlight": "^7.16.7"
+ },
+ "engines": {
+ "node": ">=6.9.0"
}
},
"node_modules/@babel/compat-data": {
@@ -145,24 +152,6 @@
"node": ">=6.9.0"
}
},
- "node_modules/@babel/core/node_modules/@babel/code-frame": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz",
- "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==",
- "dependencies": {
- "@babel/highlight": "^7.10.4"
- }
- },
- "node_modules/@babel/core/node_modules/@babel/highlight": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz",
- "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==",
- "dependencies": {
- "@babel/helper-validator-identifier": "^7.10.4",
- "chalk": "^2.0.0",
- "js-tokens": "^4.0.0"
- }
- },
"node_modules/@babel/core/node_modules/json5": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/json5/-/json5-2.1.3.tgz",
@@ -394,9 +383,10 @@
}
},
"node_modules/@babel/helper-validator-identifier": {
- "version": "7.14.8",
- "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.8.tgz",
- "integrity": "sha512-ZGy6/XQjllhYQrNw/3zfWRwZCTVSiBLZ9DHVZxn9n2gip/7ab8mv2TWlKPIBk26RwedCBoWdjLmn+t9na2Gcow==",
+ "version": "7.16.7",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz",
+ "integrity": "sha1-6MYCQ4xKgZV1EkPakDHRYH0kfK0=",
+ "license": "MIT",
"engines": {
"node": ">=6.9.0"
}
@@ -428,13 +418,17 @@
}
},
"node_modules/@babel/highlight": {
- "version": "7.5.0",
- "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.5.0.tgz",
- "integrity": "sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ==",
+ "version": "7.16.7",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/@babel/highlight/-/highlight-7.16.7.tgz",
+ "integrity": "sha1-gaAdfWdQRvDZb4JFDZ2VeL39aws=",
+ "license": "MIT",
"dependencies": {
+ "@babel/helper-validator-identifier": "^7.16.7",
"chalk": "^2.0.0",
- "esutils": "^2.0.2",
"js-tokens": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=6.9.0"
}
},
"node_modules/@babel/parser": {
@@ -1214,24 +1208,6 @@
"@babel/types": "^7.12.7"
}
},
- "node_modules/@babel/template/node_modules/@babel/code-frame": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz",
- "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==",
- "dependencies": {
- "@babel/highlight": "^7.10.4"
- }
- },
- "node_modules/@babel/template/node_modules/@babel/highlight": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz",
- "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==",
- "dependencies": {
- "@babel/helper-validator-identifier": "^7.10.4",
- "chalk": "^2.0.0",
- "js-tokens": "^4.0.0"
- }
- },
"node_modules/@babel/traverse": {
"version": "7.12.9",
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.12.9.tgz",
@@ -1248,24 +1224,6 @@
"lodash": "^4.17.19"
}
},
- "node_modules/@babel/traverse/node_modules/@babel/code-frame": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz",
- "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==",
- "dependencies": {
- "@babel/highlight": "^7.10.4"
- }
- },
- "node_modules/@babel/traverse/node_modules/@babel/highlight": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz",
- "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==",
- "dependencies": {
- "@babel/helper-validator-identifier": "^7.10.4",
- "chalk": "^2.0.0",
- "js-tokens": "^4.0.0"
- }
- },
"node_modules/@babel/types": {
"version": "7.14.8",
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.14.8.tgz",
@@ -4088,6 +4046,192 @@
"node": ">=6"
}
},
+ "node_modules/@testing-library/dom": {
+ "version": "8.11.1",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/@testing-library/dom/-/dom-8.11.1.tgz",
+ "integrity": "sha1-A/omhKoJreWJtGDbRrTHvp/Gl1M=",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/code-frame": "^7.10.4",
+ "@babel/runtime": "^7.12.5",
+ "@types/aria-query": "^4.2.0",
+ "aria-query": "^5.0.0",
+ "chalk": "^4.1.0",
+ "dom-accessibility-api": "^0.5.9",
+ "lz-string": "^1.4.4",
+ "pretty-format": "^27.0.2"
+ },
+ "engines": {
+ "node": ">=12"
+ }
+ },
+ "node_modules/@testing-library/dom/node_modules/ansi-regex": {
+ "version": "5.0.1",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/ansi-regex/-/ansi-regex-5.0.1.tgz",
+ "integrity": "sha1-CCyyyJyf6GWaMRpTvWpNxTAdswQ=",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/@testing-library/dom/node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/ansi-styles/-/ansi-styles-4.3.0.tgz",
+ "integrity": "sha1-7dgDYornHATIWuegkG7a00tkiTc=",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "/~https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/@testing-library/dom/node_modules/aria-query": {
+ "version": "5.0.0",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/aria-query/-/aria-query-5.0.0.tgz",
+ "integrity": "sha1-IQwhqvRpYT7oyaYsf4ZSXgWNtSw=",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=6.0"
+ }
+ },
+ "node_modules/@testing-library/dom/node_modules/chalk": {
+ "version": "4.1.2",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/chalk/-/chalk-4.1.2.tgz",
+ "integrity": "sha1-qsTit3NKdAhnrrFr8CqtVWoeegE=",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "/~https://github.com/chalk/chalk?sponsor=1"
+ }
+ },
+ "node_modules/@testing-library/dom/node_modules/color-convert": {
+ "version": "2.0.1",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha1-ctOmjVmMm9s68q0ehPIdiWq9TeM=",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "color-name": "~1.1.4"
+ },
+ "engines": {
+ "node": ">=7.0.0"
+ }
+ },
+ "node_modules/@testing-library/dom/node_modules/color-name": {
+ "version": "1.1.4",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha1-wqCah6y95pVD3m9j+jmVyCbFNqI=",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@testing-library/dom/node_modules/has-flag": {
+ "version": "4.0.0",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha1-lEdx/ZyByBJlxNaUGGDaBrtZR5s=",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/@testing-library/dom/node_modules/pretty-format": {
+ "version": "27.4.6",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/pretty-format/-/pretty-format-27.4.6.tgz",
+ "integrity": "sha1-G3hNL1PGjbMXl7I0j6ObSeMYRrc=",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-regex": "^5.0.1",
+ "ansi-styles": "^5.0.0",
+ "react-is": "^17.0.1"
+ },
+ "engines": {
+ "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
+ }
+ },
+ "node_modules/@testing-library/dom/node_modules/pretty-format/node_modules/ansi-styles": {
+ "version": "5.2.0",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/ansi-styles/-/ansi-styles-5.2.0.tgz",
+ "integrity": "sha1-B0SWkK1Fd30ZJKwquy/IiV26g2s=",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=10"
+ },
+ "funding": {
+ "url": "/~https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/@testing-library/dom/node_modules/react-is": {
+ "version": "17.0.2",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/react-is/-/react-is-17.0.2.tgz",
+ "integrity": "sha1-5pHUqOnHiTZWVVOas3J2Kw77VPA=",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@testing-library/dom/node_modules/supports-color": {
+ "version": "7.2.0",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/supports-color/-/supports-color-7.2.0.tgz",
+ "integrity": "sha1-G33NyzK4E4gBs+R4umpRyqiWSNo=",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/@testing-library/react": {
+ "version": "12.1.2",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/@testing-library/react/-/react-12.1.2.tgz",
+ "integrity": "sha1-8byaRZQ0YfoqWYu0WX3xrgRM/HY=",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/runtime": "^7.12.5",
+ "@testing-library/dom": "^8.0.0"
+ },
+ "engines": {
+ "node": ">=12"
+ },
+ "peerDependencies": {
+ "react": "*",
+ "react-dom": "*"
+ }
+ },
+ "node_modules/@testing-library/user-event": {
+ "version": "13.5.0",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/@testing-library/user-event/-/user-event-13.5.0.tgz",
+ "integrity": "sha1-addwB/HhJNVTFKK3P9IEszOxMpU=",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/runtime": "^7.12.5"
+ },
+ "engines": {
+ "node": ">=10",
+ "npm": ">=6"
+ },
+ "peerDependencies": {
+ "@testing-library/dom": ">=7.21.4"
+ }
+ },
"node_modules/@theme-ui/color-modes": {
"version": "0.10.0",
"resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/@theme-ui/color-modes/-/color-modes-0.10.0.tgz",
@@ -4342,6 +4486,13 @@
"resolved": "https://registry.npmjs.org/@turist/time/-/time-0.0.1.tgz",
"integrity": "sha512-M2BiThcbxMxSKX8W4z5u9jKZn6datnM3+FpEU+eYw0//l31E2xhqi7vTAuJ/Sf0P3yhp66SDJgPu3bRRpvrdQQ=="
},
+ "node_modules/@types/aria-query": {
+ "version": "4.2.2",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/@types/aria-query/-/aria-query-4.2.2.tgz",
+ "integrity": "sha1-7U4K2SMGpwT5+xMqDPz3dIbb4rw=",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/@types/babel__core": {
"version": "7.1.12",
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.12.tgz",
@@ -9434,6 +9585,13 @@
"node": ">=0.10.0"
}
},
+ "node_modules/dom-accessibility-api": {
+ "version": "0.5.10",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/dom-accessibility-api/-/dom-accessibility-api-0.5.10.tgz",
+ "integrity": "sha1-yqbQj2A4jQu0U53XX+RYqaHQAUw=",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/dom-converter": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/dom-converter/-/dom-converter-0.2.0.tgz",
@@ -12403,24 +12561,6 @@
"node": ">=10.13.0"
}
},
- "node_modules/gatsby-telemetry/node_modules/@babel/code-frame": {
- "version": "7.12.11",
- "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz",
- "integrity": "sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==",
- "dependencies": {
- "@babel/highlight": "^7.10.4"
- }
- },
- "node_modules/gatsby-telemetry/node_modules/@babel/highlight": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz",
- "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==",
- "dependencies": {
- "@babel/helper-validator-identifier": "^7.10.4",
- "chalk": "^2.0.0",
- "js-tokens": "^4.0.0"
- }
- },
"node_modules/gatsby-telemetry/node_modules/gatsby-core-utils": {
"version": "1.7.1",
"resolved": "https://registry.npmjs.org/gatsby-core-utils/-/gatsby-core-utils-1.7.1.tgz",
@@ -12438,37 +12578,6 @@
"node": ">=10.13.0"
}
},
- "node_modules/gatsby/node_modules/@babel/code-frame": {
- "version": "7.12.11",
- "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz",
- "integrity": "sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==",
- "dependencies": {
- "@babel/highlight": "^7.10.4"
- }
- },
- "node_modules/gatsby/node_modules/@babel/highlight": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz",
- "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==",
- "dependencies": {
- "@babel/helper-validator-identifier": "^7.10.4",
- "chalk": "^2.0.0",
- "js-tokens": "^4.0.0"
- }
- },
- "node_modules/gatsby/node_modules/@babel/highlight/node_modules/chalk": {
- "version": "2.4.2",
- "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
- "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
- "dependencies": {
- "ansi-styles": "^3.2.1",
- "escape-string-regexp": "^1.0.5",
- "supports-color": "^5.3.0"
- },
- "engines": {
- "node": ">=4"
- }
- },
"node_modules/gatsby/node_modules/ansi-regex": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
@@ -19124,6 +19233,16 @@
"resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.8.tgz",
"integrity": "sha512-oxMeX/Y35PNFuZoHp+jUj5OSEmLCaIH4KTFJh7a93cHBoFmpw2IoPs22VIz7vyO2YUnx2Tn9dzIwO2P/4quIRg=="
},
+ "node_modules/lz-string": {
+ "version": "1.4.4",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/lz-string/-/lz-string-1.4.4.tgz",
+ "integrity": "sha1-wNjq82BZ9wV5bh40SBHPTEmNOiY=",
+ "dev": true,
+ "license": "WTFPL",
+ "bin": {
+ "lz-string": "bin/bin.js"
+ }
+ },
"node_modules/make-dir": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz",
@@ -23618,14 +23737,6 @@
"@mdx-js/util": "^2.0.0-next.8"
}
},
- "node_modules/remark-mdxjs/node_modules/@babel/code-frame": {
- "version": "7.12.11",
- "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz",
- "integrity": "sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==",
- "dependencies": {
- "@babel/highlight": "^7.10.4"
- }
- },
"node_modules/remark-mdxjs/node_modules/@babel/core": {
"version": "7.10.5",
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.10.5.tgz",
@@ -23652,16 +23763,6 @@
"node": ">=6.9.0"
}
},
- "node_modules/remark-mdxjs/node_modules/@babel/highlight": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz",
- "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==",
- "dependencies": {
- "@babel/helper-validator-identifier": "^7.10.4",
- "chalk": "^2.0.0",
- "js-tokens": "^4.0.0"
- }
- },
"node_modules/remark-mdxjs/node_modules/@babel/plugin-proposal-object-rest-spread": {
"version": "7.10.4",
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.10.4.tgz",
@@ -29420,11 +29521,11 @@
}
},
"@babel/code-frame": {
- "version": "7.5.5",
- "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz",
- "integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==",
+ "version": "7.16.7",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/@babel/code-frame/-/code-frame-7.16.7.tgz",
+ "integrity": "sha1-REFra9diS5mPWxr11HCFbEATh4k=",
"requires": {
- "@babel/highlight": "^7.0.0"
+ "@babel/highlight": "^7.16.7"
}
},
"@babel/compat-data": {
@@ -29455,24 +29556,6 @@
"source-map": "^0.5.0"
},
"dependencies": {
- "@babel/code-frame": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz",
- "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==",
- "requires": {
- "@babel/highlight": "^7.10.4"
- }
- },
- "@babel/highlight": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz",
- "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==",
- "requires": {
- "@babel/helper-validator-identifier": "^7.10.4",
- "chalk": "^2.0.0",
- "js-tokens": "^4.0.0"
- }
- },
"json5": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/json5/-/json5-2.1.3.tgz",
@@ -29696,9 +29779,9 @@
}
},
"@babel/helper-validator-identifier": {
- "version": "7.14.8",
- "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.14.8.tgz",
- "integrity": "sha512-ZGy6/XQjllhYQrNw/3zfWRwZCTVSiBLZ9DHVZxn9n2gip/7ab8mv2TWlKPIBk26RwedCBoWdjLmn+t9na2Gcow=="
+ "version": "7.16.7",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz",
+ "integrity": "sha1-6MYCQ4xKgZV1EkPakDHRYH0kfK0="
},
"@babel/helper-validator-option": {
"version": "7.12.1",
@@ -29727,12 +29810,12 @@
}
},
"@babel/highlight": {
- "version": "7.5.0",
- "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.5.0.tgz",
- "integrity": "sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ==",
+ "version": "7.16.7",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/@babel/highlight/-/highlight-7.16.7.tgz",
+ "integrity": "sha1-gaAdfWdQRvDZb4JFDZ2VeL39aws=",
"requires": {
+ "@babel/helper-validator-identifier": "^7.16.7",
"chalk": "^2.0.0",
- "esutils": "^2.0.2",
"js-tokens": "^4.0.0"
}
},
@@ -30493,26 +30576,6 @@
"@babel/code-frame": "^7.10.4",
"@babel/parser": "^7.12.7",
"@babel/types": "^7.12.7"
- },
- "dependencies": {
- "@babel/code-frame": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz",
- "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==",
- "requires": {
- "@babel/highlight": "^7.10.4"
- }
- },
- "@babel/highlight": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz",
- "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==",
- "requires": {
- "@babel/helper-validator-identifier": "^7.10.4",
- "chalk": "^2.0.0",
- "js-tokens": "^4.0.0"
- }
- }
}
},
"@babel/traverse": {
@@ -30529,26 +30592,6 @@
"debug": "^4.1.0",
"globals": "^11.1.0",
"lodash": "^4.17.19"
- },
- "dependencies": {
- "@babel/code-frame": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.10.4.tgz",
- "integrity": "sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg==",
- "requires": {
- "@babel/highlight": "^7.10.4"
- }
- },
- "@babel/highlight": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz",
- "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==",
- "requires": {
- "@babel/helper-validator-identifier": "^7.10.4",
- "chalk": "^2.0.0",
- "js-tokens": "^4.0.0"
- }
- }
}
},
"@babel/types": {
@@ -33055,6 +33098,129 @@
"defer-to-connect": "^1.0.1"
}
},
+ "@testing-library/dom": {
+ "version": "8.11.1",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/@testing-library/dom/-/dom-8.11.1.tgz",
+ "integrity": "sha1-A/omhKoJreWJtGDbRrTHvp/Gl1M=",
+ "dev": true,
+ "requires": {
+ "@babel/code-frame": "^7.10.4",
+ "@babel/runtime": "^7.12.5",
+ "@types/aria-query": "^4.2.0",
+ "aria-query": "^5.0.0",
+ "chalk": "^4.1.0",
+ "dom-accessibility-api": "^0.5.9",
+ "lz-string": "^1.4.4",
+ "pretty-format": "^27.0.2"
+ },
+ "dependencies": {
+ "ansi-regex": {
+ "version": "5.0.1",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/ansi-regex/-/ansi-regex-5.0.1.tgz",
+ "integrity": "sha1-CCyyyJyf6GWaMRpTvWpNxTAdswQ=",
+ "dev": true
+ },
+ "ansi-styles": {
+ "version": "4.3.0",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/ansi-styles/-/ansi-styles-4.3.0.tgz",
+ "integrity": "sha1-7dgDYornHATIWuegkG7a00tkiTc=",
+ "dev": true,
+ "requires": {
+ "color-convert": "^2.0.1"
+ }
+ },
+ "aria-query": {
+ "version": "5.0.0",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/aria-query/-/aria-query-5.0.0.tgz",
+ "integrity": "sha1-IQwhqvRpYT7oyaYsf4ZSXgWNtSw=",
+ "dev": true
+ },
+ "chalk": {
+ "version": "4.1.2",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/chalk/-/chalk-4.1.2.tgz",
+ "integrity": "sha1-qsTit3NKdAhnrrFr8CqtVWoeegE=",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha1-ctOmjVmMm9s68q0ehPIdiWq9TeM=",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha1-wqCah6y95pVD3m9j+jmVyCbFNqI=",
+ "dev": true
+ },
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha1-lEdx/ZyByBJlxNaUGGDaBrtZR5s=",
+ "dev": true
+ },
+ "pretty-format": {
+ "version": "27.4.6",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/pretty-format/-/pretty-format-27.4.6.tgz",
+ "integrity": "sha1-G3hNL1PGjbMXl7I0j6ObSeMYRrc=",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^5.0.1",
+ "ansi-styles": "^5.0.0",
+ "react-is": "^17.0.1"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "5.2.0",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/ansi-styles/-/ansi-styles-5.2.0.tgz",
+ "integrity": "sha1-B0SWkK1Fd30ZJKwquy/IiV26g2s=",
+ "dev": true
+ }
+ }
+ },
+ "react-is": {
+ "version": "17.0.2",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/react-is/-/react-is-17.0.2.tgz",
+ "integrity": "sha1-5pHUqOnHiTZWVVOas3J2Kw77VPA=",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "7.2.0",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/supports-color/-/supports-color-7.2.0.tgz",
+ "integrity": "sha1-G33NyzK4E4gBs+R4umpRyqiWSNo=",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ }
+ }
+ },
+ "@testing-library/react": {
+ "version": "12.1.2",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/@testing-library/react/-/react-12.1.2.tgz",
+ "integrity": "sha1-8byaRZQ0YfoqWYu0WX3xrgRM/HY=",
+ "dev": true,
+ "requires": {
+ "@babel/runtime": "^7.12.5",
+ "@testing-library/dom": "^8.0.0"
+ }
+ },
+ "@testing-library/user-event": {
+ "version": "13.5.0",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/@testing-library/user-event/-/user-event-13.5.0.tgz",
+ "integrity": "sha1-addwB/HhJNVTFKK3P9IEszOxMpU=",
+ "dev": true,
+ "requires": {
+ "@babel/runtime": "^7.12.5"
+ }
+ },
"@theme-ui/color-modes": {
"version": "0.10.0",
"resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/@theme-ui/color-modes/-/color-modes-0.10.0.tgz",
@@ -33251,6 +33417,12 @@
"resolved": "https://registry.npmjs.org/@turist/time/-/time-0.0.1.tgz",
"integrity": "sha512-M2BiThcbxMxSKX8W4z5u9jKZn6datnM3+FpEU+eYw0//l31E2xhqi7vTAuJ/Sf0P3yhp66SDJgPu3bRRpvrdQQ=="
},
+ "@types/aria-query": {
+ "version": "4.2.2",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/@types/aria-query/-/aria-query-4.2.2.tgz",
+ "integrity": "sha1-7U4K2SMGpwT5+xMqDPz3dIbb4rw=",
+ "dev": true
+ },
"@types/babel__core": {
"version": "7.1.12",
"resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.12.tgz",
@@ -37626,6 +37798,12 @@
"isarray": "^1.0.0"
}
},
+ "dom-accessibility-api": {
+ "version": "0.5.10",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/dom-accessibility-api/-/dom-accessibility-api-0.5.10.tgz",
+ "integrity": "sha1-yqbQj2A4jQu0U53XX+RYqaHQAUw=",
+ "dev": true
+ },
"dom-converter": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/dom-converter/-/dom-converter-0.2.0.tgz",
@@ -39742,36 +39920,6 @@
"yaml-loader": "^0.6.0"
},
"dependencies": {
- "@babel/code-frame": {
- "version": "7.12.11",
- "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz",
- "integrity": "sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==",
- "requires": {
- "@babel/highlight": "^7.10.4"
- }
- },
- "@babel/highlight": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz",
- "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==",
- "requires": {
- "@babel/helper-validator-identifier": "^7.10.4",
- "chalk": "^2.0.0",
- "js-tokens": "^4.0.0"
- },
- "dependencies": {
- "chalk": {
- "version": "2.4.2",
- "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
- "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
- "requires": {
- "ansi-styles": "^3.2.1",
- "escape-string-regexp": "^1.0.5",
- "supports-color": "^5.3.0"
- }
- }
- }
- },
"ansi-regex": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
@@ -40567,24 +40715,6 @@
"uuid": "3.4.0"
},
"dependencies": {
- "@babel/code-frame": {
- "version": "7.12.11",
- "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz",
- "integrity": "sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==",
- "requires": {
- "@babel/highlight": "^7.10.4"
- }
- },
- "@babel/highlight": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz",
- "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==",
- "requires": {
- "@babel/helper-validator-identifier": "^7.10.4",
- "chalk": "^2.0.0",
- "js-tokens": "^4.0.0"
- }
- },
"gatsby-core-utils": {
"version": "1.7.1",
"resolved": "https://registry.npmjs.org/gatsby-core-utils/-/gatsby-core-utils-1.7.1.tgz",
@@ -45603,6 +45733,12 @@
"resolved": "https://registry.npmjs.org/lunr/-/lunr-2.3.8.tgz",
"integrity": "sha512-oxMeX/Y35PNFuZoHp+jUj5OSEmLCaIH4KTFJh7a93cHBoFmpw2IoPs22VIz7vyO2YUnx2Tn9dzIwO2P/4quIRg=="
},
+ "lz-string": {
+ "version": "1.4.4",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/lz-string/-/lz-string-1.4.4.tgz",
+ "integrity": "sha1-wNjq82BZ9wV5bh40SBHPTEmNOiY=",
+ "dev": true
+ },
"make-dir": {
"version": "3.1.0",
"resolved": "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz",
@@ -49397,14 +49533,6 @@
"@mdx-js/util": "^2.0.0-next.8"
},
"dependencies": {
- "@babel/code-frame": {
- "version": "7.12.11",
- "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.12.11.tgz",
- "integrity": "sha512-Zt1yodBx1UcyiePMSkWnU4hPqhwq7hGi2nFL1LeA3EUl+q2LQx16MISgJ0+z7dnmgvP9QtIleuETGOiOH1RcIw==",
- "requires": {
- "@babel/highlight": "^7.10.4"
- }
- },
"@babel/core": {
"version": "7.10.5",
"resolved": "https://registry.npmjs.org/@babel/core/-/core-7.10.5.tgz",
@@ -49428,16 +49556,6 @@
"source-map": "^0.5.0"
}
},
- "@babel/highlight": {
- "version": "7.10.4",
- "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.10.4.tgz",
- "integrity": "sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA==",
- "requires": {
- "@babel/helper-validator-identifier": "^7.10.4",
- "chalk": "^2.0.0",
- "js-tokens": "^4.0.0"
- }
- },
"@babel/plugin-proposal-object-rest-spread": {
"version": "7.10.4",
"resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.10.4.tgz",
diff --git a/package.json b/package.json
index 401e62cf3..28ebf7229 100644
--- a/package.json
+++ b/package.json
@@ -8,6 +8,9 @@
},
"devDependencies": {
"@babel/core": "^7.12.9",
+ "@testing-library/dom": "^8.11.1",
+ "@testing-library/react": "^12.1.2",
+ "@testing-library/user-event": "^13.5.0",
"auto-changelog": "^2.2.1",
"babel-jest": "^26.6.3",
"babel-plugin-emotion": "^10.0.33",
diff --git a/tests/unit/Admonition.test.js b/tests/unit/Admonition.test.js
index 67e6c2cda..365ad83b4 100644
--- a/tests/unit/Admonition.test.js
+++ b/tests/unit/Admonition.test.js
@@ -1,11 +1,11 @@
import React from 'react';
-import { shallow } from 'enzyme';
+import { render } from '@testing-library/react';
import Admonition from '../../src/components/Admonition';
// data for this component
import mockData from './data/Admonition.test.json';
it('admonitions render correctly', () => {
- const tree = shallow( );
- expect(tree).toMatchSnapshot();
+ const tree = render( );
+ expect(tree.asFragment()).toMatchSnapshot();
});
diff --git a/tests/unit/Banner.test.js b/tests/unit/Banner.test.js
index c4e0b8d92..6adc28360 100644
--- a/tests/unit/Banner.test.js
+++ b/tests/unit/Banner.test.js
@@ -1,11 +1,11 @@
import React from 'react';
-import { shallow } from 'enzyme';
+import { render } from '@testing-library/react';
import Banner from '../../src/components/Banner';
// data for this component
import mockData from './data/Banner.test.json';
it('renders a Banner correctly', () => {
- const tree = shallow( );
- expect(tree).toMatchSnapshot();
+ const tree = render( );
+ expect(tree.asFragment()).toMatchSnapshot();
});
diff --git a/tests/unit/BlockQuote.test.js b/tests/unit/BlockQuote.test.js
index 686fe9781..539366231 100644
--- a/tests/unit/BlockQuote.test.js
+++ b/tests/unit/BlockQuote.test.js
@@ -1,11 +1,11 @@
import React from 'react';
-import { shallow } from 'enzyme';
+import { render } from '@testing-library/react';
import BlockQuote from '../../src/components/BlockQuote';
// data for this component
import mockData from './data/BlockQuote.test.json';
it('renders correctly', () => {
- const tree = shallow( );
- expect(tree).toMatchSnapshot();
+ const tree = render( );
+ expect(tree.asFragment()).toMatchSnapshot();
});
diff --git a/tests/unit/BreadcrumbContainer.test.js b/tests/unit/BreadcrumbContainer.test.js
index ed167d37d..af5351ae8 100644
--- a/tests/unit/BreadcrumbContainer.test.js
+++ b/tests/unit/BreadcrumbContainer.test.js
@@ -1,14 +1,15 @@
import React from 'react';
-import { mount } from 'enzyme';
+import { render } from '@testing-library/react';
import BreadcrumbContainer from '../../src/components/BreadcrumbContainer';
import { NavigationContext } from '../../src/components/navigation-context';
-const mountBreadcrumbContainer = (homeCrumb, lastCrumb, parents) =>
- mount(
+const mountBreadcrumbContainer = (homeCrumb, lastCrumb, parents) => {
+ return render(
);
+};
describe('BreadcrumbContainer', () => {
const mockHomeCrumb = {
@@ -30,7 +31,7 @@ describe('BreadcrumbContainer', () => {
];
const tree = mountBreadcrumbContainer(mockHomeCrumb, mockLastCrumb, mockParents);
- expect(tree).toMatchSnapshot();
+ expect(tree.asFragment()).toMatchSnapshot();
});
it('renders correctly without project parent', () => {
@@ -40,6 +41,6 @@ describe('BreadcrumbContainer', () => {
};
const tree = mountBreadcrumbContainer(mockHomeCrumb, mockLastCrumb, []);
- expect(tree).toMatchSnapshot();
+ expect(tree.asFragment()).toMatchSnapshot();
});
});
diff --git a/tests/unit/BreadcrumbSchema.test.js b/tests/unit/BreadcrumbSchema.test.js
deleted file mode 100644
index 80cfc4408..000000000
--- a/tests/unit/BreadcrumbSchema.test.js
+++ /dev/null
@@ -1,42 +0,0 @@
-import React from 'react';
-import { shallow } from 'enzyme';
-import BreadcrumbSchema from '../../src/components/BreadcrumbSchema';
-
-import mockData from './data/Breadcrumbs.test.json';
-
-const siteUrl = 'https://docs.mongodb.com';
-
-jest.mock('../../src/hooks/use-site-metadata', () => ({
- useSiteMetadata: () => ({ siteUrl }),
-}));
-
-describe('BreadcrumbSchema', () => {
- let shallowWrapper;
-
- beforeAll(() => {
- shallowWrapper = shallow(
-
- );
- });
-
- it('renders correctly', () => {
- expect(shallowWrapper).toMatchSnapshot();
- });
-
- it('script has a correct schema', () => {
- const script = shallowWrapper.find('script');
-
- expect(script.text()).toEqual(
- JSON.stringify({
- '@context': 'https://schema.org',
- '@type': 'BreadcrumbList',
- itemListElement: [
- { '@type': 'ListItem', position: 1, name: 'MongoDB Documentation', item: `${siteUrl}/` },
- { '@type': 'ListItem', position: 2, name: 'MongoDB Compass', item: `${siteUrl}/` },
- { '@type': 'ListItem', position: 3, name: 'Interact with Your Data', item: `${siteUrl}/manage-data/` },
- { '@type': 'ListItem', position: 4, name: 'Manage Documents', item: `${siteUrl}/documents/` },
- ],
- })
- );
- });
-});
diff --git a/tests/unit/Breadcrumbs.test.js b/tests/unit/Breadcrumbs.test.js
index 6c3f33129..0dd35af67 100644
--- a/tests/unit/Breadcrumbs.test.js
+++ b/tests/unit/Breadcrumbs.test.js
@@ -1,16 +1,26 @@
import React from 'react';
-import { shallow } from 'enzyme';
+import * as Gatsby from 'gatsby';
+import { render } from '@testing-library/react';
import Breadcrumbs from '../../src/components/Breadcrumbs';
import mockData from './data/Breadcrumbs.test.json';
it('renders correctly with siteTitle', () => {
- const tree = shallow( );
- expect(tree).toMatchSnapshot();
+ const tree = render( );
+ expect(tree.asFragment()).toMatchSnapshot();
});
+const useStaticQuery = jest.spyOn(Gatsby, 'useStaticQuery');
+useStaticQuery.mockImplementation(() => ({
+ site: {
+ siteMetadata: {
+ project: '',
+ },
+ },
+}));
+
it('renders correctly with pageTitle', () => {
- const tree = shallow(
+ const tree = render(
{
slug={'view-analyze'}
/>
);
- expect(tree).toMatchSnapshot();
+ expect(tree.asFragment()).toMatchSnapshot();
});
diff --git a/tests/unit/Button.test.js b/tests/unit/Button.test.js
index 7cf5388d8..f69a8f41f 100644
--- a/tests/unit/Button.test.js
+++ b/tests/unit/Button.test.js
@@ -1,11 +1,11 @@
import React from 'react';
-import { shallow } from 'enzyme';
+import { render } from '@testing-library/react';
import Button from '../../src/components/Button';
// data for this component
import mockData from './data/Button.test.json';
it('renders correctly', () => {
- const tree = shallow( );
- expect(tree).toMatchSnapshot();
+ const tree = render( );
+ expect(tree.asFragment()).toMatchSnapshot();
});
diff --git a/tests/unit/Card.test.js b/tests/unit/Card.test.js
index 69e90f3a4..753eaabdd 100644
--- a/tests/unit/Card.test.js
+++ b/tests/unit/Card.test.js
@@ -1,11 +1,11 @@
import React from 'react';
-import { shallow } from 'enzyme';
+import { render } from '@testing-library/react';
import Card from '../../src/components/Card';
// data for this component
import mockData from './data/Card.test.json';
it('renders correctly', () => {
- const tree = shallow( );
- expect(tree).toMatchSnapshot();
+ const tree = render( );
+ expect(tree.asFragment()).toMatchSnapshot();
});
diff --git a/tests/unit/CardGroup.test.js b/tests/unit/CardGroup.test.js
index 4e7944f36..19c6bab66 100644
--- a/tests/unit/CardGroup.test.js
+++ b/tests/unit/CardGroup.test.js
@@ -1,11 +1,11 @@
import React from 'react';
-import { shallow } from 'enzyme';
+import { render } from '@testing-library/react';
import CardGroup from '../../src/components/CardGroup';
// data for this component
import mockData from './data/CardGroup.test.json';
it('renders correctly', () => {
- const tree = shallow( );
- expect(tree).toMatchSnapshot();
+ const tree = render( );
+ expect(tree.asFragment()).toMatchSnapshot();
});
diff --git a/tests/unit/CardRef.test.js b/tests/unit/CardRef.test.js
index 1088c6f82..527a34d4d 100644
--- a/tests/unit/CardRef.test.js
+++ b/tests/unit/CardRef.test.js
@@ -1,5 +1,5 @@
import React from 'react';
-import { mount } from 'enzyme';
+import { render } from '@testing-library/react';
import { ThemeProvider } from 'emotion-theming';
import CardGroup from '../../src/components/CardGroup';
import { theme } from '../../src/theme/docsTheme';
@@ -10,10 +10,10 @@ import mockData from './data/CardRef.test.json';
// Since there isn't a proper CardRef component, test that card-ref styling
// is applied appropriately (i.e., only when a Card :url: is not specified)
it('card correctly with and without url', () => {
- const tree = mount(
+ const tree = render(
- ).childAt(0);
- expect(tree).toMatchSnapshot();
+ );
+ expect(tree.asFragment()).toMatchSnapshot();
});
diff --git a/tests/unit/Chapter.test.js b/tests/unit/Chapter.test.js
index a7d80556f..b45b21b42 100644
--- a/tests/unit/Chapter.test.js
+++ b/tests/unit/Chapter.test.js
@@ -1,15 +1,15 @@
import React from 'react';
-import { mount } from 'enzyme';
+import { render } from '@testing-library/react';
import mockData from './data/Chapters.test.json';
import Chapter from '../../src/components/Chapters/Chapter';
it('renders correctly', () => {
const chapterData = mockData.nodeData.children[0];
- const wrapper = mount( );
- expect(wrapper).toMatchSnapshot();
+ const wrapper = render( );
+ expect(wrapper.asFragment()).toMatchSnapshot();
// Make sure that the logic used to get the component's rendered data is correct
- expect(wrapper.find('ChapterNumberLabel').text()).toEqual('Chapter 1');
- expect(wrapper.find('ChapterTitle').text()).toEqual('Atlas');
- expect(wrapper.find('li')).toHaveLength(3);
+ expect(wrapper.getByText('Chapter 1')).toBeTruthy();
+ expect(wrapper.getByText('Atlas')).toBeTruthy();
+ expect(wrapper.container.querySelectorAll('li')).toHaveLength(3);
});
diff --git a/tests/unit/Chapters.test.js b/tests/unit/Chapters.test.js
index 0c6c3f4a9..c442e66f3 100644
--- a/tests/unit/Chapters.test.js
+++ b/tests/unit/Chapters.test.js
@@ -1,6 +1,7 @@
import React from 'react';
import { ThemeProvider } from 'emotion-theming';
-import { mount } from 'enzyme';
+import { render } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
import mockData from './data/Chapters.test.json';
import Chapters from '../../src/components/Chapters/Chapters';
import { tick } from '../utils';
@@ -10,7 +11,7 @@ import { getPlaintext } from '../../src/utils/get-plaintext';
const mountChapters = () => {
const { nodeData, metadata } = mockData;
- return mount(
+ return render(
@@ -24,30 +25,30 @@ describe('Chapters', () => {
it('renders chapters', () => {
const wrapper = mountChapters();
- expect(wrapper.find('Chapter')).toHaveLength(2);
- expect(wrapper.find('LearningCard')).toHaveLength(1);
+ // screen.debug()
+
+ // We expect 2 chapter entries and 1 chapter view selector, per test data.
+ expect(wrapper.queryAllByText('Chapter', { exact: false })).toHaveLength(3);
});
it('renders guides in gallery view', async () => {
const wrapper = mountChapters();
- const viewOptions = wrapper.find('ViewOption');
- expect(viewOptions).toHaveLength(2);
+ const galleryView = wrapper.getByText('Gallery', { exact: false });
+
+ userEvent.click(galleryView);
+ await tick();
- const galleryView = viewOptions.at(1);
- galleryView.simulate('click');
- await tick({ wrapper });
+ // Only the Chapter view selector should be rendered.
+ expect(wrapper.queryAllByText('Chapter', { exact: false })).toHaveLength(1);
+ // screen.debug()
- expect(wrapper.find('Chapter')).toHaveLength(0);
- const cardGroup = wrapper.find('div.card-group');
- expect(cardGroup.children()).toHaveLength(4);
+ // Three cards should render with Atlas chapter icons, per test data.
+ const cardImages = wrapper.queryAllByAltText('Atlas chapter icon');
+ expect(cardImages).toHaveLength(3);
// Make sure that the data passed to a card is correct
- const testCard = cardGroup.children().at(0);
const data = mockData.metadata.guides['cloud/account'];
- expect(testCard.find('img')).toHaveLength(1);
- expect(testCard.find('h4').text()).toEqual(getPlaintext(data.title));
- expect(testCard.find('Text').text()).toEqual(getPlaintext(data.description));
- expect(testCard.find('a').props()).toHaveProperty('href', '/cloud/account/');
- expect(testCard.find('a').text()).toEqual('15 mins');
+ expect(wrapper.getByText(getPlaintext(data.title))).toBeTruthy();
+ expect(wrapper.getByText('15 mins')).toHaveProperty('href', 'http://localhost/cloud/account/');
});
});
diff --git a/tests/unit/DefinitionList.test.js b/tests/unit/DefinitionList.test.js
index 59ba2c956..b4f053a52 100644
--- a/tests/unit/DefinitionList.test.js
+++ b/tests/unit/DefinitionList.test.js
@@ -1,9 +1,9 @@
import React from 'react';
-import { render } from 'enzyme';
+import { render } from '@testing-library/react';
import DefinitionList from '../../src/components/DefinitionList';
import mockData from './data/DefinitionList.test.json';
it('DefinitionList renders correctly', () => {
const tree = render( );
- expect(tree).toMatchSnapshot();
+ expect(tree.asFragment()).toMatchSnapshot();
});
diff --git a/tests/unit/Emphasis.test.js b/tests/unit/Emphasis.test.js
index 8c43dc349..a5c3b31c8 100644
--- a/tests/unit/Emphasis.test.js
+++ b/tests/unit/Emphasis.test.js
@@ -1,11 +1,11 @@
import React from 'react';
-import { shallow } from 'enzyme';
+import { render } from '@testing-library/react';
import Emphasis from '../../src/components/Emphasis';
// data for this component
import mockData from './data/Emphasis.test.json';
it('renders correctly', () => {
- const tree = shallow( );
- expect(tree).toMatchSnapshot();
+ const tree = render( );
+ expect(tree.asFragment()).toMatchSnapshot();
});
diff --git a/tests/unit/Field.test.js b/tests/unit/Field.test.js
index 2f4e75719..ed9e5ddfa 100644
--- a/tests/unit/Field.test.js
+++ b/tests/unit/Field.test.js
@@ -1,11 +1,11 @@
import React from 'react';
-import { shallow } from 'enzyme';
+import { render } from '@testing-library/react';
import Field from '../../src/components/Field';
// data for this component
import mockData from './data/FieldList.test.json';
it('renders correctly', () => {
- const tree = shallow( );
- expect(tree).toMatchSnapshot();
+ const tree = render( );
+ expect(tree.asFragment()).toMatchSnapshot();
});
diff --git a/tests/unit/FieldList.test.js b/tests/unit/FieldList.test.js
index 3f52db649..7d6abce74 100644
--- a/tests/unit/FieldList.test.js
+++ b/tests/unit/FieldList.test.js
@@ -1,11 +1,11 @@
import React from 'react';
-import { shallow } from 'enzyme';
+import { render } from '@testing-library/react';
import FieldList from '../../src/components/FieldList';
// data for this component
import mockData from './data/FieldList.test.json';
it('renders correctly', () => {
- const tree = shallow( );
- expect(tree).toMatchSnapshot();
+ const tree = render( );
+ expect(tree.asFragment()).toMatchSnapshot();
});
diff --git a/tests/unit/Figure.test.js b/tests/unit/Figure.test.js
index f50c4da3b..f776eb1db 100644
--- a/tests/unit/Figure.test.js
+++ b/tests/unit/Figure.test.js
@@ -1,5 +1,5 @@
import React from 'react';
-import { render } from 'enzyme';
+import { render } from '@testing-library/react';
import Figure from '../../src/components/Figure';
// data for this component
@@ -9,15 +9,15 @@ import lightboxData from './data/FigureLightbox.test.json';
it('renders correctly', () => {
const tree = render( );
- expect(tree).toMatchSnapshot();
+ expect(tree.asFragment()).toMatchSnapshot();
});
it('renders border correctly when specified as an option', () => {
const tree = render( );
- expect(tree).toMatchSnapshot();
+ expect(tree.asFragment()).toMatchSnapshot();
});
it('renders lightbox correctly when specified as an option', () => {
const tree = render( );
- expect(tree).toMatchSnapshot();
+ expect(tree.asFragment()).toMatchSnapshot();
});
diff --git a/tests/unit/Footnote.test.js b/tests/unit/Footnote.test.js
index 27e6c5dee..8e358142d 100644
--- a/tests/unit/Footnote.test.js
+++ b/tests/unit/Footnote.test.js
@@ -1,5 +1,5 @@
import React from 'react';
-import { mount } from 'enzyme';
+import { render } from '@testing-library/react';
import Footnote from '../../src/components/Footnote';
import FootnoteContext from '../../src/components/footnote-context';
@@ -7,7 +7,7 @@ import FootnoteContext from '../../src/components/footnote-context';
import mockData from './data/Footnote.test.json';
const mountFootnotes = (footnotes) =>
- mount(
+ render(
@@ -17,5 +17,5 @@ const mockFootnotes = { 1: { label: 1, references: ['id1'] } };
it('renders correctly', () => {
const footnotes = mountFootnotes(mockFootnotes);
- expect(footnotes).toMatchSnapshot();
+ expect(footnotes.asFragment()).toMatchSnapshot();
});
diff --git a/tests/unit/FootnoteReference.test.js b/tests/unit/FootnoteReference.test.js
index c31519209..fb549ef1e 100644
--- a/tests/unit/FootnoteReference.test.js
+++ b/tests/unit/FootnoteReference.test.js
@@ -1,11 +1,11 @@
import React from 'react';
-import { shallow } from 'enzyme';
+import { render } from '@testing-library/react';
import FootnoteReference from '../../src/components/FootnoteReference';
// data for this component
import mockData from './data/FootnoteReference.test.json';
it('renders correctly', () => {
- const tree = shallow( );
- expect(tree).toMatchSnapshot();
+ const tree = render( );
+ expect(tree.asFragment()).toMatchSnapshot();
});
diff --git a/tests/unit/GuidesLandingTree.test.js b/tests/unit/GuidesLandingTree.test.js
index b7e0cec6d..9b781872b 100644
--- a/tests/unit/GuidesLandingTree.test.js
+++ b/tests/unit/GuidesLandingTree.test.js
@@ -1,15 +1,15 @@
import React from 'react';
-import { shallow } from 'enzyme';
+import { render } from '@testing-library/react';
import mockData from './data/Chapters.test.json';
import GuidesLandingTree from '../../src/components/Sidenav/GuidesLandingTree';
const getWrapper = () => {
const { chapters } = mockData.metadata;
- return shallow( );
+ return render( );
};
it('renders correctly', () => {
const wrapper = getWrapper();
- expect(wrapper).toMatchSnapshot();
+ expect(wrapper.asFragment()).toMatchSnapshot();
});
diff --git a/tests/unit/Heading.test.js b/tests/unit/Heading.test.js
index 6c12da274..6123e1192 100644
--- a/tests/unit/Heading.test.js
+++ b/tests/unit/Heading.test.js
@@ -1,5 +1,5 @@
import React from 'react';
-import { render } from 'enzyme';
+import { render } from '@testing-library/react';
import Heading from '../../src/components/Heading';
// data for this component
@@ -7,5 +7,5 @@ import mockData from './data/Heading.test.json';
it('renders correctly', () => {
const tree = render( );
- expect(tree).toMatchSnapshot();
+ expect(tree.asFragment()).toMatchSnapshot();
});
diff --git a/tests/unit/InternalPageNav.test.js b/tests/unit/InternalPageNav.test.js
index de1d511e0..d2d53c9f2 100644
--- a/tests/unit/InternalPageNav.test.js
+++ b/tests/unit/InternalPageNav.test.js
@@ -1,5 +1,5 @@
import React from 'react';
-import { render } from 'enzyme';
+import { render } from '@testing-library/react';
import InternalPageNav from '../../src/components/InternalPageNav';
import slugTitleMapping from './data/ecosystem/slugTitleMapping.json';
@@ -10,15 +10,15 @@ const renderNav = (slug) =>
it('renders a page with next and previous links correctly', () => {
const tree = renderNav('drivers/go');
- expect(tree).toMatchSnapshot();
+ expect(tree.asFragment()).toMatchSnapshot();
});
it('renders a page with no previous link correctly', () => {
const tree = renderNav('drivers/csharp');
- expect(tree).toMatchSnapshot();
+ expect(tree.asFragment()).toMatchSnapshot();
});
it('renders a page with no next link correctly', () => {
const tree = renderNav('drivers/java');
- expect(tree).toMatchSnapshot();
+ expect(tree.asFragment()).toMatchSnapshot();
});
diff --git a/tests/unit/Line.test.js b/tests/unit/Line.test.js
index 7265b7121..daad3043d 100644
--- a/tests/unit/Line.test.js
+++ b/tests/unit/Line.test.js
@@ -1,5 +1,5 @@
import React from 'react';
-import { shallow } from 'enzyme';
+import { render } from '@testing-library/react';
import Line from '../../src/components/Line';
// data for this component
@@ -7,11 +7,11 @@ import mockData from './data/Line.test.json';
import mockData2 from './data/Line-empty.test.json';
it('renders correctly', () => {
- const tree = shallow( );
- expect(tree).toMatchSnapshot();
+ const tree = render( );
+ expect(tree.asFragment()).toMatchSnapshot();
});
it('renders an empty Line node correctly', () => {
- const tree = shallow( );
- expect(tree).toMatchSnapshot();
+ const tree = render( );
+ expect(tree.asFragment()).toMatchSnapshot();
});
diff --git a/tests/unit/LineBlock.test.js b/tests/unit/LineBlock.test.js
index abb594def..8746241ce 100644
--- a/tests/unit/LineBlock.test.js
+++ b/tests/unit/LineBlock.test.js
@@ -1,11 +1,11 @@
import React from 'react';
-import { shallow } from 'enzyme';
+import { render } from '@testing-library/react';
import LineBlock from '../../src/components/LineBlock';
// data for this component
import mockData from './data/Literal.test.json';
it('renders correctly', () => {
- const tree = shallow( );
- expect(tree).toMatchSnapshot();
+ const tree = render( );
+ expect(tree.asFragment()).toMatchSnapshot();
});
diff --git a/tests/unit/Link.test.js b/tests/unit/Link.test.js
index 3b08416d4..2a8677749 100644
--- a/tests/unit/Link.test.js
+++ b/tests/unit/Link.test.js
@@ -1,5 +1,5 @@
import React from 'react';
-import { render } from 'enzyme';
+import { render } from '@testing-library/react';
import Link from '../../src/components/Link';
const setup = ({ text, ...rest }) => render( {text});
@@ -7,36 +7,36 @@ const setup = ({ text, ...rest }) => render( {text});
describe('Link component renders a variety of strings correctly', () => {
it('empty string', () => {
const tree = setup({ to: '', text: 'Empty string' });
- expect(tree).toMatchSnapshot();
+ expect(tree.asFragment()).toMatchSnapshot();
});
it('external URL', () => {
const tree = setup({ to: 'http://mongodb.com', text: 'MongoDB Company' });
- expect(tree).toMatchSnapshot();
+ expect(tree.asFragment()).toMatchSnapshot();
});
it('internal link', () => {
const tree = setup({ to: 'drivers/c', text: 'C Driver', className: 'test-class' });
- expect(tree).toMatchSnapshot();
+ expect(tree.asFragment()).toMatchSnapshot();
});
it('internal link with hash', () => {
const tree = setup({ to: 'drivers/pymongo#installation', text: 'C Driver', className: 'test-class' });
- expect(tree).toMatchSnapshot();
+ expect(tree.asFragment()).toMatchSnapshot();
});
it('internal link query param', () => {
const tree = setup({ to: 'drivers/ruby?site=drivers', text: 'C Driver', className: 'test-class' });
- expect(tree).toMatchSnapshot();
+ expect(tree.asFragment()).toMatchSnapshot();
});
it('internal link that already includes trailing slash', () => {
const tree = setup({ to: 'drivers/nodejs/#installation', text: 'C Driver', className: 'test-class' });
- expect(tree).toMatchSnapshot();
+ expect(tree.asFragment()).toMatchSnapshot();
});
it('identfies mailto links as external urls', () => {
const tree = setup({ to: 'mailto:docs@mongodb.com', text: 'docs@mongodb.com' });
- expect(tree).toMatchSnapshot();
+ expect(tree.asFragment()).toMatchSnapshot();
});
});
diff --git a/tests/unit/List.test.js b/tests/unit/List.test.js
index 8f65de706..a8a084e05 100644
--- a/tests/unit/List.test.js
+++ b/tests/unit/List.test.js
@@ -1,5 +1,5 @@
import React from 'react';
-import { render } from 'enzyme';
+import { render } from '@testing-library/react';
import List from '../../src/components/List';
// data for this component
@@ -7,5 +7,5 @@ import mockData from './data/List.test.json';
it('List renders correctly', () => {
const tree = render(
);
- expect(tree).toMatchSnapshot();
+ expect(tree.asFragment()).toMatchSnapshot();
});
diff --git a/tests/unit/Literal.test.js b/tests/unit/Literal.test.js
index e42fac302..86ce1e031 100644
--- a/tests/unit/Literal.test.js
+++ b/tests/unit/Literal.test.js
@@ -1,11 +1,11 @@
import React from 'react';
-import { shallow } from 'enzyme';
+import { render } from '@testing-library/react';
import Literal from '../../src/components/Literal';
// data for this component
import mockData from './data/Literal.test.json';
it('renders correctly', () => {
- const tree = shallow( );
- expect(tree).toMatchSnapshot();
+ const tree = render( );
+ expect(tree.asFragment()).toMatchSnapshot();
});
diff --git a/tests/unit/LiteralInclude.test.js b/tests/unit/LiteralInclude.test.js
index ecc502a20..4494cfc89 100644
--- a/tests/unit/LiteralInclude.test.js
+++ b/tests/unit/LiteralInclude.test.js
@@ -1,11 +1,11 @@
import React from 'react';
-import { shallow } from 'enzyme';
+import { render } from '@testing-library/react';
import LiteralInclude from '../../src/components/LiteralInclude';
// data for this component
import mockData from './data/LiteralInclude.test.json';
it('renders correctly', () => {
- const tree = shallow( );
- expect(tree).toMatchSnapshot();
+ const tree = render( );
+ expect(tree.asFragment()).toMatchSnapshot();
});
diff --git a/tests/unit/MongoWebShell.test.js b/tests/unit/MongoWebShell.test.js
index 4423a9817..bf3725523 100644
--- a/tests/unit/MongoWebShell.test.js
+++ b/tests/unit/MongoWebShell.test.js
@@ -1,5 +1,5 @@
import React from 'react';
-import { render } from 'enzyme';
+import { render } from '@testing-library/react';
import MongoWebShell from '../../src/components/MongoWebShell';
// data for this component
@@ -8,10 +8,10 @@ import mockDataVersioned from './data/MongoWebShell-v4.2.test.json';
it('correctly renders a MongoDB Web Shell', () => {
const tree = render( );
- expect(tree).toMatchSnapshot();
+ expect(tree.asFragment()).toMatchSnapshot();
});
it('correctly renders a MongoDB Web Shell v4.2.9', () => {
const tree = render( );
- expect(tree).toMatchSnapshot();
+ expect(tree.asFragment()).toMatchSnapshot();
});
diff --git a/tests/unit/Paragraph.test.js b/tests/unit/Paragraph.test.js
index c7df7b0f4..5aae30a5b 100644
--- a/tests/unit/Paragraph.test.js
+++ b/tests/unit/Paragraph.test.js
@@ -1,11 +1,11 @@
import React from 'react';
-import { shallow } from 'enzyme';
+import { render } from '@testing-library/react';
import Paragraph from '../../src/components/Paragraph';
// data for this component
import mockData from './data/Paragraph.test.json';
it('renders correctly', () => {
- const tree = shallow( );
- expect(tree).toMatchSnapshot();
+ const tree = render( );
+ expect(tree.asFragment()).toMatchSnapshot();
});
diff --git a/tests/unit/Procedure.test.js b/tests/unit/Procedure.test.js
index 571e32caa..fb95cc008 100644
--- a/tests/unit/Procedure.test.js
+++ b/tests/unit/Procedure.test.js
@@ -1,11 +1,11 @@
import React from 'react';
-import { shallow } from 'enzyme';
+import { render } from '@testing-library/react';
import Procedure from '../../src/components/Procedure';
// data for this component
import mockData from './data/Procedure.test.json';
it('renders correctly', () => {
- const tree = shallow( );
- expect(tree).toMatchSnapshot();
+ const tree = render( );
+ expect(tree.asFragment()).toMatchSnapshot();
});
diff --git a/tests/unit/QuizWidget.test.js b/tests/unit/QuizWidget.test.js
index dc143d78b..0f059a0e5 100644
--- a/tests/unit/QuizWidget.test.js
+++ b/tests/unit/QuizWidget.test.js
@@ -1,5 +1,5 @@
import React from 'react';
-import { shallow } from 'enzyme';
+import { render } from '@testing-library/react';
import QuizWidget from '../../src/components/Widgets/QuizWidget/QuizWidget';
// data for this component
@@ -8,23 +8,28 @@ import { completeQuiz, noQuestion } from './data/QuizWidget.test.json';
const siteUrl = 'https://docs.mongodb.com';
const project = 'cloud-docs';
-const mockDate = new Date(1466424490000);
-const spy = jest.spyOn(global, 'Date').mockImplementation(() => mockDate);
+const timestamp = 1466424490000;
+const mockDate = new Date(timestamp);
jest.mock('../../src/hooks/use-site-metadata', () => ({
useSiteMetadata: () => ({ siteUrl, project }),
}));
-it('renders quiz widget correctly', () => {
- const tree = shallow( );
- expect(tree).toMatchSnapshot();
-});
+describe('quiz widget snapshots', () => {
+ const spy = jest.spyOn(global, 'Date').mockImplementation(() => mockDate);
+ Date.now = jest.fn(() => 1466424490000);
-it('doesnt render quiz widget without a specified question', () => {
- const tree = shallow( );
- expect(tree).toMatchSnapshot();
-});
+ it('renders quiz widget correctly', () => {
+ const tree = render( );
+ expect(tree.asFragment()).toMatchSnapshot();
+ });
+
+ it('doesnt render quiz widget without a specified question', () => {
+ const tree = render( );
+ expect(tree.asFragment()).toMatchSnapshot();
+ });
-afterAll(() => {
- spy.mockRestore();
+ afterAll(() => {
+ spy.mockRestore();
+ });
});
diff --git a/tests/unit/Reference.test.js b/tests/unit/Reference.test.js
index b8df06469..e282959b1 100644
--- a/tests/unit/Reference.test.js
+++ b/tests/unit/Reference.test.js
@@ -1,5 +1,5 @@
import React from 'react';
-import { render } from 'enzyme';
+import { render } from '@testing-library/react';
import Reference from '../../src/components/Reference';
// data for this component
@@ -7,5 +7,5 @@ import mockData from './data/Reference.test.json';
it('renders correctly', () => {
const tree = render( );
- expect(tree).toMatchSnapshot();
+ expect(tree.asFragment()).toMatchSnapshot();
});
diff --git a/tests/unit/ReleaseSpecification.test.js b/tests/unit/ReleaseSpecification.test.js
index a3616bb41..92d00328b 100644
--- a/tests/unit/ReleaseSpecification.test.js
+++ b/tests/unit/ReleaseSpecification.test.js
@@ -1,5 +1,5 @@
import React from 'react';
-import { render } from 'enzyme';
+import { render } from '@testing-library/react';
import ReleaseSpecification from '../../src/components/ReleaseSpecification';
// data for this component
@@ -7,5 +7,5 @@ import mockData from './data/ReleaseSpecification.test.json';
it('renders correctly', () => {
const tree = render( );
- expect(tree).toMatchSnapshot();
+ expect(tree.asFragment()).toMatchSnapshot();
});
diff --git a/tests/unit/Role.test.js b/tests/unit/Role.test.js
index 729f0ed2a..6a2728ac5 100644
--- a/tests/unit/Role.test.js
+++ b/tests/unit/Role.test.js
@@ -1,5 +1,5 @@
import React from 'react';
-import { render, shallow } from 'enzyme';
+import { render } from '@testing-library/react';
import RoleAbbr from '../../src/components/Roles/Abbr';
import RoleGUILabel from '../../src/components/Roles/GUILabel';
@@ -12,21 +12,21 @@ import mockDataAbbr from './data/Role-abbr.test.json';
describe('GUI Label', () => {
it('correctly renders a "guilabel" role', () => {
const tree = render( );
- expect(tree).toMatchSnapshot();
+ expect(tree.asFragment()).toMatchSnapshot();
});
});
describe('File', () => {
it('correctly renders a "file" role', () => {
const tree = render( );
- expect(tree).toMatchSnapshot();
+ expect(tree.asFragment()).toMatchSnapshot();
});
});
describe('Abbr', () => {
it('correctly renders a "Abbr" role', () => {
const abbr = render( );
- expect(abbr).toMatchSnapshot();
+ expect(abbr.asFragment()).toMatchSnapshot();
});
describe('when passed a value with format "ABBR (Full Name Here)"', () => {
@@ -34,8 +34,8 @@ describe('Abbr', () => {
mockValidAbbr.children[0].value = 'Display (Extended)';
it('parses and strips whitespace from the display value', () => {
- const abbr = shallow( );
- expect(abbr.childAt(0).text()).toBe('Display');
+ const abbr = render( );
+ expect(abbr.getByText('Display')).toBeTruthy();
});
});
});
diff --git a/tests/unit/Section.test.js b/tests/unit/Section.test.js
index 2bfbf259a..06c799bf0 100644
--- a/tests/unit/Section.test.js
+++ b/tests/unit/Section.test.js
@@ -1,11 +1,11 @@
import React from 'react';
-import { shallow } from 'enzyme';
+import { render } from '@testing-library/react';
import Section from '../../src/components/Section';
// data for this component
import mockData from './data/Section.test.json';
it('renders correctly', () => {
- const tree = shallow();
- expect(tree).toMatchSnapshot();
+ const tree = render();
+ expect(tree.asFragment()).toMatchSnapshot();
});
diff --git a/tests/unit/SiteBanner.test.js b/tests/unit/SiteBanner.test.js
index 7416c46bb..729867e8d 100644
--- a/tests/unit/SiteBanner.test.js
+++ b/tests/unit/SiteBanner.test.js
@@ -1,5 +1,5 @@
import React from 'react';
-import { mount } from 'enzyme';
+import { render } from '@testing-library/react';
import * as Gatsby from 'gatsby';
import * as RealmUtil from '../../src/utils/realm';
import SiteBanner from '../../src/components/SiteBanner';
@@ -31,20 +31,20 @@ describe('Banner component', () => {
it('renders without a banner image', () => {
// bannerContent state should remain null
- const wrapper = mount( );
- expect(wrapper.find('Banner').children()).toHaveLength(0);
+ const wrapper = render( );
+ expect(wrapper.queryByAltText(mockBannerContent.altText)).toBeNull();
});
it('renders with a banner image', async () => {
jest.useFakeTimers();
jest.spyOn(RealmUtil, 'fetchBanner').mockImplementation(() => mockBannerContent);
const setBannerContent = jest.fn();
- const wrapper = mount(
+ const wrapper = render(
);
- await tick({ wrapper });
- expect(wrapper).toMatchSnapshot();
+ await tick();
+ expect(wrapper.asFragment()).toMatchSnapshot();
});
});
diff --git a/tests/unit/Step.test.js b/tests/unit/Step.test.js
index c57c69bce..afabae391 100644
--- a/tests/unit/Step.test.js
+++ b/tests/unit/Step.test.js
@@ -1,11 +1,11 @@
import React from 'react';
-import { shallow } from 'enzyme';
+import { render } from '@testing-library/react';
import Step from '../../src/components/Step';
// data for this component
import mockData from './data/Step.test.json';
it('renders correctly', () => {
- const tree = shallow( );
- expect(tree).toMatchSnapshot();
+ const tree = render( );
+ expect(tree.asFragment()).toMatchSnapshot();
});
diff --git a/tests/unit/StepYAML.test.js b/tests/unit/StepYAML.test.js
index 4b5c376e3..42725729c 100644
--- a/tests/unit/StepYAML.test.js
+++ b/tests/unit/StepYAML.test.js
@@ -1,11 +1,11 @@
import React from 'react';
-import { shallow } from 'enzyme';
+import { render } from '@testing-library/react';
import StepYAML from '../../src/components/StepYAML';
// data for this component
import mockData from './data/StepYAML.test.json';
it('renders correctly', () => {
- const tree = shallow( );
- expect(tree).toMatchSnapshot();
+ const tree = render( );
+ expect(tree.asFragment()).toMatchSnapshot();
});
diff --git a/tests/unit/Strong.test.js b/tests/unit/Strong.test.js
index 840bbbe5f..cedfbc059 100644
--- a/tests/unit/Strong.test.js
+++ b/tests/unit/Strong.test.js
@@ -1,11 +1,11 @@
import React from 'react';
-import { shallow } from 'enzyme';
+import { render } from '@testing-library/react';
import Strong from '../../src/components/Strong';
// data for this component
import mockData from './data/Strong.test.json';
it('renders correctly', () => {
- const tree = shallow( );
- expect(tree).toMatchSnapshot();
+ const tree = render( );
+ expect(tree.asFragment()).toMatchSnapshot();
});
diff --git a/tests/unit/Target.test.js b/tests/unit/Target.test.js
index 7cd41ea85..bdff45cf0 100644
--- a/tests/unit/Target.test.js
+++ b/tests/unit/Target.test.js
@@ -1,5 +1,5 @@
import React from 'react';
-import { render } from 'enzyme';
+import { render } from '@testing-library/react';
import Target from '../../src/components/Target';
// data for this component
@@ -7,10 +7,10 @@ import mockData from './data/Target.test.json';
it('renders correctly with a directive_argument node', () => {
const tree = render( );
- expect(tree).toMatchSnapshot();
+ expect(tree.asFragment()).toMatchSnapshot();
});
it('renders correctly with no directive_argument nodes', () => {
const tree = render( );
- expect(tree).toMatchSnapshot();
+ expect(tree.asFragment()).toMatchSnapshot();
});
diff --git a/tests/unit/Text.test.js b/tests/unit/Text.test.js
index 21d64143c..4ba0ee462 100644
--- a/tests/unit/Text.test.js
+++ b/tests/unit/Text.test.js
@@ -1,11 +1,11 @@
import React from 'react';
-import { shallow } from 'enzyme';
+import { render } from '@testing-library/react';
import Text from '../../src/components/Text';
// data for this component
import mockData from './data/Text.test.json';
it('renders correctly', () => {
- const tree = shallow( );
- expect(tree).toMatchSnapshot();
+ const tree = render( );
+ expect(tree.asFragment()).toMatchSnapshot();
});
diff --git a/tests/unit/TitleReference.test.js b/tests/unit/TitleReference.test.js
index 4ab29dfe2..ef32a64fa 100644
--- a/tests/unit/TitleReference.test.js
+++ b/tests/unit/TitleReference.test.js
@@ -1,11 +1,11 @@
import React from 'react';
-import { shallow } from 'enzyme';
+import { render } from '@testing-library/react';
import TitleReference from '../../src/components/TitleReference';
// data for this component
import mockData from './data/TitleReference.test.json';
it('renders correctly', () => {
- const tree = shallow( );
- expect(tree).toMatchSnapshot();
+ const tree = render( );
+ expect(tree.asFragment()).toMatchSnapshot();
});
diff --git a/tests/unit/VersionModified.test.js b/tests/unit/VersionModified.test.js
index 5caafa5a2..d7e3e5652 100644
--- a/tests/unit/VersionModified.test.js
+++ b/tests/unit/VersionModified.test.js
@@ -1,18 +1,18 @@
import React from 'react';
-import { shallow } from 'enzyme';
+import { render } from '@testing-library/react';
import VersionModified from '../../src/components/VersionModified';
// data for this component
import { deprecated, versionadded, versionchanged } from './data/VersionModified.test.json';
-const shallowRender = (data) => shallow( );
+const shallowRender = (data) => render( );
describe('when rendering a deprecated directive with 0 arguments', () => {
let wrapper;
it('renders correctly ', () => {
wrapper = shallowRender(deprecated);
- expect(wrapper).toMatchSnapshot();
+ expect(wrapper.asFragment()).toMatchSnapshot();
});
});
@@ -21,7 +21,7 @@ describe('when rendering a versionadded directive with one argument', () => {
it('renders correctly ', () => {
wrapper = shallowRender(versionadded);
- expect(wrapper).toMatchSnapshot();
+ expect(wrapper.asFragment()).toMatchSnapshot();
});
});
@@ -30,6 +30,6 @@ describe('when rendering a versionchanged directive with two arguments', () => {
it('renders correctly ', () => {
wrapper = shallowRender(versionchanged);
- expect(wrapper).toMatchSnapshot();
+ expect(wrapper.asFragment()).toMatchSnapshot();
});
});
diff --git a/tests/unit/__snapshots__/Admonition.test.js.snap b/tests/unit/__snapshots__/Admonition.test.js.snap
index 057b2d1e9..eec54b076 100644
--- a/tests/unit/__snapshots__/Admonition.test.js.snap
+++ b/tests/unit/__snapshots__/Admonition.test.js.snap
@@ -1,23 +1,116 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`admonitions render correctly 1`] = `
-
-
-
+
+ .emotion-3 {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-flex-direction: column;
+ -ms-flex-direction: column;
+ flex-direction: column;
+ padding: 18px 24px 18px 52px;
+}
+
+.emotion-2 {
+ font-size: 14px;
+ line-height: 20px;
+}
+
+.emotion-6 {
+ border-radius: 6px;
+ box-shadow: 0px 2px 5px 0 rgba(33,49,60,0.1);
+ overflow: hidden;
+ position: relative;
+ color: #0D324F;
+}
+
+.emotion-6:after {
+ content: '';
+ position: absolute;
+ width: 4px;
+ left: 0px;
+ top: -1px;
+ bottom: -1px;
+ border-radius: 6px 0px 0px 6px;
+}
+
+.emotion-6:after {
+ background-color: #007CAD;
+}
+
+.emotion-1 {
+ font-family: Akzidenz,‘Helvetica Neue’,Helvetica,Arial,sans-serif;
+ font-size: 12px;
+ font-weight: bold;
+ -webkit-letter-spacing: 0.8px;
+ -moz-letter-spacing: 0.8px;
+ -ms-letter-spacing: 0.8px;
+ letter-spacing: 0.8px;
+ line-height: 16px;
+ padding: 12px 24px 12px 52px;
+ position: relative;
+ text-transform: uppercase;
+ width: 100%;
+ background-color: #E1F2F6;
+ color: #1A567E;
+}
+
+.emotion-0 {
+ color: #007CAD;
+ -webkit-flex-shrink: 0;
+ -ms-flex-negative: 0;
+ flex-shrink: 0;
+ left: 20px;
+ position: absolute;
+}
+
+.emotion-4 {
+ margin: 24px 3px 24px 0;
+}
+
+.emotion-4 > div > div > * {
+ margin: 0 0 12px;
+}
+
+.emotion-4 > div > div > *:last-child {
+ margin: 0;
+}
+
+
+
+
+
+ These instructions are for installing MongoDB directly from
+
+
+
+
`;
diff --git a/tests/unit/__snapshots__/Banner.test.js.snap b/tests/unit/__snapshots__/Banner.test.js.snap
index c79d8bdc2..383735871 100644
--- a/tests/unit/__snapshots__/Banner.test.js.snap
+++ b/tests/unit/__snapshots__/Banner.test.js.snap
@@ -1,22 +1,116 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders a Banner correctly 1`] = `
-
-
-
+
+ .emotion-4 {
+ position: relative;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ min-height: 40px;
+ padding: 9px 12px 9px 20px;
+ border-width: 1px 1px 1px 0px;
+ border-style: solid;
+ border-radius: 6px;
+ font-size: 14px;
+ line-height: 20px;
+ color: #1A567E;
+ border-color: #C5E4F2;
+ border-left-color: #007CAD;
+ background-color: #E1F2F6;
+}
+
+.emotion-4:before {
+ content: '';
+ position: absolute;
+ width: 6px;
+ top: -1px;
+ bottom: -1px;
+ left: 0px;
+ border-radius: 6px 0px 0px 6px;
+}
+
+.emotion-4:after {
+ content: '';
+ position: absolute;
+ left: 4px;
+ top: -1px;
+ bottom: -1px;
+ width: 2px;
+ border-top: 1px solid;
+ border-bottom: 1px solid;
+ border-radius: 0.5px 0px 0px 0.5px;
+}
+
+.emotion-4:before {
+ background-color: #007CAD;
+}
+
+.emotion-4:after {
+ border-color: #C5E4F2;
+ background-color: #E1F2F6;
+}
+
+.emotion-1 {
+ -webkit-align-self: center;
+ -ms-flex-item-align: center;
+ align-self: center;
+ -webkit-box-flex: 1;
+ -webkit-flex-grow: 1;
+ -ms-flex-positive: 1;
+ flex-grow: 1;
+ margin-left: 15px;
+ margin-right: 10px;
+}
+
+.emotion-0 {
+ color: #007CAD;
+ -webkit-flex-shrink: 0;
+ -ms-flex-negative: 0;
+ flex-shrink: 0;
+ -webkit-flex-shrink: 0;
+ -ms-flex-negative: 0;
+ flex-shrink: 0;
+ margin-top: 1px;
+}
+
+.emotion-2 > div > div > * {
+ margin: 0 0 12px;
+}
+
+.emotion-2 > div > div > *:last-child {
+ margin: 0;
+}
+
+.emotion-2 p {
+ margin: 0;
+}
+
+
+
+
+
+
+ These instructions are for installing MongoDB directly from
+
+
+
`;
diff --git a/tests/unit/__snapshots__/BlockQuote.test.js.snap b/tests/unit/__snapshots__/BlockQuote.test.js.snap
index 4c84c7104..93704b249 100644
--- a/tests/unit/__snapshots__/BlockQuote.test.js.snap
+++ b/tests/unit/__snapshots__/BlockQuote.test.js.snap
@@ -1,187 +1,29 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders correctly 1`] = `
-
-
- ",
- "target": "compass-index",
- "type": "role",
- },
- Object {
- "position": Object {
- "start": Object {
- "line": 29,
- },
- },
- "type": "text",
- "value": " for access through a downloadable user interface",
- },
- ],
- "position": Object {
- "start": Object {
- "line": 29,
- },
- },
- "type": "paragraph",
- },
- ],
- "position": Object {
- "start": Object {
- "line": 29,
- },
- },
- "type": "listItem",
- },
- Object {
- "children": Array [
- Object {
- "children": Array [
- Object {
- "children": Array [],
- "label": "~bin.mongo",
- "name": "binary",
- "position": Object {
- "start": Object {
- "line": 30,
- },
- },
- "raw": "~bin.mongo",
- "target": "~bin.mongo",
- "type": "role",
- },
- Object {
- "position": Object {
- "start": Object {
- "line": 30,
- },
- },
- "type": "text",
- "value": " interactive shell",
- },
- ],
- "position": Object {
- "start": Object {
- "line": 30,
- },
- },
- "type": "paragraph",
- },
- ],
- "position": Object {
- "start": Object {
- "line": 29,
- },
- },
- "type": "listItem",
- },
- Object {
- "children": Array [
- Object {
- "children": Array [
- Object {
- "children": Array [
- Object {
- "position": Object {
- "start": Object {
- "line": 31,
- },
- },
- "type": "text",
- "value": "programmatic access",
- },
- ],
- "position": Object {
- "start": Object {
- "line": 31,
- },
- },
- "type": "reference",
- },
- Object {
- "position": Object {
- "start": Object {
- "line": 31,
- },
- },
- "type": "text",
- "value": "
-through a number of programming APIs.",
- },
- ],
- "position": Object {
- "start": Object {
- "line": 31,
- },
- },
- "type": "paragraph",
- },
- ],
- "position": Object {
- "start": Object {
- "line": 29,
- },
- },
- "type": "listItem",
- },
- ],
- "ordered": false,
- "position": Object {
- "start": Object {
- "line": 29,
- },
- },
- "type": "list",
- }
- }
- />
-
+
+
+
+ There are several ways to connect to your MongoDB instance.
+
+
+
+ for access through a downloadable user interface
+
+
+ interactive shell
+
+
+
+ programmatic access
+
+
+through a number of programming APIs.
+
+
+
+
`;
diff --git a/tests/unit/__snapshots__/BreadcrumbContainer.test.js.snap b/tests/unit/__snapshots__/BreadcrumbContainer.test.js.snap
index 8724b6a7c..82bfcc7db 100644
--- a/tests/unit/__snapshots__/BreadcrumbContainer.test.js.snap
+++ b/tests/unit/__snapshots__/BreadcrumbContainer.test.js.snap
@@ -1,7 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`BreadcrumbContainer renders correctly with project parent 1`] = `
-.emotion-0:last-of-type {
+
+ .emotion-0:last-of-type {
color: #21313C;
}
@@ -16,107 +17,86 @@ exports[`BreadcrumbContainer renders correctly with project parent 1`] = `
color: #21313C;
}
-.emotion-4 {
+
+ Docs Home
+
+ .emotion-0 {
cursor: default;
}
-.emotion-4:last-of-type {
+.emotion-0:last-of-type {
+ color: #21313C;
+}
+
+
+ →
+
+ .emotion-0:last-of-type {
+ color: #21313C;
+}
+
+.emotion-0:hover,
+.emotion-0:focus {
+ -webkit-text-decoration: none;
+ text-decoration: none;
+}
+
+.emotion-0:hover:not(:last-of-type),
+.emotion-0:focus:not(:last-of-type) {
color: #21313C;
}
-
-
-
-
- Docs Home
-
-
-
-
-
- →
-
-
-
+ .emotion-0 {
+ cursor: default;
+}
+
+.emotion-0:last-of-type {
+ color: #21313C;
+}
+
+
-
-
- View & Analyze
-
-
-
-
-
- →
-
-
-
+ .emotion-0:last-of-type {
+ color: #21313C;
+}
+
+.emotion-0:hover,
+.emotion-0:focus {
+ -webkit-text-decoration: none;
+ text-decoration: none;
+}
+
+.emotion-0:hover:not(:last-of-type),
+.emotion-0:focus:not(:last-of-type) {
+ color: #21313C;
+}
+
+
-
-
-
- MongoDB Compass
-
-
-
-
-
+ MongoDB Compass
+
+
`;
exports[`BreadcrumbContainer renders correctly without project parent 1`] = `
-.emotion-0:last-of-type {
+
+ .emotion-0:last-of-type {
color: #21313C;
}
@@ -131,76 +111,45 @@ exports[`BreadcrumbContainer renders correctly without project parent 1`] = `
color: #21313C;
}
-.emotion-4 {
+
+ Docs Home
+
+ .emotion-0 {
cursor: default;
}
-.emotion-4:last-of-type {
+.emotion-0:last-of-type {
color: #21313C;
}
-
-
-
-
- Docs Home
-
-
-
-
-
- →
-
-
-
+ .emotion-0:last-of-type {
+ color: #21313C;
+}
+
+.emotion-0:hover,
+.emotion-0:focus {
+ -webkit-text-decoration: none;
+ text-decoration: none;
+}
+
+.emotion-0:hover:not(:last-of-type),
+.emotion-0:focus:not(:last-of-type) {
+ color: #21313C;
+}
+
+
-
-
-
- View & Analyze Data
-
-
-
-
-
+ View & Analyze Data
+
+
`;
diff --git a/tests/unit/__snapshots__/BreadcrumbSchema.test.js.snap b/tests/unit/__snapshots__/BreadcrumbSchema.test.js.snap
deleted file mode 100644
index 418540212..000000000
--- a/tests/unit/__snapshots__/BreadcrumbSchema.test.js.snap
+++ /dev/null
@@ -1,14 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`BreadcrumbSchema renders correctly 1`] = `
-
-
-
-`;
diff --git a/tests/unit/__snapshots__/Breadcrumbs.test.js.snap b/tests/unit/__snapshots__/Breadcrumbs.test.js.snap
index e9489f4e2..f01e6a877 100644
--- a/tests/unit/__snapshots__/Breadcrumbs.test.js.snap
+++ b/tests/unit/__snapshots__/Breadcrumbs.test.js.snap
@@ -1,90 +1,131 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders correctly with pageTitle 1`] = `
-
-
-
+
+ .emotion-6 {
+ font-size: 14px;
+ margin-bottom: 24px;
+}
+
+.emotion-6 * {
+ color: #5D6C74;
+}
+
+.emotion-6 > p {
+ margin-top: 0;
+ min-height: 24px;
+}
+
+.emotion-0:last-of-type {
+ color: #21313C;
+}
+
+.emotion-0:hover,
+.emotion-0:focus {
+ -webkit-text-decoration: none;
+ text-decoration: none;
+}
+
+.emotion-0:hover:not(:last-of-type),
+.emotion-0:focus:not(:last-of-type) {
+ color: #21313C;
+}
+
+.emotion-2 {
+ cursor: default;
+}
+
+.emotion-2:last-of-type {
+ color: #21313C;
+}
+
+
-
+
+ Docs Home
+
+
+ →
+
+
+ View & Analyze Data
+
-
-
+
+
`;
exports[`renders correctly with siteTitle 1`] = `
-
-
-
+
+ .emotion-6 {
+ font-size: 14px;
+ margin-bottom: 24px;
+}
+
+.emotion-6 * {
+ color: #5D6C74;
+}
+
+.emotion-6 > p {
+ margin-top: 0;
+ min-height: 24px;
+}
+
+.emotion-0:last-of-type {
+ color: #21313C;
+}
+
+.emotion-0:hover,
+.emotion-0:focus {
+ -webkit-text-decoration: none;
+ text-decoration: none;
+}
+
+.emotion-0:hover:not(:last-of-type),
+.emotion-0:focus:not(:last-of-type) {
+ color: #21313C;
+}
+
+.emotion-2 {
+ cursor: default;
+}
+
+.emotion-2:last-of-type {
+ color: #21313C;
+}
+
+
-
+
+ Docs Home
+
+
+ →
+
+
+ MongoDB Compass
+
-
-
+
+
`;
diff --git a/tests/unit/__snapshots__/Button.test.js.snap b/tests/unit/__snapshots__/Button.test.js.snap
index 73e7295e6..2292259ec 100644
--- a/tests/unit/__snapshots__/Button.test.js.snap
+++ b/tests/unit/__snapshots__/Button.test.js.snap
@@ -1,25 +1,115 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders correctly 1`] = `
-
-
-
+
+ .emotion-0 {
+ overflow: hidden;
+ border-radius: 3px;
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+}
+
+.emotion-2 {
+ -webkit-appearance: none;
+ -moz-appearance: none;
+ appearance: none;
+ padding: 0;
+ margin: 0;
+ background-color: transparent;
+ border: 0px solid transparent;
+ display: -webkit-inline-box;
+ display: -webkit-inline-flex;
+ display: -ms-inline-flexbox;
+ display: inline-flex;
+ -webkit-align-items: stretch;
+ -webkit-box-align: stretch;
+ -ms-flex-align: stretch;
+ align-items: stretch;
+ border-radius: 4px;
+ -webkit-transition: all 150ms ease-in-out;
+ transition: all 150ms ease-in-out;
+ position: relative;
+ -webkit-text-decoration: none;
+ text-decoration: none;
+ cursor: pointer;
+ z-index: 0;
+ background-color: #09804C;
+ box-shadow: 0px 2px 3px rgba(19,170,82,0.4);
+ color: #FFFFFF;
+ font-size: 14px;
+ height: 36px;
+}
+
+.emotion-2:focus {
+ outline: none;
+}
+
+.emotion-2:disabled {
+ pointer-events: none;
+}
+
+.emotion-2:active,
+.emotion-2:focus,
+.emotion-2:hover {
+ -webkit-text-decoration: none;
+ text-decoration: none;
+}
+
+.emotion-2:focus {
+ color: #FFFFFF;
+}
+
+.emotion-2:hover,
+.emotion-2:active {
+ color: #FFFFFF;
+ background-color: #116149;
+ box-shadow: 0px 2px 3px rgba(19,170,82,0.4),0px 0px 0px 3px #c3e7ca;
+}
+
+.emotion-2:focus {
+ background-color: #116149;
+ box-shadow: 0px 4px 4px rgba(0,124,173,0.4), 0px 0px 0px 3px #019EE2;
+}
+
+.emotion-1 {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ height: 100%;
+ width: 100%;
+ pointer-events: none;
+ position: relative;
+ z-index: 0;
+ font-family: Akzidenz,'Helvetica Neue',Helvetica,Arial,sans-serif;
+ -webkit-box-pack: center;
+ -webkit-justify-content: center;
+ -ms-flex-pack: center;
+ justify-content: center;
+ padding-left: 12px;
+ padding-right: 12px;
+}
+
+
+
+
+ Download Compass
+
+
+
`;
diff --git a/tests/unit/__snapshots__/CardRef.test.js.snap b/tests/unit/__snapshots__/CardRef.test.js.snap
index 9eb72d209..630eebc36 100644
--- a/tests/unit/__snapshots__/CardRef.test.js.snap
+++ b/tests/unit/__snapshots__/CardRef.test.js.snap
@@ -1,7 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`card correctly with and without url 1`] = `
-.emotion-44 {
+
+ .emotion-20 {
position: relative;
border-radius: 7px;
-webkit-transition: border 300ms ease-in-out,box-shadow 300ms ease-in-out;
@@ -12,7 +13,7 @@ exports[`card correctly with and without url 1`] = `
color: #21313C;
}
-.emotion-60 {
+.emotion-31 {
position: relative;
border-radius: 7px;
-webkit-transition: border 300ms ease-in-out,box-shadow 300ms ease-in-out;
@@ -24,21 +25,21 @@ exports[`card correctly with and without url 1`] = `
cursor: pointer;
}
-.emotion-60:focus {
+.emotion-31:focus {
outline: none;
box-shadow: 0 4px 10px -4px rgba(6,22,33,0.3),0 0 0 3px #9DD0E7;
}
-.emotion-60:hover {
+.emotion-31:hover {
border: 1px solid #E7EEEC;
box-shadow: 0 2px 6px -2px rgba(6,22,33,0.6);
}
-.emotion-60:hover:focus {
+.emotion-31:hover:focus {
box-shadow: 0 2px 6px -2px rgba(6,22,33,0.6),0 0 0 3px #9DD0E7;
}
-.emotion-66 {
+.emotion-32 {
-webkit-align-items: stretch;
-webkit-box-align: stretch;
-ms-flex-align: stretch;
@@ -52,27 +53,27 @@ exports[`card correctly with and without url 1`] = `
}
@media only screen and (max-width:1200px) {
- .emotion-66 {
+ .emotion-32 {
grid-template-columns: repeat(2,1fr);
}
}
@media only screen and (max-width:767px) {
- .emotion-66 {
+ .emotion-32 {
grid-template-columns: repeat(1,1fr);
grid-column-gap: 16px;
}
}
@media only screen and (max-width:420px) {
- .emotion-66 {
+ .emotion-32 {
grid-column-gap: 16px;
grid-template-columns: 'auto';
grid-row-gap: '16px';
}
}
-.emotion-42 {
+.emotion-18 {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
@@ -92,7 +93,7 @@ exports[`card correctly with and without url 1`] = `
padding: 32px 24px;
}
-.emotion-42 p:last-of-type {
+.emotion-18 p:last-of-type {
margin-bottom: 0;
}
@@ -100,7 +101,7 @@ exports[`card correctly with and without url 1`] = `
width: 24px;
}
-.emotion-40 {
+.emotion-16 {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
@@ -113,7 +114,7 @@ exports[`card correctly with and without url 1`] = `
}
@media only screen and (max-width:420px) {
- .emotion-40 {
+ .emotion-16 {
margin-left: 16px;
}
}
@@ -143,2608 +144,115 @@ exports[`card correctly with and without url 1`] = `
content: ' ➔';
}
-.emotion-54 {
+.emotion-25 {
font-weight: bold;
margin-top: auto;
}
-.emotion-54 > a:hover {
+.emotion-25 > a:hover {
color: #1A567E;
}
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ Node.js
+
+
+
+
+
+
+
-
+ MongoDB Realm
+
+
+ Discover how to sync data, define permissions, and connect to other services, including MongoDB Atlas.
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ Learn more about MongoDB Realm Application Services
+
+
+
-
-
+
+
`;
diff --git a/tests/unit/__snapshots__/Chapter.test.js.snap b/tests/unit/__snapshots__/Chapter.test.js.snap
index b684122f3..4f982892b 100644
--- a/tests/unit/__snapshots__/Chapter.test.js.snap
+++ b/tests/unit/__snapshots__/Chapter.test.js.snap
@@ -1,7 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders correctly 1`] = `
-.emotion-32 {
+
+ .emotion-20 {
position: relative;
border-radius: 7px;
-webkit-transition: border 300ms ease-in-out,box-shadow 300ms ease-in-out;
@@ -12,7 +13,7 @@ exports[`renders correctly 1`] = `
color: #21313C;
}
-.emotion-30 {
+.emotion-18 {
background-color: #FFFFFF;
border-radius: 4px;
border: 1px solid #F9FBFA;
@@ -20,7 +21,7 @@ exports[`renders correctly 1`] = `
}
@media not all and (max-width:767px) {
- .emotion-30 {
+ .emotion-18 {
display: grid;
grid-template-areas: 'description image' 'guides guides';
padding: 48px 40px;
@@ -29,19 +30,19 @@ exports[`renders correctly 1`] = `
}
@media not all and (max-width:1023px) {
- .emotion-30 {
+ .emotion-18 {
grid-column-gap: 40px;
}
}
@media not all and (max-width:1440px) {
- .emotion-30 {
+ .emotion-18 {
grid-column-gap: 50px;
}
}
@media not all and (max-width:1920px) {
- .emotion-30 {
+ .emotion-18 {
grid-column-gap: 108px;
}
}
@@ -101,7 +102,7 @@ exports[`renders correctly 1`] = `
margin-top: 8px;
}
-.emotion-28 {
+.emotion-16 {
list-style-type: none;
list-style-image: url(/assets/lightning-bolt.svg);
margin-bottom: 0;
@@ -110,7 +111,7 @@ exports[`renders correctly 1`] = `
}
@media not all and (max-width:767px) {
- .emotion-28 {
+ .emotion-16 {
grid-area: guides;
}
}
@@ -153,352 +154,73 @@ exports[`renders correctly 1`] = `
}
}
-
-
-
+
+
-
+ Chapter 1
+
+
+ Atlas
+
+
-
-
-
-
+
+ Migrate a MongoDB Replicate Set from AWS to MongoDB Atlas
+
+
+
+
+
+
+
`;
diff --git a/tests/unit/__snapshots__/DefinitionList.test.js.snap b/tests/unit/__snapshots__/DefinitionList.test.js.snap
index 877129519..6e570527e 100644
--- a/tests/unit/__snapshots__/DefinitionList.test.js.snap
+++ b/tests/unit/__snapshots__/DefinitionList.test.js.snap
@@ -1,7 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`DefinitionList renders correctly 1`] = `
-.emotion-2 {
+
+ .emotion-2 {
background-color: #F9FBFA;
border: 1px solid #B8C4C2;
border-radius: 3px;
@@ -32,21 +33,22 @@ exports[`DefinitionList renders correctly 1`] = `
}
-
-
+
+ MongoDefaultPartitioner
+
+
+
- MongoDefaultPartitioner
-
-
-
-
- Default
-
- . Wraps the MongoSamplePartitioner and provides
+
+ Default
+
+ . Wraps the MongoSamplePartitioner and provides
help for users of older versions of MongoDB.
-
-
+
+
+
`;
diff --git a/tests/unit/__snapshots__/Emphasis.test.js.snap b/tests/unit/__snapshots__/Emphasis.test.js.snap
index 5548c39ee..e8086920d 100644
--- a/tests/unit/__snapshots__/Emphasis.test.js.snap
+++ b/tests/unit/__snapshots__/Emphasis.test.js.snap
@@ -1,7 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders correctly 1`] = `
-
- Step 3
-
+
+
+ Step 3
+
+
`;
diff --git a/tests/unit/__snapshots__/Field.test.js.snap b/tests/unit/__snapshots__/Field.test.js.snap
index 68e2498f6..d49a22265 100644
--- a/tests/unit/__snapshots__/Field.test.js.snap
+++ b/tests/unit/__snapshots__/Field.test.js.snap
@@ -1,63 +1,39 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders correctly 1`] = `
-
- Returns
- :
-
-
-
-
+
+ Returns:A JSON Web Token string encoded for the provided
+ .emotion-2 {
+ background-color: #F9FBFA;
+ border: 1px solid #B8C4C2;
+ border-radius: 3px;
+ font-family: 'Source Code Pro',Menlo,monospace;
+ font-size: 14px;
+ line-height: 20px;
+ -webkit-letter-spacing: 0px;
+ -moz-letter-spacing: 0px;
+ -ms-letter-spacing: 0px;
+ letter-spacing: 0px;
+ white-space: nowrap;
+}
+
+[data-leafygreen-ui="anchor-inline-code"]:hover > .emotion-2 {
+ box-shadow: 0 0 0 3px #E7EEEC;
+}
+
+[data-leafygreen-ui="anchor-inline-code"]:focus > .emotion-2 {
+ box-shadow: 0 0 0 3px #C5E4F2;
+}
+
+.emotion-0 {
+ font-size: unset;
+}
+
+
+ payload
+
+ .
+
`;
diff --git a/tests/unit/__snapshots__/Figure.test.js.snap b/tests/unit/__snapshots__/Figure.test.js.snap
index 32b56862c..344f8c5d1 100644
--- a/tests/unit/__snapshots__/Figure.test.js.snap
+++ b/tests/unit/__snapshots__/Figure.test.js.snap
@@ -1,7 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders border correctly when specified as an option 1`] = `
-.emotion-1 {
+
+ .emotion-1 {
max-width: 100%;
}
@@ -13,19 +14,21 @@ exports[`renders border correctly when specified as an option 1`] = `
}
+ class="figure emotion-1"
+ style="width: 700px;"
+ >
+
+
+
`;
exports[`renders correctly 1`] = `
-.emotion-1 {
+
+ .emotion-1 {
max-width: 100%;
}
@@ -34,19 +37,21 @@ exports[`renders correctly 1`] = `
}
+ class="figure emotion-1"
+ style="width: 700px;"
+ >
+
+
+
`;
exports[`renders lightbox correctly when specified as an option 1`] = `
-.emotion-0 {
+
+ .emotion-0 {
max-width: 100%;
}
@@ -67,22 +72,23 @@ exports[`renders lightbox correctly when specified as an option 1`] = `
}
-
-
- click to enlarge
+
+
+ click to enlarge
+
-
+
`;
diff --git a/tests/unit/__snapshots__/Footnote.test.js.snap b/tests/unit/__snapshots__/Footnote.test.js.snap
index f735523f3..6f8ef2261 100644
--- a/tests/unit/__snapshots__/Footnote.test.js.snap
+++ b/tests/unit/__snapshots__/Footnote.test.js.snap
@@ -1,50 +1,16 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders correctly 1`] = `
-
+
-
+
`;
diff --git a/tests/unit/__snapshots__/FootnoteReference.test.js.snap b/tests/unit/__snapshots__/FootnoteReference.test.js.snap
index 061c4f9b9..f8176f0cd 100644
--- a/tests/unit/__snapshots__/FootnoteReference.test.js.snap
+++ b/tests/unit/__snapshots__/FootnoteReference.test.js.snap
@@ -1,13 +1,13 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders correctly 1`] = `
-
- [
- 1
- ]
-
+
+
+
`;
diff --git a/tests/unit/__snapshots__/GuidesLandingTree.test.js.snap b/tests/unit/__snapshots__/GuidesLandingTree.test.js.snap
index 9e39b7f9e..bb5be5147 100644
--- a/tests/unit/__snapshots__/GuidesLandingTree.test.js.snap
+++ b/tests/unit/__snapshots__/GuidesLandingTree.test.js.snap
@@ -1,38 +1,325 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders correctly 1`] = `
+
+ .emotion-1 {
+ width: 100%;
+}
+
.emotion-0 {
+ margin: 0;
+ -webkit-appearance: none;
+ -moz-appearance: none;
+ appearance: none;
+ background: none;
+ border: none;
+ cursor: pointer;
+ width: 100%;
+ min-height: 32px;
+ padding: 8px 16px;
+ box-sizing: border-box;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ font-family: Akzidenz,'Helvetica Neue',Helvetica,Arial,sans-serif;
+ font-weight: normal;
+ text-align: left;
+ -webkit-text-decoration: none;
+ text-decoration: none;
+ text-transform: capitalize;
+ color: #3D4F58;
+ -webkit-transition: background-color 150ms ease-in-out;
+ transition: background-color 150ms ease-in-out;
+ background-color: rgba(249,251,250,0);
+ font-size: 14px;
+ line-height: 1em;
+ cursor: default;
+ font-weight: bold;
+ -webkit-text-decoration: none;
+ text-decoration: none;
+ position: relative;
padding-left: 24px;
padding-right: 24px;
}
-
-
- Overview
-
-
+ Overview
+
+
+ .emotion-1 {
+ width: 100%;
+}
+
+.emotion-0 {
+ margin: 0;
+ -webkit-appearance: none;
+ -moz-appearance: none;
+ appearance: none;
+ background: none;
+ border: none;
+ cursor: pointer;
+ width: 100%;
+ min-height: 32px;
+ padding: 8px 16px;
+ box-sizing: border-box;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ font-family: Akzidenz,'Helvetica Neue',Helvetica,Arial,sans-serif;
+ font-weight: normal;
+ text-align: left;
+ -webkit-text-decoration: none;
+ text-decoration: none;
+ text-transform: capitalize;
+ color: #3D4F58;
+ -webkit-transition: background-color 150ms ease-in-out;
+ transition: background-color 150ms ease-in-out;
+ background-color: rgba(249,251,250,0);
+ font-size: 14px;
+ line-height: 1em;
+ position: relative;
+ padding-left: 24px;
+ padding-right: 24px;
+}
+
+.emotion-0:hover {
+ background-color: #E7EEEC;
+ -webkit-text-decoration: none;
+ text-decoration: none;
+}
+
+.emotion-0:focus {
+ -webkit-text-decoration: none;
+ text-decoration: none;
+ outline: none;
+}
+
+.emotion-0::-moz-focus-inner {
+ border: 0;
+}
+
+.emotion-0:before {
+ -webkit-transition: all 150ms ease-in-out;
+ transition: all 150ms ease-in-out;
+ content: '';
+ -webkit-transform: scaleY(0.3);
+ -ms-transform: scaleY(0.3);
+ transform: scaleY(0.3);
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ width: 3px;
+ height: 20px;
+ margin: auto;
+ background-color: #019EE2;
+ opacity: 0;
+ border-radius: 0 3px 3px 0;
+}
+
+.emotion-0:focus {
+ -webkit-text-decoration: none;
+ text-decoration: none;
+ color: #0D324F;
+ background-color: #C5E4F2;
+}
+
+.emotion-0:focus:before {
+ opacity: 1;
+ -webkit-transform: scaleY(1);
+ -ms-transform: scaleY(1);
+ transform: scaleY(1);
+}
+
+
- Atlas
-
-
+ Atlas
+
+
+ .emotion-1 {
+ width: 100%;
+}
+
+.emotion-0 {
+ margin: 0;
+ -webkit-appearance: none;
+ -moz-appearance: none;
+ appearance: none;
+ background: none;
+ border: none;
+ cursor: pointer;
+ width: 100%;
+ min-height: 32px;
+ padding: 8px 16px;
+ box-sizing: border-box;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ font-family: Akzidenz,'Helvetica Neue',Helvetica,Arial,sans-serif;
+ font-weight: normal;
+ text-align: left;
+ -webkit-text-decoration: none;
+ text-decoration: none;
+ text-transform: capitalize;
+ color: #3D4F58;
+ -webkit-transition: background-color 150ms ease-in-out;
+ transition: background-color 150ms ease-in-out;
+ background-color: rgba(249,251,250,0);
+ font-size: 14px;
+ line-height: 1em;
+ position: relative;
+ padding-left: 24px;
+ padding-right: 24px;
+}
+
+.emotion-0:hover {
+ background-color: #E7EEEC;
+ -webkit-text-decoration: none;
+ text-decoration: none;
+}
+
+.emotion-0:focus {
+ -webkit-text-decoration: none;
+ text-decoration: none;
+ outline: none;
+}
+
+.emotion-0::-moz-focus-inner {
+ border: 0;
+}
+
+.emotion-0:before {
+ -webkit-transition: all 150ms ease-in-out;
+ transition: all 150ms ease-in-out;
+ content: '';
+ -webkit-transform: scaleY(0.3);
+ -ms-transform: scaleY(0.3);
+ transform: scaleY(0.3);
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ width: 3px;
+ height: 20px;
+ margin: auto;
+ background-color: #019EE2;
+ opacity: 0;
+ border-radius: 0 3px 3px 0;
+}
+
+.emotion-0:focus {
+ -webkit-text-decoration: none;
+ text-decoration: none;
+ color: #0D324F;
+ background-color: #C5E4F2;
+}
+
+.emotion-0:focus:before {
+ opacity: 1;
+ -webkit-transform: scaleY(1);
+ -ms-transform: scaleY(1);
+ transform: scaleY(1);
+}
+
+
- CRUD
-
-
+
+ CRUD
+
+
+
`;
diff --git a/tests/unit/__snapshots__/Heading.test.js.snap b/tests/unit/__snapshots__/Heading.test.js.snap
index e6dc68c0f..bd4218821 100644
--- a/tests/unit/__snapshots__/Heading.test.js.snap
+++ b/tests/unit/__snapshots__/Heading.test.js.snap
@@ -1,7 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders correctly 1`] = `
-.emotion-0 {
+
+ .emotion-0 {
-webkit-align-self: center;
-ms-flex-item-align: center;
align-self: center;
@@ -15,22 +16,23 @@ exports[`renders correctly 1`] = `
}
+
+
`;
diff --git a/tests/unit/__snapshots__/InternalPageNav.test.js.snap b/tests/unit/__snapshots__/InternalPageNav.test.js.snap
index ab7e8ea79..d11e2fee3 100644
--- a/tests/unit/__snapshots__/InternalPageNav.test.js.snap
+++ b/tests/unit/__snapshots__/InternalPageNav.test.js.snap
@@ -1,78 +1,84 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders a page with next and previous links correctly 1`] = `
-
+
`;
exports[`renders a page with no next link correctly 1`] = `
-
+
`;
exports[`renders a page with no previous link correctly 1`] = `
-
+
`;
diff --git a/tests/unit/__snapshots__/Line.test.js.snap b/tests/unit/__snapshots__/Line.test.js.snap
index a16aec9a7..ea6e6be10 100644
--- a/tests/unit/__snapshots__/Line.test.js.snap
+++ b/tests/unit/__snapshots__/Line.test.js.snap
@@ -1,40 +1,51 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders an empty Line node correctly 1`] = `
-
-
-
+
+
+
+
+
`;
exports[`renders correctly 1`] = `
+
+ .emotion-2 {
+ background-color: #F9FBFA;
+ border: 1px solid #B8C4C2;
+ border-radius: 3px;
+ font-family: 'Source Code Pro',Menlo,monospace;
+ font-size: 14px;
+ line-height: 20px;
+ -webkit-letter-spacing: 0px;
+ -moz-letter-spacing: 0px;
+ -ms-letter-spacing: 0px;
+ letter-spacing: 0px;
+ white-space: nowrap;
+}
+
+[data-leafygreen-ui="anchor-inline-code"]:hover > .emotion-2 {
+ box-shadow: 0 0 0 3px #E7EEEC;
+}
+
+[data-leafygreen-ui="anchor-inline-code"]:focus > .emotion-2 {
+ box-shadow: 0 0 0 3px #C5E4F2;
+}
+
+.emotion-0 {
+ font-size: unset;
+}
+
-
-
+ class="line"
+ >
+
+ N. Virginia (us-east-1)
+
+
+
`;
diff --git a/tests/unit/__snapshots__/LineBlock.test.js.snap b/tests/unit/__snapshots__/LineBlock.test.js.snap
index 707f04501..b94cb639d 100644
--- a/tests/unit/__snapshots__/LineBlock.test.js.snap
+++ b/tests/unit/__snapshots__/LineBlock.test.js.snap
@@ -1,22 +1,11 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders correctly 1`] = `
-
-
-
+
+
+ N. Virginia (us-east-1)
+
+
`;
diff --git a/tests/unit/__snapshots__/Link.test.js.snap b/tests/unit/__snapshots__/Link.test.js.snap
index b662238c1..65b91946a 100644
--- a/tests/unit/__snapshots__/Link.test.js.snap
+++ b/tests/unit/__snapshots__/Link.test.js.snap
@@ -1,61 +1,75 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Link component renders a variety of strings correctly empty string 1`] = `
-
- Empty string
-
+
+
+ Empty string
+
+
`;
exports[`Link component renders a variety of strings correctly external URL 1`] = `
-
- MongoDB Company
-
+
+
+ MongoDB Company
+
+
`;
exports[`Link component renders a variety of strings correctly identfies mailto links as external urls 1`] = `
-
- docs@mongodb.com
-
+
+
+ docs@mongodb.com
+
+
`;
exports[`Link component renders a variety of strings correctly internal link 1`] = `
-
- C Driver
-
+
+
+ C Driver
+
+
`;
exports[`Link component renders a variety of strings correctly internal link query param 1`] = `
-
- C Driver
-
+
+
+ C Driver
+
+
`;
exports[`Link component renders a variety of strings correctly internal link that already includes trailing slash 1`] = `
-
- C Driver
-
+
+
+ C Driver
+
+
`;
exports[`Link component renders a variety of strings correctly internal link with hash 1`] = `
-
- C Driver
-
+
+
+ C Driver
+
+
`;
diff --git a/tests/unit/__snapshots__/List.test.js.snap b/tests/unit/__snapshots__/List.test.js.snap
index aec65b9d7..80e02925d 100644
--- a/tests/unit/__snapshots__/List.test.js.snap
+++ b/tests/unit/__snapshots__/List.test.js.snap
@@ -1,29 +1,31 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`List renders correctly 1`] = `
-
-
- In , click
-
- Charts
-
- in the navigation bar.
-
-
- If this is the first time you are launching , click
+
+
+
+ In , click
+
+ Charts
+
+ in the navigation bar.
+
+
+ If this is the first time you are launching , click
-
- Activate MongoDB Charts
-
- . This provisions a new
+
+ Activate MongoDB Charts
+
+ . This provisions a new
instance in the project.
-
-
+
+
+
`;
diff --git a/tests/unit/__snapshots__/Literal.test.js.snap b/tests/unit/__snapshots__/Literal.test.js.snap
index b42783db3..a206e1059 100644
--- a/tests/unit/__snapshots__/Literal.test.js.snap
+++ b/tests/unit/__snapshots__/Literal.test.js.snap
@@ -1,20 +1,37 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders correctly 1`] = `
-
-
-
+
+ .emotion-2 {
+ background-color: #F9FBFA;
+ border: 1px solid #B8C4C2;
+ border-radius: 3px;
+ font-family: 'Source Code Pro',Menlo,monospace;
+ font-size: 14px;
+ line-height: 20px;
+ -webkit-letter-spacing: 0px;
+ -moz-letter-spacing: 0px;
+ -ms-letter-spacing: 0px;
+ letter-spacing: 0px;
+ white-space: nowrap;
+}
+
+[data-leafygreen-ui="anchor-inline-code"]:hover > .emotion-2 {
+ box-shadow: 0 0 0 3px #E7EEEC;
+}
+
+[data-leafygreen-ui="anchor-inline-code"]:focus > .emotion-2 {
+ box-shadow: 0 0 0 3px #C5E4F2;
+}
+
+.emotion-0 {
+ font-size: unset;
+}
+
+
+ N. Virginia (us-east-1)
+
+
`;
diff --git a/tests/unit/__snapshots__/LiteralInclude.test.js.snap b/tests/unit/__snapshots__/LiteralInclude.test.js.snap
index 04a39d80f..cc2f253ac 100644
--- a/tests/unit/__snapshots__/LiteralInclude.test.js.snap
+++ b/tests/unit/__snapshots__/LiteralInclude.test.js.snap
@@ -1,23 +1,197 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders correctly 1`] = `
-
+ .emotion-1 {
+ border-spacing: 0;
+ vertical-align: top;
+ padding: 0 16px;
+}
+
+.emotion-4 {
+ color: inherit;
+ font-size: 13px;
+ font-family: 'Source Code Pro',Menlo,monospace;
+ line-height: 24px;
+}
+
+.emotion-5 {
+ border: 2px solid;
+ overflow-x: auto;
+ border-radius: 0;
+ border: 0;
+ padding-top: 8px;
+ padding-bottom: 8px;
+ margin: 0;
+ position: relative;
+ -webkit-box-flex: 1;
+ -webkit-flex-grow: 1;
+ -ms-flex-positive: 1;
+ flex-grow: 1;
+ white-space: pre;
+ border-color: #E7EEEC;
+ background-color: #F9FBFA;
+ color: #061621;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ padding-top: 6px;
+ padding-bottom: 6px;
+}
+
+@media only screen and (max-device-width:812px) and (-webkit-min-device-pixel-ratio:2) {
+ .emotion-5 {
+ white-space: pre-wrap;
+ }
+}
+
+@media only screen and (min-device-width:813px) and (-webkit-min-device-pixel-ratio:2) {
+ .emotion-5 {
+ white-space: pre;
}
-/>
+}
+
+.emotion-8 {
+ border: 1px solid #E7EEEC;
+ border-radius: 4px;
+ overflow: hidden;
+}
+
+.emotion-7 {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+}
+
+.emotion-3 {
+ border-spacing: 0;
+ width: 100%;
+}
+
+.emotion-2 {
+ background-color: #FEF7E3;
+ background-image: none;
+ background-attachment: fixed;
+}
+
+.emotion-2 > td {
+ border-top: 1px solid #FEF2C8;
+}
+
+.emotion-2 + tr > td {
+ border-top: 1px solid #FEF2C8;
+}
+
+.emotion-2 + .emotion-2 > td {
+ border-top: 0;
+}
+
+.emotion-2:last-child > td {
+ border-bottom: 1px solid #FEF2C8;
+}
+
+.emotion-0 {
+ border-spacing: 0;
+ vertical-align: top;
+ padding: 0 16px;
+ -webkit-user-select: none;
+ -moz-user-select: none;
+ -ms-user-select: none;
+ user-select: none;
+ text-align: right;
+ padding-left: 8px;
+ padding-right: 0;
+ color: #86681D;
+}
+
+.emotion-6 {
+ width: 38px;
+ border-left: solid 1px;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-flex-direction: column;
+ -ms-flex-direction: column;
+ flex-direction: column;
+ -webkit-flex-shrink: 0;
+ -ms-flex-negative: 0;
+ flex-shrink: 0;
+ padding-top: 6px;
+ min-height: 36px;
+ padding-top: 4px;
+ min-height: 36px;
+ padding-top: 4px;
+ border-color: #E7EEEC;
+ background-color: white;
+}
+
+.emotion-9 {
+ display: table;
+ margin: 16px 0;
+ min-width: 150px;
+ table-layout: fixed;
+ width: 100%;
+}
+
+.emotion-9 > div > div {
+ width: unset;
+}
+
+.emotion-9 button > div > div {
+ font-size: 16px;
+}
+
+
+
+
+
+
+
+
+
+
+ 1
+
+
+ sample code
+
+
+
+
+
+
+
+
+
+
+
`;
diff --git a/tests/unit/__snapshots__/MongoWebShell.test.js.snap b/tests/unit/__snapshots__/MongoWebShell.test.js.snap
index 3be074a4e..9ba8d17d0 100644
--- a/tests/unit/__snapshots__/MongoWebShell.test.js.snap
+++ b/tests/unit/__snapshots__/MongoWebShell.test.js.snap
@@ -1,33 +1,37 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`correctly renders a MongoDB Web Shell 1`] = `
-.emotion-0 {
+
+ .emotion-0 {
border: 0;
}
+ allowfullscreen=""
+ class="emotion-0"
+ height="320"
+ sandbox="allow-scripts allow-same-origin"
+ src="https://mws.mongodb.com/"
+ title="MongoDB Web Shell"
+ width="100%"
+ />
+
`;
exports[`correctly renders a MongoDB Web Shell v4.2.9 1`] = `
-.emotion-0 {
+
+ .emotion-0 {
border: 0;
}
+ allowfullscreen=""
+ class="emotion-0"
+ height="320"
+ sandbox="allow-scripts allow-same-origin"
+ src="https://mws.mongodb.com/?version=4.2"
+ title="MongoDB Web Shell"
+ width="100%"
+ />
+
`;
diff --git a/tests/unit/__snapshots__/Paragraph.test.js.snap b/tests/unit/__snapshots__/Paragraph.test.js.snap
index e3d941d37..39ddab488 100644
--- a/tests/unit/__snapshots__/Paragraph.test.js.snap
+++ b/tests/unit/__snapshots__/Paragraph.test.js.snap
@@ -1,21 +1,10 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders correctly 1`] = `
-
-
-
+
+
+ Verify that MongoDB has started successfully by
+checking the process output for the following line:
+
+
`;
diff --git a/tests/unit/__snapshots__/Procedure.test.js.snap b/tests/unit/__snapshots__/Procedure.test.js.snap
index 8e55161ea..ca1b94aab 100644
--- a/tests/unit/__snapshots__/Procedure.test.js.snap
+++ b/tests/unit/__snapshots__/Procedure.test.js.snap
@@ -1,176 +1,124 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders correctly 1`] = `
-
-
-
-
+
+ .emotion-12 {
+ max-width: 500px;
+ padding-left: 32px;
+}
+
+@media only screen and (max-width:1023px) {
+ .emotion-12 {
+ padding-bottom: 32px;
+ }
+}
+
+@media only screen and (max-width:420px) {
+ .emotion-12 {
+ padding-bottom: 24px;
+ }
+}
+
+.emotion-4 {
+ padding-left: 50px;
+}
+
+.emotion-4:not(.emotion-4:last-child) {
+ border-left: dashed;
+ border-color: #E7EEEC;
+ border-width: 2px;
+ padding-bottom: 64px;
+}
+
+@media only screen and (max-width:767px) {
+ .emotion-4:not(.emotion-4:last-child) {
+ padding-bottom: 40px;
+ }
+}
+
+@media only screen and (max-width:420px) {
+ .emotion-4:not(.emotion-4:last-child) {
+ padding-bottom: 32px;
+ }
+}
+
+.emotion-4 > p > a {
+ font-weight: 600;
+}
+
+.emotion-2 {
+ background: #E4F4E4;
+ width: 34px;
+ height: 34px;
+ border-radius: 50%;
+ margin-bottom: -29px;
+ margin-left: -67px;
+ text-align: center;
+}
+
+.emotion-0 {
+ font-weight: bold;
+ font-size: 16px;
+ color: #116149;
+ margin: auto;
+ padding-top: 6px;
+}
+
+
+
`;
diff --git a/tests/unit/__snapshots__/QuizWidget.test.js.snap b/tests/unit/__snapshots__/QuizWidget.test.js.snap
index 451fa6b6c..f4a757c38 100644
--- a/tests/unit/__snapshots__/QuizWidget.test.js.snap
+++ b/tests/unit/__snapshots__/QuizWidget.test.js.snap
@@ -2,6 +2,283 @@
exports[`doesnt render quiz widget without a specified question 1`] = `""`;
+exports[`quiz widget snapshots doesnt render quiz widget without a specified question 1`] = ` `;
+
+exports[`quiz widget snapshots renders quiz widget correctly 1`] = `
+
+ .emotion-0 {
+ color: #13AA52;
+}
+
+.emotion-18 {
+ overflow: hidden;
+ border-radius: 3px;
+ position: absolute;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+}
+
+.emotion-25 {
+ position: relative;
+ border-radius: 7px;
+ -webkit-transition: border 300ms ease-in-out,box-shadow 300ms ease-in-out;
+ transition: border 300ms ease-in-out,box-shadow 300ms ease-in-out;
+ border: 1px solid #E7EEEC;
+ box-shadow: 0 4px 10px -4px rgba(6,22,33,0.3);
+ background-color: white;
+ color: #21313C;
+}
+
+.emotion-11 {
+ position: relative;
+ border-radius: 7px;
+ -webkit-transition: border 300ms ease-in-out,box-shadow 300ms ease-in-out;
+ transition: border 300ms ease-in-out,box-shadow 300ms ease-in-out;
+ border: 1px solid #E7EEEC;
+ box-shadow: 0 4px 10px -4px rgba(6,22,33,0.3);
+ background-color: white;
+ color: #21313C;
+ cursor: pointer;
+ box-shadow: none !important;
+ margin: auto auto 16px auto;
+ padding: 16px;
+}
+
+.emotion-11:focus {
+ outline: none;
+ box-shadow: 0 4px 10px -4px rgba(6,22,33,0.3),0 0 0 3px #9DD0E7;
+}
+
+.emotion-11:hover {
+ border: 1px solid #E7EEEC;
+ box-shadow: 0 2px 6px -2px rgba(6,22,33,0.6);
+}
+
+.emotion-11:hover:focus {
+ box-shadow: 0 2px 6px -2px rgba(6,22,33,0.6),0 0 0 3px #9DD0E7;
+}
+
+.emotion-11:hover {
+ border-color: #061621 !important;
+}
+
+.emotion-20 {
+ -webkit-appearance: none;
+ -moz-appearance: none;
+ appearance: none;
+ padding: 0;
+ margin: 0;
+ background-color: transparent;
+ border: 0px solid transparent;
+ display: -webkit-inline-box;
+ display: -webkit-inline-flex;
+ display: -ms-inline-flexbox;
+ display: inline-flex;
+ -webkit-align-items: stretch;
+ -webkit-box-align: stretch;
+ -ms-flex-align: stretch;
+ align-items: stretch;
+ border-radius: 4px;
+ -webkit-transition: all 150ms ease-in-out;
+ transition: all 150ms ease-in-out;
+ position: relative;
+ -webkit-text-decoration: none;
+ text-decoration: none;
+ cursor: pointer;
+ z-index: 0;
+ background-color: #F9FBFA;
+ border: 1px solid #89979B;
+ box-shadow: 0px 1px 2px rgba(6,22,33,0.3);
+ color: #3D4F58;
+ font-size: 14px;
+ height: 36px;
+}
+
+.emotion-20:focus {
+ outline: none;
+}
+
+.emotion-20:disabled {
+ pointer-events: none;
+}
+
+.emotion-20:active,
+.emotion-20:focus,
+.emotion-20:hover {
+ -webkit-text-decoration: none;
+ text-decoration: none;
+}
+
+.emotion-20:focus {
+ color: #3D4F58;
+}
+
+.emotion-20:hover,
+.emotion-20:active {
+ color: #3D4F58;
+ background-color: #FFFFFF;
+ border: 1px solid #5D6C74;
+ box-shadow: 0px 4px 4px rgba(0,0,0,0.3), 0px 0px 0px 3px #E7EEEC;
+}
+
+.emotion-20:focus {
+ background: #FFFFFF;
+ border: 1px solid #5D6C74;
+ box-shadow: 0px 4px 4px rgba(0,124,173,0.4), 0px 0px 0px 3px #019EE2;
+}
+
+.emotion-19 {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ height: 100%;
+ width: 100%;
+ pointer-events: none;
+ position: relative;
+ z-index: 0;
+ font-family: Akzidenz,'Helvetica Neue',Helvetica,Arial,sans-serif;
+ -webkit-box-pack: center;
+ -webkit-justify-content: center;
+ -ms-flex-pack: center;
+ justify-content: center;
+ padding-left: 12px;
+ padding-right: 12px;
+}
+
+.emotion-23 {
+ background-color: #F9FBFA;
+ width: 100%;
+ padding: 40px;
+}
+
+@media not all and (max-width:420px) {
+ .emotion-3 {
+ text-align: center;
+ }
+}
+
+.emotion-1 {
+ margin: 0 0 32px 0 !important;
+ font-weight: 500;
+ font-size: 18px;
+}
+
+.emotion-5 {
+ font-weight: 500;
+ font-size: 14px;
+ line-height: 16.59px;
+ color: #89979B;
+ margin: 0 !important;
+}
+
+.emotion-7 {
+ margin: 8px 0 24px 0 !important;
+}
+
+.emotion-9 {
+ height: 10px;
+ width: 10px;
+ background-color: white;
+ border-color: black;
+ border-radius: 50%;
+ display: inline-block;
+ border-style: solid;
+ border-width: thin;
+ margin-right: 16px;
+}
+
+.emotion-21 {
+ font-size: 16px;
+}
+
+
+
+
+
+
+
+ Check your understanding
+
+
+
+ Question
+
+
+ With my MongoDB account, I can now access?
+
+
+
+ MongoDB Atlas
+
+
+
+ MongoDB University
+
+
+
+ All of the Above
+
+
+
+
+ Submit
+
+
+
+
+`;
+
exports[`renders quiz widget correctly 1`] = `
diff --git a/tests/unit/__snapshots__/Reference.test.js.snap b/tests/unit/__snapshots__/Reference.test.js.snap
index f4732683d..1e0f941fa 100644
--- a/tests/unit/__snapshots__/Reference.test.js.snap
+++ b/tests/unit/__snapshots__/Reference.test.js.snap
@@ -1,10 +1,12 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders correctly 1`] = `
-
- mLab documentation
-
+
+
+ mLab documentation
+
+
`;
diff --git a/tests/unit/__snapshots__/ReleaseSpecification.test.js.snap b/tests/unit/__snapshots__/ReleaseSpecification.test.js.snap
index ece9baf31..8cf8cf99a 100644
--- a/tests/unit/__snapshots__/ReleaseSpecification.test.js.snap
+++ b/tests/unit/__snapshots__/ReleaseSpecification.test.js.snap
@@ -1,7 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders correctly 1`] = `
-.emotion-0 {
+
+ .emotion-0 {
border-spacing: 0;
vertical-align: top;
padding: 0 16px;
@@ -112,43 +113,44 @@ exports[`renders correctly 1`] = `
}
-
-
-
-
-
-
-
+
+
- test code
-
-
-
-
-
-
-
+
+ test code
+
+
+
+
+
+
+
+
-
+
`;
diff --git a/tests/unit/__snapshots__/Role.test.js.snap b/tests/unit/__snapshots__/Role.test.js.snap
index 907f36531..ec20cee59 100644
--- a/tests/unit/__snapshots__/Role.test.js.snap
+++ b/tests/unit/__snapshots__/Role.test.js.snap
@@ -1,7 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Abbr correctly renders a "Abbr" role 1`] = `
-.emotion-0 {
+
+ .emotion-0 {
position: relative;
background-repeat: repeat-x;
background-position: center bottom;
@@ -14,28 +15,33 @@ exports[`Abbr correctly renders a "Abbr" role 1`] = `
}
- Display
-
+ class="emotion-0"
+ >
+ Display
+
+
`;
exports[`File correctly renders a "file" role 1`] = `
-
-
+
- examples/treasury_yield/src/main/resources/yield_historical_in.json
-
-
+
+ examples/treasury_yield/src/main/resources/yield_historical_in.json
+
+
+
`;
exports[`GUI Label correctly renders a "guilabel" role 1`] = `
-
- Yes
-
+
+
+ Yes
+
+
`;
diff --git a/tests/unit/__snapshots__/Section.test.js.snap b/tests/unit/__snapshots__/Section.test.js.snap
index 5872b23e7..657a097f7 100644
--- a/tests/unit/__snapshots__/Section.test.js.snap
+++ b/tests/unit/__snapshots__/Section.test.js.snap
@@ -1,105 +1,40 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders correctly 1`] = `
+
+ .emotion-0 {
+ -webkit-align-self: center;
+ -ms-flex-item-align: center;
+ align-self: center;
+ visibility: hidden;
+ padding: 0 10px;
+}
+
+.emotion-1 {
+ margin-top: -225px;
+ position: absolute;
+}
+
+
+
+
`;
diff --git a/tests/unit/__snapshots__/SiteBanner.test.js.snap b/tests/unit/__snapshots__/SiteBanner.test.js.snap
index 9c3f848f9..2656a599b 100644
--- a/tests/unit/__snapshots__/SiteBanner.test.js.snap
+++ b/tests/unit/__snapshots__/SiteBanner.test.js.snap
@@ -1,7 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Banner component renders with a banner image 1`] = `
-.emotion-2 {
+
+ .emotion-2 {
display: block;
height: 40px;
width: 100vw;
@@ -20,25 +21,14 @@ exports[`Banner component renders with a banner image 1`] = `
}
}
-
-
-
-
-
-
-
-
-
+
+
+
`;
diff --git a/tests/unit/__snapshots__/Step.test.js.snap b/tests/unit/__snapshots__/Step.test.js.snap
index 9973b0ef0..e08cca861 100644
--- a/tests/unit/__snapshots__/Step.test.js.snap
+++ b/tests/unit/__snapshots__/Step.test.js.snap
@@ -1,91 +1,75 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders correctly 1`] = `
-
-
-
-
-
-
-
-
-
-
+
+ .emotion-4 {
+ padding-left: 50px;
+}
+
+.emotion-4:not(.emotion-4:last-child) {
+ border-left: dashed;
+ border-color: #E7EEEC;
+ border-width: 2px;
+ padding-bottom: 64px;
+}
+
+@media only screen and (max-width:767px) {
+ .emotion-4:not(.emotion-4:last-child) {
+ padding-bottom: 40px;
+ }
+}
+
+@media only screen and (max-width:420px) {
+ .emotion-4:not(.emotion-4:last-child) {
+ padding-bottom: 32px;
+ }
+}
+
+.emotion-4 > p > a {
+ font-weight: 600;
+}
+
+.emotion-2 {
+ background: #E4F4E4;
+ width: 34px;
+ height: 34px;
+ border-radius: 50%;
+ margin-bottom: -29px;
+ margin-left: -67px;
+ text-align: center;
+}
+
+.emotion-0 {
+ font-weight: bold;
+ font-size: 16px;
+ color: #116149;
+ margin: auto;
+ padding-top: 6px;
+}
+
+
+
`;
diff --git a/tests/unit/__snapshots__/StepYAML.test.js.snap b/tests/unit/__snapshots__/StepYAML.test.js.snap
index 4ebe830fe..2d3a20538 100644
--- a/tests/unit/__snapshots__/StepYAML.test.js.snap
+++ b/tests/unit/__snapshots__/StepYAML.test.js.snap
@@ -1,117 +1,57 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders correctly 1`] = `
+
+ .emotion-0 {
+ -webkit-align-self: center;
+ -ms-flex-item-align: center;
+ align-self: center;
+ visibility: hidden;
+ padding: 0 10px;
+}
+
+.emotion-1 {
+ margin-top: -225px;
+ position: absolute;
+}
+
+
`;
diff --git a/tests/unit/__snapshots__/Strong.test.js.snap b/tests/unit/__snapshots__/Strong.test.js.snap
index 6005dac1c..0f225ea15 100644
--- a/tests/unit/__snapshots__/Strong.test.js.snap
+++ b/tests/unit/__snapshots__/Strong.test.js.snap
@@ -1,7 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders correctly 1`] = `
-
- first
-
+
+
+ first
+
+
`;
diff --git a/tests/unit/__snapshots__/Target.test.js.snap b/tests/unit/__snapshots__/Target.test.js.snap
index 2660f040c..55e332b3f 100644
--- a/tests/unit/__snapshots__/Target.test.js.snap
+++ b/tests/unit/__snapshots__/Target.test.js.snap
@@ -1,7 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders correctly with a directive_argument node 1`] = `
-.emotion-2 {
+
+ .emotion-2 {
background-color: #F9FBFA;
border: 1px solid #B8C4C2;
border-radius: 3px;
@@ -28,70 +29,73 @@ exports[`renders correctly with a directive_argument node 1`] = `
}
-
-
- --config <filename>, -f <filename>
-
-
-
-
-
- Specifies a configuration file for runtime configuration options. The
-configuration file is the preferred method for runtime configuration of
-
-
-
- mongos
-
-
- . The options are equivalent to the command-line
-configuration options. See
+ --config <filename>, -f <filename>
+
- for
+
+
+
+ Specifies a configuration file for runtime configuration options. The
+configuration file is the preferred method for runtime configuration of
+
+
+
+ mongos
+
+
+ . The options are equivalent to the command-line
+configuration options. See
+
+ Configuration File Options
+
+ for
more information.
-
-
- Ensure the configuration file uses ASCII encoding. The
-
-
+
+ Ensure the configuration file uses ASCII encoding. The
+
- mongos
-
-
-
+
+ mongos
+
+
+
instance does not support configuration files with non-ASCII encoding,
including UTF-8.
-
-
-
+
+
+
+
`;
exports[`renders correctly with no directive_argument nodes 1`] = `
-
+
+
+
`;
diff --git a/tests/unit/__snapshots__/Text.test.js.snap b/tests/unit/__snapshots__/Text.test.js.snap
index 7adf8a645..d2235be39 100644
--- a/tests/unit/__snapshots__/Text.test.js.snap
+++ b/tests/unit/__snapshots__/Text.test.js.snap
@@ -1,7 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders correctly 1`] = `
-
+
MongoDB offers both a Community and an Enterprise version
-
+
`;
diff --git a/tests/unit/__snapshots__/TitleReference.test.js.snap b/tests/unit/__snapshots__/TitleReference.test.js.snap
index e9faff268..4af6ccd7c 100644
--- a/tests/unit/__snapshots__/TitleReference.test.js.snap
+++ b/tests/unit/__snapshots__/TitleReference.test.js.snap
@@ -1,7 +1,9 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders correctly 1`] = `
-
- admin
-
+
+
+ admin
+
+
`;
diff --git a/tests/unit/__snapshots__/VersionModified.test.js.snap b/tests/unit/__snapshots__/VersionModified.test.js.snap
index cb8a0447e..375336a91 100644
--- a/tests/unit/__snapshots__/VersionModified.test.js.snap
+++ b/tests/unit/__snapshots__/VersionModified.test.js.snap
@@ -1,149 +1,79 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`when rendering a deprecated directive with 0 arguments renders correctly 1`] = `
+
+ .emotion-2 {
+ background-color: #F9FBFA;
+ border: 1px solid #B8C4C2;
+ border-radius: 3px;
+ font-family: 'Source Code Pro',Menlo,monospace;
+ font-size: 14px;
+ line-height: 20px;
+ -webkit-letter-spacing: 0px;
+ -moz-letter-spacing: 0px;
+ -ms-letter-spacing: 0px;
+ letter-spacing: 0px;
+ white-space: nowrap;
+}
+
+[data-leafygreen-ui="anchor-inline-code"]:hover > .emotion-2 {
+ box-shadow: 0 0 0 3px #E7EEEC;
+}
+
+[data-leafygreen-ui="anchor-inline-code"]:focus > .emotion-2 {
+ box-shadow: 0 0 0 3px #C5E4F2;
+}
+
+.emotion-0 {
+ font-size: unset;
+}
+
-
-
- Deprecated
-
- :
-
-
-
+
+
+ Deprecated
+
+ :
+
+ replicationFactor
+
+ is deprecated. Use
+
+
+ replicationSpecs
+
+ .
+
+
+
`;
exports[`when rendering a versionadded directive with one argument renders correctly 1`] = `
-
-
-
- New
- in version
-
-
- .
-
-
+
+
+
+
+ New in version 2.2
+
+ .
+
+
+
`;
exports[`when rendering a versionchanged directive with two arguments renders correctly 1`] = `
-
-
-
- Changed
- in version
-
-
- :
-
-
-
-
+
+
+
+
+ Changed in version 2.2
+
+ : To bind to multiple IP addresses, enter a list of comma separated values.
+
+
+
`;
From cadbab899e3b1388698ccc440ef440d8b1a070c6 Mon Sep 17 00:00:00 2001
From: Cassidy Schaufele
Date: Tue, 11 Jan 2022 00:06:01 -0700
Subject: [PATCH 02/10] DOP-2642: Add ThemeProvider to all deeply referenced
renders
---
tests/unit/Card.test.js | 9 +-
tests/unit/CardGroup.test.js | 9 +-
tests/unit/FieldList.test.js | 9 +-
tests/unit/__snapshots__/Card.test.js.snap | 145 +++++--
.../unit/__snapshots__/CardGroup.test.js.snap | 403 +++++++++++-------
.../unit/__snapshots__/FieldList.test.js.snap | 152 +++----
.../__snapshots__/QuizWidget.test.js.snap | 201 ---------
7 files changed, 453 insertions(+), 475 deletions(-)
diff --git a/tests/unit/Card.test.js b/tests/unit/Card.test.js
index 753eaabdd..fc762300d 100644
--- a/tests/unit/Card.test.js
+++ b/tests/unit/Card.test.js
@@ -1,11 +1,16 @@
import React from 'react';
import { render } from '@testing-library/react';
import Card from '../../src/components/Card';
-
+import { theme } from '../../src/theme/docsTheme';
+import { ThemeProvider } from 'emotion-theming';
// data for this component
import mockData from './data/Card.test.json';
it('renders correctly', () => {
- const tree = render( );
+ const tree = render(
+
+
+
+ );
expect(tree.asFragment()).toMatchSnapshot();
});
diff --git a/tests/unit/CardGroup.test.js b/tests/unit/CardGroup.test.js
index 19c6bab66..0ab86884b 100644
--- a/tests/unit/CardGroup.test.js
+++ b/tests/unit/CardGroup.test.js
@@ -1,11 +1,16 @@
import React from 'react';
import { render } from '@testing-library/react';
import CardGroup from '../../src/components/CardGroup';
-
+import { theme } from '../../src/theme/docsTheme';
+import { ThemeProvider } from 'emotion-theming';
// data for this component
import mockData from './data/CardGroup.test.json';
it('renders correctly', () => {
- const tree = render( );
+ const tree = render(
+
+
+
+ );
expect(tree.asFragment()).toMatchSnapshot();
});
diff --git a/tests/unit/FieldList.test.js b/tests/unit/FieldList.test.js
index 7d6abce74..a5112cadb 100644
--- a/tests/unit/FieldList.test.js
+++ b/tests/unit/FieldList.test.js
@@ -1,11 +1,16 @@
import React from 'react';
import { render } from '@testing-library/react';
import FieldList from '../../src/components/FieldList';
-
+import { theme } from '../../src/theme/docsTheme';
+import { ThemeProvider } from 'emotion-theming';
// data for this component
import mockData from './data/FieldList.test.json';
it('renders correctly', () => {
- const tree = render( );
+ const tree = render(
+
+
+
+ );
expect(tree.asFragment()).toMatchSnapshot();
});
diff --git a/tests/unit/__snapshots__/Card.test.js.snap b/tests/unit/__snapshots__/Card.test.js.snap
index ef4a14f0d..671647d28 100644
--- a/tests/unit/__snapshots__/Card.test.js.snap
+++ b/tests/unit/__snapshots__/Card.test.js.snap
@@ -1,58 +1,109 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders correctly 1`] = `
-
-
+ .emotion-10 {
+ position: relative;
+ border-radius: 7px;
+ -webkit-transition: border 300ms ease-in-out,box-shadow 300ms ease-in-out;
+ transition: border 300ms ease-in-out,box-shadow 300ms ease-in-out;
+ border: 1px solid #E7EEEC;
+ box-shadow: 0 4px 10px -4px rgba(6,22,33,0.3);
+ background-color: white;
+ color: #21313C;
+ cursor: pointer;
+}
+
+.emotion-10:focus {
+ outline: none;
+ box-shadow: 0 4px 10px -4px rgba(6,22,33,0.3),0 0 0 3px #9DD0E7;
+}
+
+.emotion-10:hover {
+ border: 1px solid #E7EEEC;
+ box-shadow: 0 2px 6px -2px rgba(6,22,33,0.6);
+}
+
+.emotion-10:hover:focus {
+ box-shadow: 0 2px 6px -2px rgba(6,22,33,0.6),0 0 0 3px #9DD0E7;
+}
+
+.emotion-8 {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-flex-direction: column;
+ -ms-flex-direction: column;
+ flex-direction: column;
+ height: 100%;
+ padding: 32px;
+}
+
+.emotion-8 p:last-of-type {
+ margin-bottom: 0;
+}
+
+.emotion-0 {
+ width: 24px;
+}
+
+.emotion-3 {
+ background-color: #E4F4E4;
+ border-radius: 4px;
+ color: #13AA52;
+ font-weight: bold;
+ padding: 4px 8px;
+ margin-right: auto;
+}
+
+.emotion-4 {
+ -webkit-letter-spacing: 0.5px;
+ -moz-letter-spacing: 0.5px;
+ -ms-letter-spacing: 0.5px;
+ letter-spacing: 0.5px;
+ margin: 24px 0 8px 0;
+}
+
+.emotion-6 {
+ font-weight: bold;
+ margin-top: auto;
+}
+
+.emotion-6 > a:hover {
+ color: #1A567E;
+}
+
+
-
-
-
-
-
+
+ Test card tag
+
+
Test card headline
-
-
-
-
+
+ Test card paragraph
+
+
+
Test card CTA
-
-
-
-
+
+
+
+
`;
diff --git a/tests/unit/__snapshots__/CardGroup.test.js.snap b/tests/unit/__snapshots__/CardGroup.test.js.snap
index be6b696e8..a61a31191 100644
--- a/tests/unit/__snapshots__/CardGroup.test.js.snap
+++ b/tests/unit/__snapshots__/CardGroup.test.js.snap
@@ -1,149 +1,262 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders correctly 1`] = `
-
-
-
-
-
+
+ .emotion-12 {
+ position: relative;
+ border-radius: 7px;
+ -webkit-transition: border 300ms ease-in-out,box-shadow 300ms ease-in-out;
+ transition: border 300ms ease-in-out,box-shadow 300ms ease-in-out;
+ border: 1px solid #E7EEEC;
+ box-shadow: 0 4px 10px -4px rgba(6,22,33,0.3);
+ background-color: white;
+ color: #21313C;
+ cursor: pointer;
+}
+
+.emotion-12:focus {
+ outline: none;
+ box-shadow: 0 4px 10px -4px rgba(6,22,33,0.3),0 0 0 3px #9DD0E7;
+}
+
+.emotion-12:hover {
+ border: 1px solid #E7EEEC;
+ box-shadow: 0 2px 6px -2px rgba(6,22,33,0.6);
+}
+
+.emotion-12:hover:focus {
+ box-shadow: 0 2px 6px -2px rgba(6,22,33,0.6),0 0 0 3px #9DD0E7;
+}
+
+.emotion-39 {
+ -webkit-align-items: stretch;
+ -webkit-box-align: stretch;
+ -ms-flex-align: stretch;
+ align-items: stretch;
+ display: grid;
+ grid-column: 1 / -1 !important;
+ grid-column-gap: 24px;
+ grid-row-gap: 24px;
+ grid-template-columns: repeat(3,1fr);
+ margin: 32px 0;
+}
+
+@media only screen and (max-width:1200px) {
+ .emotion-39 {
+ grid-template-columns: repeat(2,1fr);
+ }
+}
+
+@media only screen and (max-width:767px) {
+ .emotion-39 {
+ grid-gap: calc(24px * 0.75);
+ grid-template-columns: calc(24px / 2) repeat(3,calc(75% - calc(2 * 24px))) calc(24px / 2);
+ grid-template-rows: minmax(150px,1fr);
+ margin: 24px 0;
+ overflow-x: scroll;
+ padding-bottom: calc(24px / 2);
+ -webkit-scroll-snap-type: x proximity;
+ -moz-scroll-snap-type: x proximity;
+ -ms-scroll-snap-type: x proximity;
+ scroll-snap-type: x proximity;
+ }
+
+ .emotion-39:before,
+ .emotion-39:after {
+ content: '';
+ }
+}
+
+.emotion-10 {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-flex-direction: column;
+ -ms-flex-direction: column;
+ flex-direction: column;
+ height: 100%;
+ padding: 32px;
+ -webkit-align-items: flex-start;
+ -webkit-box-align: flex-start;
+ -ms-flex-align: flex-start;
+ align-items: flex-start;
+ -webkit-flex-direction: row;
+ -ms-flex-direction: row;
+ flex-direction: row;
+ padding: 32px 24px;
+}
+
+.emotion-10 p:last-of-type {
+ margin-bottom: 0;
+}
+
+.emotion-2 {
+ background: #E4F4E4;
+ border-radius: 50%;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-flex-shrink: 0 !important;
+ -ms-flex-negative: 0 !important;
+ flex-shrink: 0 !important;
+ height: 48px;
+ width: 48px;
+}
+
+@media only screen and (max-width:420px) {
+ .emotion-2 {
+ height: 40px;
+ width: 40px;
+ }
+}
+
+.emotion-0 {
+ margin: auto;
+ width: 24px;
+}
+
+@media only screen and (max-width:420px) {
+ .emotion-0 {
+ width: 20px;
+ }
+}
+
+.emotion-8 {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-flex-direction: column;
+ -ms-flex-direction: column;
+ flex-direction: column;
+ height: 100%;
+ margin-left: 24px;
+}
+
+@media only screen and (max-width:420px) {
+ .emotion-8 {
+ margin-left: 16px;
+ }
+}
+
+.emotion-4 {
+ -webkit-letter-spacing: 0.5px;
+ -moz-letter-spacing: 0.5px;
+ -ms-letter-spacing: 0.5px;
+ letter-spacing: 0.5px;
+ margin: 0 0 8px;
+}
+
+.emotion-6 {
+ font-weight: bold;
+ margin-top: auto;
+}
+
+.emotion-6 > a:hover {
+ color: #1A567E;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
`;
diff --git a/tests/unit/__snapshots__/FieldList.test.js.snap b/tests/unit/__snapshots__/FieldList.test.js.snap
index bc17813b0..1f1674016 100644
--- a/tests/unit/__snapshots__/FieldList.test.js.snap
+++ b/tests/unit/__snapshots__/FieldList.test.js.snap
@@ -1,80 +1,80 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders correctly 1`] = `
-
+
+ .emotion-2 {
+ background-color: #F9FBFA;
+ border: 1px solid #B8C4C2;
+ border-radius: 3px;
+ font-family: 'Source Code Pro',Menlo,monospace;
+ font-size: 14px;
+ line-height: 20px;
+ -webkit-letter-spacing: 0px;
+ -moz-letter-spacing: 0px;
+ -ms-letter-spacing: 0px;
+ letter-spacing: 0px;
+ white-space: nowrap;
+}
+
+[data-leafygreen-ui="anchor-inline-code"]:hover > .emotion-2 {
+ box-shadow: 0 0 0 3px #E7EEEC;
+}
+
+[data-leafygreen-ui="anchor-inline-code"]:focus > .emotion-2 {
+ box-shadow: 0 0 0 3px #C5E4F2;
+}
+
+.emotion-4 {
+ border-spacing: 0;
+ font-size: 14px;
+ line-height: 24px;
+ margin: 24px 0;
+ max-width: 100%;
+}
+
+.emotion-4 tbody {
+ vertical-align: top;
+}
+
+.emotion-3 > th,
+.emotion-3 > td {
+ padding: 11px 5px 12px;
+ text-align: left;
+}
+
+.emotion-0 {
+ font-size: unset;
+}
+
+
+
+
+
+
+
+
+
+ Returns:
+
+
+ A JSON Web Token string encoded for the provided
+
+ payload
+
+ .
+
+
+
+
+
`;
diff --git a/tests/unit/__snapshots__/QuizWidget.test.js.snap b/tests/unit/__snapshots__/QuizWidget.test.js.snap
index f4a757c38..6963a95fe 100644
--- a/tests/unit/__snapshots__/QuizWidget.test.js.snap
+++ b/tests/unit/__snapshots__/QuizWidget.test.js.snap
@@ -1,7 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
-exports[`doesnt render quiz widget without a specified question 1`] = `""`;
-
exports[`quiz widget snapshots doesnt render quiz widget without a specified question 1`] = ` `;
exports[`quiz widget snapshots renders quiz widget correctly 1`] = `
@@ -278,202 +276,3 @@ exports[`quiz widget snapshots renders quiz widget correctly 1`] = `
`;
-
-exports[`renders quiz widget correctly 1`] = `
-
-
-
-
- Check your understanding
-
-
-
-
-
-
-
-
-
-
-`;
From 1e15146c67a3b9901f1858a48b5b53422a7f12fb Mon Sep 17 00:00:00 2001
From: Cassidy Schaufele
Date: Wed, 12 Jan 2022 11:53:02 -0700
Subject: [PATCH 03/10] DOP-2642: Convert FeedbackWidget and Code tests to RTL
---
tests/unit/Code.test.js | 9 +++---
tests/unit/FeedbackWidget.test.js | 47 +++++++++++++++----------------
2 files changed, 26 insertions(+), 30 deletions(-)
diff --git a/tests/unit/Code.test.js b/tests/unit/Code.test.js
index 3a1d5a0b9..7309a3aaa 100644
--- a/tests/unit/Code.test.js
+++ b/tests/unit/Code.test.js
@@ -1,5 +1,5 @@
import React from 'react';
-import { shallow, mount } from 'enzyme';
+import { render } from '@testing-library/react';
import Code from '../../src/components/Code';
import { CodeProvider } from '../../src/components/code-context';
import { TabProvider } from '../../src/components/tab-context';
@@ -48,11 +48,11 @@ const mockSelectors = {
};
const shallowCode = ({ data }) => {
- return shallow(
);
+ return render(
);
};
const mountCodeWithSelector = ({ data }) => {
- return mount(
+ return render(
@@ -63,8 +63,7 @@ const mountCodeWithSelector = ({ data }) => {
it('renders correctly', () => {
const wrapper = shallowCode({ data: mockData.testCode, activeTabs: { cloud: 'cloud' } });
- expect(wrapper).toMatchSnapshot();
- expect(wrapper.find('LanguageSwitcher').exists()).toBeFalsy();
+ expect(wrapper.asFragment()).toMatchSnapshot();
});
describe('when rendering with selectors', () => {
diff --git a/tests/unit/FeedbackWidget.test.js b/tests/unit/FeedbackWidget.test.js
index 311bc00ef..2f8a3bf0d 100644
--- a/tests/unit/FeedbackWidget.test.js
+++ b/tests/unit/FeedbackWidget.test.js
@@ -1,5 +1,6 @@
import React from 'react';
-import { mount } from 'enzyme';
+import { render, screen } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
import {
FeedbackProvider,
FeedbackForm,
@@ -23,7 +24,7 @@ import { theme } from '../../src/theme/docsTheme';
async function mountFormWithFeedbackState(feedbackState = {}, options = {}) {
const { view, isSupportRequest, hideHeader, ...feedback } = feedbackState;
- const wrapper = mount(
+ const wrapper = render(
);
// Need to wait for the next tick to let Loadable components load
- await tick({ wrapper });
+ await tick();
return wrapper;
}
@@ -62,26 +63,22 @@ describe('FeedbackWidget', () => {
beforeEach(mockStitchFunctions);
afterEach(clearMockStitchFunctions);
- describe('FeedbackTab', () => {
+ describe('FeedbackTab (Desktop Viewport)', () => {
it('shows the rating view when clicked', async () => {
wrapper = await mountFormWithFeedbackState({});
- expect(wrapper.find('FeedbackTab').children()).toHaveLength(1);
// Before the click, the form is hidden
- expect(wrapper.exists('FeedbackForm')).toEqual(true);
- expect(wrapper.find('FeedbackForm').children()).toHaveLength(0);
+ expect(wrapper.queryAllByText('How helpful was this page?')).toHaveLength(0);
// Click the tab
- wrapper.find('FeedbackTab').childAt(0).simulate('click');
- await tick({ wrapper });
+ userEvent.click(wrapper.getByText('Give Feedback'));
+
+ await tick();
// After the click new feedback is initialized
- expect(wrapper.find('FeedbackTab').children()).toHaveLength(0);
- expect(wrapper.exists('FeedbackForm')).toEqual(true);
- expect(wrapper.exists('RatingView')).toEqual(true);
+ expect(wrapper.queryAllByText('How helpful was this page?')).toHaveLength(1);
});
it('is visible in the waiting view on large/desktop screens', async () => {
wrapper = await mountFormWithFeedbackState({});
- expect(wrapper.exists('FeedbackTab')).toBe(true);
- expect(wrapper.find('FeedbackTab').children()).toHaveLength(1);
+ expect(wrapper.queryAllByText('Give Feedback')).toHaveLength(1);
});
it('is hidden outside of the waiting view on large/desktop screens', async () => {
@@ -90,31 +87,31 @@ describe('FeedbackWidget', () => {
comment: '',
rating: null,
});
- expect(wrapper.exists('RatingView')).toEqual(true);
- expect(wrapper.exists('FeedbackTab')).toBe(true);
- expect(wrapper.find('FeedbackTab')).toHaveLength(1);
- expect(wrapper.find('FeedbackTab').children()).toHaveLength(0);
+ expect(wrapper.queryAllByText('How helpful was this page?')).toHaveLength(1);
});
it('is hidden on small/mobile and medium/tablet screens', async () => {
wrapper = await mountFormWithFeedbackState({});
- expect(wrapper.exists('FeedbackTab')).toBe(true);
- expect(wrapper.find('FeedbackTab').children()).toHaveLength(1);
- expect(wrapper).toHaveStyleRule('display', 'none', {
+ expect(wrapper.queryAllByText('Give Feedback')).toHaveLength(1);
+ expect(wrapper.queryAllByText('Give Feedback')[0]).toHaveStyleRule('display', 'none', {
media: `${theme.screenSize.upToLarge}`,
});
});
});
- describe('FeedbackHeading', () => {
+ describe('FeedbackHeading (Mobile Viewport)', () => {
it('is hidden on large/desktop screens', async () => {
wrapper = await mountFormWithFeedbackState({});
- expect(wrapper.exists('FeedbackHeading')).toBe(false);
+ expect(wrapper.queryAllByText('Give Feedback')).toHaveLength(1);
+ expect(wrapper.queryAllByText('Give Feedback')[0]).toHaveStyleRule('display', 'none', {
+ media: `${theme.screenSize.upToLarge}`,
+ });
});
it('is visible on medium/tablet screens', async () => {
setTablet();
wrapper = await mountFormWithFeedbackState({});
+ screen.debug();
expect(wrapper.exists('FeedbackHeading')).toBe(true);
expect(wrapper.find('FeedbackHeading').children()).toHaveLength(2);
});
@@ -129,8 +126,8 @@ describe('FeedbackWidget', () => {
it('is hidden on small/mobile screens when configured with page option', async () => {
setMobile();
wrapper = await mountFormWithFeedbackState({ hideHeader: true });
- expect(wrapper.exists('FeedbackHeading')).toBe(true);
- expect(wrapper.find('FeedbackHeading').children()).toHaveLength(0);
+ screen.debug();
+ expect(wrapper.queryAllByText('Give Feedback')).toHaveLength(0);
});
});
From 1f71e03a3faa7a62a99c17ae71bc301c5dd29caf Mon Sep 17 00:00:00 2001
From: Cassidy Schaufele
Date: Thu, 13 Jan 2022 21:41:17 -0700
Subject: [PATCH 04/10] DOP-2642: Update jest.config.js to remove enzyme and
add jest-dom
---
jest.config.js | 2 +-
package-lock.json | 298 +++++++++++++++++++++++++++++++++++++++++++++
package.json | 1 +
tests/testSetup.js | 6 +-
4 files changed, 302 insertions(+), 5 deletions(-)
diff --git a/jest.config.js b/jest.config.js
index 3cd65d1c0..5d40d929d 100644
--- a/jest.config.js
+++ b/jest.config.js
@@ -13,7 +13,7 @@ module.exports = {
'^.+\\.(css)$': 'identity-obj-proxy',
},
setupFilesAfterEnv: ['/tests/testSetup.js'],
- snapshotSerializers: ['enzyme-to-json/serializer', 'jest-emotion'],
+ snapshotSerializers: ['jest-emotion'],
testMatch: ['/tests/unit/**/*.test.js'],
transform: {
'^.+\\.jsx?$': `/jest-preprocess.js`,
diff --git a/package-lock.json b/package-lock.json
index 70c210585..70294b424 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -70,6 +70,7 @@
"devDependencies": {
"@babel/core": "^7.12.9",
"@testing-library/dom": "^8.11.1",
+ "@testing-library/jest-dom": "^5.16.1",
"@testing-library/react": "^12.1.2",
"@testing-library/user-event": "^13.5.0",
"auto-changelog": "^2.2.1",
@@ -4197,6 +4198,146 @@
"node": ">=8"
}
},
+ "node_modules/@testing-library/jest-dom": {
+ "version": "5.16.1",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/@testing-library/jest-dom/-/jest-dom-5.16.1.tgz",
+ "integrity": "sha1-PbffWul1liZKfalpb+FGlboC5R8=",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@babel/runtime": "^7.9.2",
+ "@types/testing-library__jest-dom": "^5.9.1",
+ "aria-query": "^5.0.0",
+ "chalk": "^3.0.0",
+ "css": "^3.0.0",
+ "css.escape": "^1.5.1",
+ "dom-accessibility-api": "^0.5.6",
+ "lodash": "^4.17.15",
+ "redent": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=8",
+ "npm": ">=6",
+ "yarn": ">=1"
+ }
+ },
+ "node_modules/@testing-library/jest-dom/node_modules/ansi-styles": {
+ "version": "4.3.0",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/ansi-styles/-/ansi-styles-4.3.0.tgz",
+ "integrity": "sha1-7dgDYornHATIWuegkG7a00tkiTc=",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "color-convert": "^2.0.1"
+ },
+ "engines": {
+ "node": ">=8"
+ },
+ "funding": {
+ "url": "/~https://github.com/chalk/ansi-styles?sponsor=1"
+ }
+ },
+ "node_modules/@testing-library/jest-dom/node_modules/aria-query": {
+ "version": "5.0.0",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/aria-query/-/aria-query-5.0.0.tgz",
+ "integrity": "sha1-IQwhqvRpYT7oyaYsf4ZSXgWNtSw=",
+ "dev": true,
+ "license": "Apache-2.0",
+ "engines": {
+ "node": ">=6.0"
+ }
+ },
+ "node_modules/@testing-library/jest-dom/node_modules/chalk": {
+ "version": "3.0.0",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/chalk/-/chalk-3.0.0.tgz",
+ "integrity": "sha1-P3PCv1JlkfV0zEksUeJFY0n4ROQ=",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/@testing-library/jest-dom/node_modules/color-convert": {
+ "version": "2.0.1",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha1-ctOmjVmMm9s68q0ehPIdiWq9TeM=",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "color-name": "~1.1.4"
+ },
+ "engines": {
+ "node": ">=7.0.0"
+ }
+ },
+ "node_modules/@testing-library/jest-dom/node_modules/color-name": {
+ "version": "1.1.4",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha1-wqCah6y95pVD3m9j+jmVyCbFNqI=",
+ "dev": true,
+ "license": "MIT"
+ },
+ "node_modules/@testing-library/jest-dom/node_modules/css": {
+ "version": "3.0.0",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/css/-/css-3.0.0.tgz",
+ "integrity": "sha1-REek1Y/dAzZ8UWyp9krjZc7kql0=",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "inherits": "^2.0.4",
+ "source-map": "^0.6.1",
+ "source-map-resolve": "^0.6.0"
+ }
+ },
+ "node_modules/@testing-library/jest-dom/node_modules/has-flag": {
+ "version": "4.0.0",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha1-lEdx/ZyByBJlxNaUGGDaBrtZR5s=",
+ "dev": true,
+ "license": "MIT",
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/@testing-library/jest-dom/node_modules/source-map": {
+ "version": "0.6.1",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha1-dHIq8y6WFOnCh6jQu95IteLxomM=",
+ "dev": true,
+ "license": "BSD-3-Clause",
+ "engines": {
+ "node": ">=0.10.0"
+ }
+ },
+ "node_modules/@testing-library/jest-dom/node_modules/source-map-resolve": {
+ "version": "0.6.0",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/source-map-resolve/-/source-map-resolve-0.6.0.tgz",
+ "integrity": "sha1-PZ34fiNrU/FtAeWBUPx3EROOXtI=",
+ "deprecated": "See /~https://github.com/lydell/source-map-resolve#deprecated",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "atob": "^2.1.2",
+ "decode-uri-component": "^0.2.0"
+ }
+ },
+ "node_modules/@testing-library/jest-dom/node_modules/supports-color": {
+ "version": "7.2.0",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/supports-color/-/supports-color-7.2.0.tgz",
+ "integrity": "sha1-G33NyzK4E4gBs+R4umpRyqiWSNo=",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "has-flag": "^4.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/@testing-library/react": {
"version": "12.1.2",
"resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/@testing-library/react/-/react-12.1.2.tgz",
@@ -4799,6 +4940,16 @@
"@types/estree": "*"
}
},
+ "node_modules/@types/testing-library__jest-dom": {
+ "version": "5.14.2",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/@types/testing-library__jest-dom/-/testing-library__jest-dom-5.14.2.tgz",
+ "integrity": "sha1-Vk+ystyCcUfpN6dbY5oF0Xzhi0Q=",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "@types/jest": "*"
+ }
+ },
"node_modules/@types/tmp": {
"version": "0.0.33",
"resolved": "https://registry.npmjs.org/@types/tmp/-/tmp-0.0.33.tgz",
@@ -8836,6 +8987,13 @@
"node": "*"
}
},
+ "node_modules/css.escape": {
+ "version": "1.5.1",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/css.escape/-/css.escape-1.5.1.tgz",
+ "integrity": "sha1-QuJ9T6BK4y+TGktNQZH6nN3ul8s=",
+ "dev": true,
+ "license": "MIT"
+ },
"node_modules/css/node_modules/source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
@@ -23461,6 +23619,20 @@
"node": "*"
}
},
+ "node_modules/redent": {
+ "version": "3.0.0",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/redent/-/redent-3.0.0.tgz",
+ "integrity": "sha1-5Ve3mYMWu1PJ8fVvpiY1LGljBZ8=",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "indent-string": "^4.0.0",
+ "strip-indent": "^3.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
"node_modules/redoc": {
"version": "2.0.0-rc.48",
"resolved": "https://registry.npmjs.org/redoc/-/redoc-2.0.0-rc.48.tgz",
@@ -33202,6 +33374,107 @@
}
}
},
+ "@testing-library/jest-dom": {
+ "version": "5.16.1",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/@testing-library/jest-dom/-/jest-dom-5.16.1.tgz",
+ "integrity": "sha1-PbffWul1liZKfalpb+FGlboC5R8=",
+ "dev": true,
+ "requires": {
+ "@babel/runtime": "^7.9.2",
+ "@types/testing-library__jest-dom": "^5.9.1",
+ "aria-query": "^5.0.0",
+ "chalk": "^3.0.0",
+ "css": "^3.0.0",
+ "css.escape": "^1.5.1",
+ "dom-accessibility-api": "^0.5.6",
+ "lodash": "^4.17.15",
+ "redent": "^3.0.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "4.3.0",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/ansi-styles/-/ansi-styles-4.3.0.tgz",
+ "integrity": "sha1-7dgDYornHATIWuegkG7a00tkiTc=",
+ "dev": true,
+ "requires": {
+ "color-convert": "^2.0.1"
+ }
+ },
+ "aria-query": {
+ "version": "5.0.0",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/aria-query/-/aria-query-5.0.0.tgz",
+ "integrity": "sha1-IQwhqvRpYT7oyaYsf4ZSXgWNtSw=",
+ "dev": true
+ },
+ "chalk": {
+ "version": "3.0.0",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/chalk/-/chalk-3.0.0.tgz",
+ "integrity": "sha1-P3PCv1JlkfV0zEksUeJFY0n4ROQ=",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha1-ctOmjVmMm9s68q0ehPIdiWq9TeM=",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha1-wqCah6y95pVD3m9j+jmVyCbFNqI=",
+ "dev": true
+ },
+ "css": {
+ "version": "3.0.0",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/css/-/css-3.0.0.tgz",
+ "integrity": "sha1-REek1Y/dAzZ8UWyp9krjZc7kql0=",
+ "dev": true,
+ "requires": {
+ "inherits": "^2.0.4",
+ "source-map": "^0.6.1",
+ "source-map-resolve": "^0.6.0"
+ }
+ },
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha1-lEdx/ZyByBJlxNaUGGDaBrtZR5s=",
+ "dev": true
+ },
+ "source-map": {
+ "version": "0.6.1",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/source-map/-/source-map-0.6.1.tgz",
+ "integrity": "sha1-dHIq8y6WFOnCh6jQu95IteLxomM=",
+ "dev": true
+ },
+ "source-map-resolve": {
+ "version": "0.6.0",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/source-map-resolve/-/source-map-resolve-0.6.0.tgz",
+ "integrity": "sha1-PZ34fiNrU/FtAeWBUPx3EROOXtI=",
+ "dev": true,
+ "requires": {
+ "atob": "^2.1.2",
+ "decode-uri-component": "^0.2.0"
+ }
+ },
+ "supports-color": {
+ "version": "7.2.0",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/supports-color/-/supports-color-7.2.0.tgz",
+ "integrity": "sha1-G33NyzK4E4gBs+R4umpRyqiWSNo=",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ }
+ }
+ },
"@testing-library/react": {
"version": "12.1.2",
"resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/@testing-library/react/-/react-12.1.2.tgz",
@@ -33727,6 +34000,15 @@
"@types/estree": "*"
}
},
+ "@types/testing-library__jest-dom": {
+ "version": "5.14.2",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/@types/testing-library__jest-dom/-/testing-library__jest-dom-5.14.2.tgz",
+ "integrity": "sha1-Vk+ystyCcUfpN6dbY5oF0Xzhi0Q=",
+ "dev": true,
+ "requires": {
+ "@types/jest": "*"
+ }
+ },
"@types/tmp": {
"version": "0.0.33",
"resolved": "https://registry.npmjs.org/@types/tmp/-/tmp-0.0.33.tgz",
@@ -37187,6 +37469,12 @@
"integrity": "sha512-a+EPoD+uZiNfh+5fxw2nO9QwFa6nJe2Or35fGY6Ipw1R3R4AGz1d1TEZrCegvw2YTmZ0jXirGYlzxxpYSHwpEg==",
"dev": true
},
+ "css.escape": {
+ "version": "1.5.1",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/css.escape/-/css.escape-1.5.1.tgz",
+ "integrity": "sha1-QuJ9T6BK4y+TGktNQZH6nN3ul8s=",
+ "dev": true
+ },
"cssesc": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz",
@@ -49294,6 +49582,16 @@
}
}
},
+ "redent": {
+ "version": "3.0.0",
+ "resolved": "http://artifactory.corp.mongodb.com/artifactory/api/npm/npm/redent/-/redent-3.0.0.tgz",
+ "integrity": "sha1-5Ve3mYMWu1PJ8fVvpiY1LGljBZ8=",
+ "dev": true,
+ "requires": {
+ "indent-string": "^4.0.0",
+ "strip-indent": "^3.0.0"
+ }
+ },
"redoc": {
"version": "2.0.0-rc.48",
"resolved": "https://registry.npmjs.org/redoc/-/redoc-2.0.0-rc.48.tgz",
diff --git a/package.json b/package.json
index 28ebf7229..367631329 100644
--- a/package.json
+++ b/package.json
@@ -9,6 +9,7 @@
"devDependencies": {
"@babel/core": "^7.12.9",
"@testing-library/dom": "^8.11.1",
+ "@testing-library/jest-dom": "^5.16.1",
"@testing-library/react": "^12.1.2",
"@testing-library/user-event": "^13.5.0",
"auto-changelog": "^2.2.1",
diff --git a/tests/testSetup.js b/tests/testSetup.js
index 1d7094ff1..b04edd95b 100644
--- a/tests/testSetup.js
+++ b/tests/testSetup.js
@@ -1,8 +1,6 @@
-const Enzyme = require('enzyme'); // eslint-disable-line import/no-extraneous-dependencies
-const Adapter = require('enzyme-adapter-react-16'); // eslint-disable-line import/no-extraneous-dependencies
-const Loadable = require('react-loadable');
+import '@testing-library/jest-dom';
-Enzyme.configure({ adapter: new Adapter() });
+const Loadable = require('react-loadable');
global.navigator = {
userAgent: 'node.js',
From 03e5ce9f00bb45ba9c7a113bc4ef1109bcd65f04 Mon Sep 17 00:00:00 2001
From: Cassidy Schaufele
Date: Tue, 18 Jan 2022 12:28:11 -0700
Subject: [PATCH 05/10] DOP-2642: Update Hook tests, mid-complexity tests
---
tests/unit/DeprecatedVersionSelector.test.js | 150 +-
tests/unit/GuidesTOCTree.test.js | 11 +-
tests/unit/Lightbox.test.js | 47 +-
tests/unit/ListTable.test.js | 82 +-
tests/unit/Operation.test.js | 44 +-
tests/unit/Pagination.test.js | 67 +-
tests/unit/Pills.test.js | 29 +-
tests/unit/ProductsList.test.js | 27 +-
tests/unit/Searchbar.test.js | 284 ----
.../unit/__snapshots__/Lightbox.test.js.snap | 296 +---
.../unit/__snapshots__/ListTable.test.js.snap | 1446 +++++++++--------
.../unit/__snapshots__/Operation.test.js.snap | 959 +++++++++--
.../__snapshots__/Pagination.test.js.snap | 286 +++-
tests/unit/__snapshots__/Pills.test.js.snap | 76 +-
tests/unit/useDelightedSurvey.test.js | 10 +-
tests/unit/useFeedbackData.test.js | 33 +-
tests/unit/useScreenSize.test.js | 28 +-
tests/unit/useStickyTopValues.test.js | 18 +-
tests/unit/useViewport.test.js | 68 +-
19 files changed, 2163 insertions(+), 1798 deletions(-)
delete mode 100644 tests/unit/Searchbar.test.js
diff --git a/tests/unit/DeprecatedVersionSelector.test.js b/tests/unit/DeprecatedVersionSelector.test.js
index ffe45afc4..f15960cf7 100644
--- a/tests/unit/DeprecatedVersionSelector.test.js
+++ b/tests/unit/DeprecatedVersionSelector.test.js
@@ -1,5 +1,6 @@
import React from 'react';
-import { mount } from 'enzyme';
+import { render } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
import DeprecatedVersionSelector from '../../src/components/DeprecatedVersionSelector';
const deprecatedVersions = {
@@ -12,136 +13,77 @@ const metadata = {
};
describe('when rendered', () => {
- let wrapper;
- let productDropdown;
- let versionDropdown;
-
- beforeAll(() => {
- wrapper = mount( );
- productDropdown = wrapper.find('StyledCustomSelect').at(0);
- versionDropdown = wrapper.find('StyledCustomSelect').at(1);
- });
+ jest.useFakeTimers();
it('shows two dropdowns', () => {
- expect(wrapper.find('Select')).toHaveLength(2);
+ const wrapper = render( );
+ const productDropdown = wrapper.queryAllByText('Select a Product');
+ const versionDropdown = wrapper.queryAllByText('Select a Version');
+
+ expect(productDropdown).toBeTruthy();
+ expect(versionDropdown).toBeTruthy();
});
it('shows a disabled submit button', () => {
- const button = wrapper.find('Button');
- expect(button).toHaveLength(1);
- expect(button.prop('disabled')).toBe(true);
+ const wrapper = render( );
+
+ const button = wrapper.getByTitle('View Documentation');
+ expect(button).toBeTruthy();
+ expect(button).toBeDisabled();
});
it('shows a disabled version selector', () => {
- expect(wrapper.find('Select').at(1).prop('disabled')).toBe(true);
+ const wrapper = render( );
+ const versionDropdown = wrapper.getByText('Select a Version');
+
+ // Limitation of implementation here - may be questionable to have the dropdown text in a tag
+ // and not in the actual dropdown div
+ // div is also likely not tab navigable.
+ // TODO: refactor for accessibility in the future,
+ // moving from a div to a if time permits
+ expect(versionDropdown.parentElement).toHaveAttribute('aria-disabled', 'true');
});
it('does not show either dropdown menu', () => {
- expect(wrapper.find('ul')).toHaveLength(0);
+ const wrapper = render( );
+
+ expect(wrapper.queryAllByText('mms')).toHaveLength(0);
+ expect(wrapper.queryAllByText(deprecatedVersions.mms[0])).toHaveLength(0);
});
// Test product dropdown
describe('when the product button is clicked', () => {
- beforeAll(() => {
- productDropdown.simulate('click');
- });
-
- it('shows the dropdown menu', () => {
- expect(wrapper.find('ul')).toHaveLength(1);
- });
-
- it('product dropdown text is correct', () => {
- expect(wrapper.find('SelectedText').at(0).text()).toBe('Product');
- });
-
- it('has 2 list elements', () => {
- expect(wrapper.find('ul').children()).toHaveLength(2);
- });
+ it('shows the dropdown menu with elements per metadata node', () => {
+ const wrapper = render( );
- it('shows the proper name for product', () => {
- expect(wrapper.find('li').first().text()).toBe('MongoDB Server');
- });
- });
-
- describe('when the button is clicked again', () => {
- beforeAll(() => {
- productDropdown.simulate('click');
- });
-
- it('hides the dropdown menu', () => {
- expect(wrapper.find('ul')).toHaveLength(0);
- });
- });
-
- // Test version dropdown
- describe('when the version button is clicked', () => {
- beforeAll(() => {
- versionDropdown.simulate('click');
- });
+ //see TODO above re: limitation of having text in a tag
+ const productDropdown = wrapper.queryAllByRole('listbox')[0];
+ userEvent.click(productDropdown);
- // Version dropdown is disabled until a product is selected
- it('does not show the dropdown menu', () => {
- expect(wrapper.find('ul')).toHaveLength(0);
+ expect(wrapper.getByText('MongoDB Server')).toBeTruthy();
+ expect(wrapper.getByText('MongoDB Ops Manager')).toBeTruthy();
});
it('version dropdown text is correct', () => {
- expect(wrapper.find('SelectedText').at(1).text()).toBe('Version');
- });
- });
-
- describe('when the first option is selected', () => {
- beforeAll(() => {
- productDropdown.simulate('click');
- wrapper.find('ul').childAt(0).simulate('click');
- });
+ const wrapper = render( );
- it('hides the dropdown menu', () => {
- expect(wrapper.find('ul')).toHaveLength(0);
- });
-
- it('shows the correct text', () => {
- expect(wrapper.find('SelectedText').at(0).text()).toBe('MongoDB Server');
+ //see TODO above re: limitation of having text in a
tag
+ const productDropdown = wrapper.queryAllByRole('listbox')[0];
+ userEvent.click(productDropdown);
+ expect(wrapper.getByText('Version')).toBeTruthy();
});
});
- // Test version dropdown
- describe('when the version button is clicked', () => {
- beforeAll(() => {
- versionDropdown.simulate('click');
- });
-
- it('shows the version dropdown menu', () => {
- expect(wrapper.find('ul')).toHaveLength(1);
- });
-
- it('has 6 list elements', () => {
- expect(wrapper.find('ul').children()).toHaveLength(6);
- });
- });
-
- describe('when a version is selected', () => {
- beforeAll(() => {
- wrapper.find('ul').childAt(2).simulate('click');
- });
-
+ describe('when the product button is clicked again', () => {
it('hides the dropdown menu', () => {
- expect(wrapper.find('ul')).toHaveLength(0);
- });
+ const wrapper = render( );
- it('enables the link button', () => {
- const button = wrapper.find('Button').first();
- expect(button.prop('disabled')).toBe(false);
- });
- });
-
- describe('when the product is changed', () => {
- beforeAll(() => {
- productDropdown.simulate('click');
- wrapper.find('ul').childAt(1).simulate('click');
- });
+ //see TODO above re: limitation of having text in a
tag
+ const productDropdown = wrapper.queryAllByRole('listbox')[0];
+ userEvent.click(productDropdown);
+ userEvent.click(productDropdown);
- it('version dropdown text is reset', () => {
- expect(wrapper.find('SelectedText').at(1).text()).toBe('Version');
+ expect(wrapper.queryAllByText('MongoDB Server')).toHaveLength(0);
});
});
});
diff --git a/tests/unit/GuidesTOCTree.test.js b/tests/unit/GuidesTOCTree.test.js
index 9cb946bae..53a456986 100644
--- a/tests/unit/GuidesTOCTree.test.js
+++ b/tests/unit/GuidesTOCTree.test.js
@@ -1,5 +1,5 @@
import React from 'react';
-import { mount } from 'enzyme';
+import { render } from '@testing-library/react';
import mockData from './data/Chapters.test.json';
import { ContentsContext } from '../../src/components/contents-context';
import GuidesTOCTree from '../../src/components/Sidenav/GuidesTOCTree';
@@ -13,7 +13,7 @@ const mockHeadingNodes = [
const getWrapper = ({ currentSlug }) => {
const { chapters, guides } = mockData.metadata;
- return mount(
+ return render(
@@ -25,9 +25,8 @@ it('renders with correct active slug', () => {
const wrapper = getWrapper({ currentSlug });
// Contains 3 guides in the same chapter + 3 headings
- expect(wrapper.find('SideNavItem')).toHaveLength(6);
+ expect(wrapper.queryAllByRole('link')).toHaveLength(6);
- const activeItem = wrapper.findWhere((n) => n.is('SideNavItem') && n.prop('active') === true);
- expect(activeItem).toHaveLength(1);
- expect(activeItem.prop('to')).toEqual(currentSlug);
+ const activeItem = wrapper.getByRole('link', { current: 'page' });
+ expect(activeItem).toHaveAttribute('href', `/${currentSlug}/`);
});
diff --git a/tests/unit/Lightbox.test.js b/tests/unit/Lightbox.test.js
index 14ee3b80b..a0fa248e6 100644
--- a/tests/unit/Lightbox.test.js
+++ b/tests/unit/Lightbox.test.js
@@ -1,51 +1,30 @@
import React from 'react';
-import { mount, shallow } from 'enzyme';
+import { render } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
import Lightbox from '../../src/components/Lightbox';
// data for this component
import mockData from './data/Figure.test.json';
-const mountLightbox = (nodeData) => mount( );
-const shallowLightbox = (nodeData) => shallow( );
-
describe('Lightbox', () => {
- let wrapper;
- let shallowWrapper;
-
- beforeAll(() => {
- wrapper = mountLightbox(mockData);
- shallowWrapper = shallowLightbox(mockData);
- });
-
it('renders correctly', () => {
- expect(shallowWrapper).toMatchSnapshot();
- expect(wrapper).toMatchSnapshot();
+ const wrapper = render( );
+ expect(wrapper.asFragment()).toMatchSnapshot();
});
- it('displays lightbox', () => {
- expect(wrapper.find('Lightbox')).toHaveLength(1);
- expect(wrapper.find('Image')).toHaveLength(1);
+ it('displays lightbox image and prompt', () => {
+ const wrapper = render( );
+ expect(wrapper.getByText('click to enlarge')).toBeTruthy();
+ expect(wrapper.getByAltText('/images/firstcluster.png')).toBeTruthy();
});
it('does not display the modal', () => {
- expect(wrapper.exists('Modal')).toBe(true);
- expect(wrapper.find('Modal').prop('open')).toBe(false);
+ const wrapper = render( );
+ expect(wrapper.queryAllByRole('dialog').length).toBe(0);
});
it('clicking the photo opens the modal', () => {
- expect(wrapper.find('LightboxCaption')).toHaveLength(1);
- expect(wrapper.find('LightboxCaption').text()).toEqual('click to enlarge');
- });
-
- it('clicking the photo', () => {
- const modalOpener = wrapper.find('Image');
- modalOpener.simulate('click');
- expect(wrapper.exists('Modal')).toBe(true);
- expect(wrapper.find('Modal').prop('open')).toBe(true);
- });
-
- it('clicking anywhere outside of the modal', () => {
- const lightboxWrapper = wrapper.find('LightboxCaption');
- lightboxWrapper.simulate('click');
- expect(wrapper.find('Modal').prop('open')).toBe(false);
+ const wrapper = render( );
+ userEvent.click(wrapper.getByRole('button'));
+ expect(wrapper.getByRole('dialog')).toBeTruthy();
});
});
diff --git a/tests/unit/ListTable.test.js b/tests/unit/ListTable.test.js
index f07c0a7b4..fb01e33d6 100644
--- a/tests/unit/ListTable.test.js
+++ b/tests/unit/ListTable.test.js
@@ -1,5 +1,5 @@
import React from 'react';
-import { mount, render } from 'enzyme';
+import { render } from '@testing-library/react';
import ListTable from '../../src/components/ListTable';
import { matchers } from 'jest-emotion';
@@ -8,91 +8,59 @@ import mockDataFixedWidths from './data/ListTableFixedWidths.test.json';
expect.extend(matchers);
-const mountListTable = (data) => mount( );
-const renderListTable = (data) => render( );
+const mountListTable = (data) => render( );
describe('when rendering a list-table directive', () => {
- let wrapper;
- let rendered;
const data = mockData;
- beforeAll(() => {
- wrapper = mountListTable(data);
- rendered = renderListTable(data);
- });
-
it('renders correctly', () => {
- expect(rendered).toMatchSnapshot();
+ const wrapper = mountListTable(data);
+ expect(wrapper.asFragment()).toMatchSnapshot();
});
it('displays one header row', () => {
- expect(wrapper.find('thead').children().find('tr')).toHaveLength(1);
+ const wrapper = mountListTable(data);
+ expect(wrapper.getByTestId('leafygreen-ui-header-row')).toBeTruthy();
});
it('displays six header columns', () => {
- expect(wrapper.find('thead').children().find('tr').children().find('th')).toHaveLength(6);
+ const wrapper = mountListTable(data);
+ expect(wrapper.queryAllByRole('columnheader')).toHaveLength(6);
});
it('displays five body rows', () => {
- expect(wrapper.find('tbody').children().find('tr')).toHaveLength(5);
- });
-
- it('displays five body columns', () => {
- expect(wrapper.find('tbody').children().find('tr').first().children().find('td')).toHaveLength(5);
+ const wrapper = mountListTable(data);
+ // we test for 6 here, with an offset to account for the header row
+ expect(wrapper.queryAllByRole('row')).toHaveLength(6);
});
- it('displays one stub column', () => {
- expect(wrapper.find('tbody').children().find('tr').first().children().find('th')).toHaveLength(1);
- });
-
- it('renders one stub column in the body', () => {
- expect(
- wrapper
- .find('th')
- .parent()
- .filterWhere((p) => p.is('Cell'))
- ).toHaveLength(5);
+ it('renders one stub column per row', () => {
+ const wrapper = mountListTable(data);
+ expect(wrapper.queryAllByRole('rowheader')).toHaveLength(5);
});
});
describe('when rendering a list table with fixed widths', () => {
- let wrapper;
- let rendered;
const data = mockDataFixedWidths;
- beforeAll(() => {
- wrapper = mountListTable(data);
- rendered = renderListTable(data);
- });
-
it('renders correctly', () => {
- expect(rendered).toMatchSnapshot();
+ const wrapper = mountListTable(data);
+ expect(wrapper.asFragment()).toMatchSnapshot();
});
- it('displays no content in the header row', () => {
- expect(wrapper.find('thead').children().find('tr').text()).toEqual('');
- });
-
- it('displays one body row', () => {
- expect(wrapper.find('tbody').children().find('Row')).toHaveLength(1);
- });
-
- it('displays six body columns', () => {
- expect(wrapper.find('tbody').children().find('tr').first().children().find('td')).toHaveLength(6);
+ it('displays six header columns', () => {
+ const wrapper = mountListTable(data);
+ expect(wrapper.queryAllByRole('columnheader')).toHaveLength(6);
});
- it('displays columns with set widths', () => {
- const headers = wrapper.find('TableHeader');
- expect(headers).toHaveLength(6);
- expect(headers.at(0)).toHaveStyleRule('width', '5%');
- expect(headers.at(1)).toHaveStyleRule('width', '10%');
- expect(headers.at(2)).toHaveStyleRule('width', '15%');
- expect(headers.at(3)).toHaveStyleRule('width', '20%');
- expect(headers.at(4)).toHaveStyleRule('width', '30%');
- expect(headers.at(5)).toHaveStyleRule('width', '20%');
+ it('displays no content in the header row', () => {
+ const wrapper = mountListTable(data);
+ expect(wrapper.getByTestId('leafygreen-ui-header-row')).toBeTruthy();
+ expect(wrapper.queryByText('name')).not.toBeTruthy();
});
it('displays no stub columns', () => {
- expect(wrapper.find('.stub')).toHaveLength(0);
+ const wrapper = mountListTable(data);
+ expect(wrapper.queryAllByRole('rowheader')).toHaveLength(0);
});
});
diff --git a/tests/unit/Operation.test.js b/tests/unit/Operation.test.js
index b131f09e7..57b77c64f 100644
--- a/tests/unit/Operation.test.js
+++ b/tests/unit/Operation.test.js
@@ -1,35 +1,35 @@
import React from 'react';
-import { mount, shallow } from 'enzyme';
+import { render } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
import * as reachRouter from '@reach/router';
import Operation from '../../src/components/Operation';
// data for this component
import { onlyDescription, neitherSummaryNorDescription, bothSummaryAndDescription } from './data/Operation.test.json';
-const shallowOperation = (data) => shallow( );
-const mountOperation = (data) => mount( );
+const shallowOperation = (data) =>
+ render(
+
+
+
+ );
const mockLocation = (hash) => jest.spyOn(reachRouter, 'useLocation').mockImplementation(() => ({ hash }));
describe('when rendering all fields', () => {
- let wrapper;
-
beforeAll(() => {
mockLocation(null);
});
it('renders correctly ', () => {
- wrapper = shallowOperation(bothSummaryAndDescription);
- expect(wrapper).toMatchSnapshot();
+ const wrapper = shallowOperation(bothSummaryAndDescription);
+ expect(wrapper.asFragment()).toMatchSnapshot();
});
describe('when the component is loaded', () => {
- beforeAll(() => {
- wrapper = mountOperation(bothSummaryAndDescription);
- });
-
it('does not expand the card on load', () => {
- expect(wrapper.exists('Details')).toBe(false);
+ const wrapper = shallowOperation(bothSummaryAndDescription);
+ expect(wrapper.queryAllByText('Description').length).toBe(0);
});
describe('when the expand button is clicked', () => {
@@ -38,12 +38,14 @@ describe('when rendering all fields', () => {
});
it('the card expands', () => {
- const button = wrapper.find('button').at(1);
- button.simulate('click');
- expect(wrapper.exists('Details')).toBe(true);
+ const wrapper = shallowOperation(bothSummaryAndDescription);
+ userEvent.click(wrapper.getByLabelText('Show operation details'));
+ expect(wrapper.queryAllByText('Description')).toBeTruthy();
});
it('appends the hash to the URL', () => {
+ const wrapper = shallowOperation(bothSummaryAndDescription);
+ userEvent.click(wrapper.getByLabelText('Show operation details'));
expect(window.history.pushState).toBeCalledWith({ href: 'get-/auth/profile' }, '', '#get-/auth/profile');
});
});
@@ -59,12 +61,12 @@ describe('when no summary is present', () => {
it('renders correctly ', () => {
wrapper = shallowOperation(onlyDescription);
- expect(wrapper).toMatchSnapshot();
+ expect(wrapper.asFragment()).toMatchSnapshot();
});
it('does not show the "Description" section', () => {
- wrapper = mountOperation(onlyDescription);
- expect(wrapper.exists('Description')).toBe(true);
+ wrapper = shallowOperation(onlyDescription);
+ expect(wrapper.queryAllByText('Description')).toBeTruthy();
});
});
@@ -75,7 +77,7 @@ describe('when no summary or description is present', () => {
it('renders correctly ', () => {
let wrapper = shallowOperation(neitherSummaryNorDescription);
- expect(wrapper).toMatchSnapshot();
+ expect(wrapper.asFragment()).toMatchSnapshot();
});
});
@@ -85,7 +87,7 @@ describe('when a page is loaded with its hash set', () => {
});
it('automatically expands the card', () => {
- let wrapper = mountOperation(onlyDescription);
- expect(wrapper.exists('Details')).toBe(true);
+ let wrapper = shallowOperation(onlyDescription);
+ expect(wrapper.queryAllByText('Details')).toBeTruthy();
});
});
diff --git a/tests/unit/Pagination.test.js b/tests/unit/Pagination.test.js
index 20931b38e..e23805faa 100644
--- a/tests/unit/Pagination.test.js
+++ b/tests/unit/Pagination.test.js
@@ -1,5 +1,6 @@
import React, { useState } from 'react';
-import { shallow, mount } from 'enzyme';
+import { render } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
import Pagination from '../../src/components/Searchbar/Pagination';
// Simple wrapper to add state control around the Pagination component
@@ -10,52 +11,46 @@ const PaginationController = ({ startPage, totalPages }) => {
describe('Pagination', () => {
it('renders pagination correctly', () => {
- const wrapper = shallow( );
- expect(wrapper).toMatchSnapshot();
+ const wrapper = render( );
+ expect(wrapper.asFragment()).toMatchSnapshot();
});
it('should not allow page 1 to be decremented', () => {
- const wrapper = shallow( );
- let paginationText = wrapper.find('PaginationText').text();
- expect(paginationText).toBe('1/10');
- const decrementButton = wrapper.find('PaginationButton').at(0);
- expect(decrementButton.props().disabled).toBeTruthy();
- decrementButton.simulate('click');
- paginationText = wrapper.find('PaginationText').text();
- // Should not allow for 1 to be decremented
- expect(paginationText).toBe('1/10');
+ const wrapper = render( );
+ let paginationText = wrapper.getByText('1/10');
+ // let paginationText = wrapper.find('PaginationText').text();
+ expect(paginationText).toBeTruthy();
+ const decrementButton = wrapper.getByTitle('Back Page');
+ expect(decrementButton).toHaveAttribute('aria-disabled', 'true');
});
it('should allow pages > 1 to be decremented', () => {
- const paginationWithController = mount( );
- let paginationText = paginationWithController.find('PaginationText').text();
- expect(paginationText).toBe('2/5');
- const decrementButton = paginationWithController.find('PaginationButton').at(0);
- expect(decrementButton.props().disabled).toBeFalsy();
- decrementButton.simulate('click');
- paginationText = paginationWithController.find('PaginationText').text();
- expect(paginationText).toBe('1/5');
+ const wrapper = render( );
+ let paginationText = wrapper.getByText('2/5');
+ expect(paginationText).toBeTruthy();
+ const decrementButton = wrapper.getByTitle('Back Page');
+ expect(decrementButton).toHaveAttribute('aria-disabled', 'false');
+ userEvent.click(decrementButton);
+ paginationText = wrapper.getByText('1/5');
+ expect(paginationText).toBeTruthy();
});
it('should allow pages < total pages to be incremented', () => {
- const paginationWithController = mount( );
- let paginationText = paginationWithController.find('PaginationText').text();
- expect(paginationText).toBe('2/5');
- const incrementButton = paginationWithController.find('PaginationButton').at(1);
- expect(incrementButton.props().disabled).toBeFalsy();
- incrementButton.simulate('click');
- paginationText = paginationWithController.find('PaginationText').text();
- expect(paginationText).toBe('3/5');
+ const wrapper = render( );
+ let paginationText = wrapper.getByText('2/5');
+ expect(paginationText).toBeTruthy();
+ const incrementButton = wrapper.getByTitle('Forward Page');
+ expect(incrementButton).toHaveAttribute('aria-disabled', 'false');
+ userEvent.click(incrementButton);
+ paginationText = wrapper.getByText('3/5');
+ expect(paginationText).toBeTruthy();
});
it('should not allow the last page to be incremented', () => {
- const paginationWithController = mount( );
- let paginationText = paginationWithController.find('PaginationText').text();
- expect(paginationText).toBe('5/5');
- const incrementButton = paginationWithController.find('PaginationButton').at(1);
- expect(incrementButton.props().disabled).toBeTruthy();
- incrementButton.simulate('click');
- paginationText = paginationWithController.find('PaginationText').text();
- expect(paginationText).toBe('5/5');
+ const wrapper = render( );
+ let paginationText = wrapper.getByText('5/5');
+ expect(paginationText).toBeTruthy();
+ const incrementButton = wrapper.getByTitle('Forward Page');
+ expect(incrementButton).toHaveAttribute('aria-disabled', 'true');
});
});
diff --git a/tests/unit/Pills.test.js b/tests/unit/Pills.test.js
index 1e1eb8dc6..032ad9926 100644
--- a/tests/unit/Pills.test.js
+++ b/tests/unit/Pills.test.js
@@ -1,38 +1,39 @@
import React from 'react';
-import { mount, shallow } from 'enzyme';
+import { render } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
import Pills from '../../src/components/Pills';
import { TabContext } from '../../src/components/tab-context';
import { PLATFORMS } from '../../src/constants';
-const mountPills = ({ activeTabs, mockData, mockSetActiveTab }) =>
- mount(
+const renderPills = ({ activeTabs, mockData, mockSetActiveTab }) =>
+ render(
);
-const shallowPills = ({ mockData }) => shallow( );
describe('Pills component', () => {
- let wrapper;
- let shallowWrapper;
const mockData = ['windows', 'macos', 'linux'];
const mockSetActiveTab = jest.fn();
- beforeAll(() => {
- wrapper = mountPills({
+ beforeAll(() => {});
+
+ it('renders correctly', () => {
+ const wrapper = renderPills({
activeTabs: { platforms: PLATFORMS[1] },
mockData,
mockSetActiveTab,
});
- shallowWrapper = shallowPills({ mockData });
- });
-
- it('renders correctly', () => {
- expect(shallowWrapper).toMatchSnapshot();
+ expect(wrapper.asFragment()).toMatchSnapshot();
});
it('clicking a pill calls the event handler', () => {
- wrapper.find('.guide__pill').first().simulate('click');
+ const wrapper = renderPills({
+ activeTabs: { platforms: PLATFORMS[1] },
+ mockData,
+ mockSetActiveTab,
+ });
+ userEvent.click(wrapper.queryAllByRole('button')[0]);
expect(mockSetActiveTab.mock.calls.length).toBe(1);
});
});
diff --git a/tests/unit/ProductsList.test.js b/tests/unit/ProductsList.test.js
index 436afb5d7..415d0a294 100644
--- a/tests/unit/ProductsList.test.js
+++ b/tests/unit/ProductsList.test.js
@@ -1,5 +1,6 @@
import React from 'react';
-import { mount } from 'enzyme';
+import { render } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
import { matchers } from 'jest-emotion';
import ProductsList from '../../src/components/Sidenav/ProductsList';
import { tick } from '../utils';
@@ -21,27 +22,25 @@ jest.mock('../../src/hooks/useAllProducts', () => ({
expect.extend(matchers);
-const expectComponentIsOpen = (wrapper, value) => {
- expect(wrapper.find('ProductsListHeading').prop('isOpen')).toEqual(value);
-};
-
describe('ProductsList', () => {
jest.useFakeTimers();
it('renders closed', async () => {
- const wrapper = mount( );
- expectComponentIsOpen(wrapper, false);
+ const wrapper = render( );
// Products still technically render, but should be displayed as none
- const productsList = wrapper.find('Products');
- expect(productsList.childAt(0).children()).toHaveLength(2);
- expect(productsList).toHaveStyleRule('display', 'none');
+ const productsListEntry = wrapper.getByText(mockProducts[0].title);
+ expect(productsListEntry).toBeTruthy();
+ // expect(productsList.childAt(0).children()).toHaveLength(2);
+ expect(productsListEntry).not.toBeVisible();
});
it('opens on click', async () => {
- const wrapper = mount( );
- wrapper.find('ProductsListHeading').simulate('click');
- await tick({ wrapper });
+ const wrapper = render( );
+ userEvent.click(wrapper.getByText('View all products'));
+ await tick();
+ const productsListEntry = wrapper.getByText(mockProducts[0].title);
// Check for the state since this should control which css is applied at which state
- expectComponentIsOpen(wrapper, true);
+ expect(productsListEntry).toBeTruthy();
+ expect(productsListEntry).toBeVisible();
});
});
diff --git a/tests/unit/Searchbar.test.js b/tests/unit/Searchbar.test.js
deleted file mode 100644
index e9131c20d..000000000
--- a/tests/unit/Searchbar.test.js
+++ /dev/null
@@ -1,284 +0,0 @@
-import React from 'react';
-import { mount, shallow } from 'enzyme';
-import { act } from 'react-dom/test-utils';
-import * as Gatsby from 'gatsby';
-import Searchbar from '../../src/components/Searchbar';
-import { FILTERED_RESULT, mockMarianFetch, UNFILTERED_RESULT } from './utils/mock-marian-fetch';
-import { getSearchbarResultsFromJSON } from '../../src/utils/get-searchbar-results-from-json';
-import { searchParamsToURL } from '../../src/utils/search-params-to-url';
-import { DOCS_URL } from '../../src/constants';
-
-const useStaticQuery = jest.spyOn(Gatsby, 'useStaticQuery');
-const setProject = (project) => {
- useStaticQuery.mockImplementation(() => ({
- site: {
- siteMetadata: {
- project,
- },
- },
- }));
-};
-
-const getAdvancedFiltersPane = async () => {
- const searchbar = mount(
-
- );
- // The searchbar debounces search calls to Marian, so we need to trigger the
- // timeout programatically for test consistensy
- await act(async () => {
- searchbar.find('input').simulate('change', { target: { value: 'stitch' } });
- });
- jest.runAllTimers();
- await searchbar.update();
- await act(async () => {
- await searchbar.update();
- // Need re-render for child array prop to update (shallow compare seems to fail)
- searchbar.mount();
- searchbar.find('FilterFooterButton').simulate('click');
- });
- const advancedFiltersPane = searchbar.find('AdvancedFiltersPane');
- return { advancedFiltersPane, searchbar };
-};
-
-const expectProductDropdownValues = (wrapper, productValue, versionValue) => {
- expect(wrapper.find('StyledCustomSelect').at(0).text()).toContain(productValue);
- // Second filter should update automatically
- expect(wrapper.find('StyledCustomSelect').at(1).text()).toContain(versionValue);
-};
-
-const fillInFilterDropdowns = async (wrapper) => {
- let firstDropdown = wrapper.find('StyledCustomSelect').at(0);
- firstDropdown.simulate('click');
- const firstChoice = wrapper.find('Option').at(0);
- await act(async () => {
- firstChoice.simulate('click');
- });
- await wrapper.update();
- expectProductDropdownValues(wrapper, 'Realm', 'Latest');
-};
-
-const checkSearchResult = (wrapper, result) => {
- const searchResult = wrapper.find('StyledSearchResult');
- expect(searchResult.length).toBe(1);
- expect(searchResult.exists());
- expect(searchResult.text()).toContain(result.title);
- expect(searchResult.text()).toContain(result.preview);
- return searchResult;
-};
-
-describe('Searchbar', () => {
- beforeAll(() => {
- window.fetch = mockMarianFetch;
- jest.useFakeTimers();
- setProject('bi-connector');
- });
-
- afterAll(() => {
- window.fetch = null;
- });
-
- it('renders correctly without browser', () => {
- const condensedTree = shallow( );
- expect(condensedTree).toMatchSnapshot();
- const expandedTree = shallow( );
- expect(expandedTree).toMatchSnapshot();
- });
-
- it('renders search results given a query', async () => {
- const searchbar = mount(
-
- );
- await act(async () => {
- searchbar.find('input').simulate('change', { target: { value: 'stitch' } });
- });
- jest.runAllTimers();
- await searchbar.update();
- await act(async () => {
- await searchbar.update();
- expect(searchbar.find('input').props().value).toEqual('stitch');
- // Need re-render for child array prop to update (shallow compare seems to fail)
- searchbar.mount();
- });
- const searchResult = checkSearchResult(searchbar, UNFILTERED_RESULT);
- const searchResultLink = searchResult.find('SearchResultLink').at(0);
- expect(searchResultLink.props()).toHaveProperty('href', UNFILTERED_RESULT.url);
- });
-
- it('should not apply filters when the back button is clicked', async () => {
- const { advancedFiltersPane, searchbar } = await getAdvancedFiltersPane();
- let backButton = advancedFiltersPane.find('StyledReturnButton');
- backButton.simulate('click');
- await searchbar.update();
- expect(searchbar.find('SearchResultsContainer').exists());
-
- // Ensure no filters are applied
- checkSearchResult(searchbar, UNFILTERED_RESULT);
-
- // Change a filter and expect the unfiltered responses to show if we use the back button
- await act(async () => {
- searchbar.find('FilterFooterButton').simulate('click');
- });
- await searchbar.update();
-
- await fillInFilterDropdowns(searchbar);
-
- backButton = advancedFiltersPane.find('StyledReturnButton');
- backButton.simulate('click');
- await searchbar.update();
-
- // At this point, since we hit the back button the filters should not have been applied
- checkSearchResult(searchbar, UNFILTERED_RESULT);
- });
-
- it('should apply filters and update results', async () => {
- const { searchbar } = await getAdvancedFiltersPane();
- expectProductDropdownValues(searchbar, 'Select a Product', 'Select a Version');
- let firstDropdown = searchbar.find('StyledCustomSelect').at(0);
- firstDropdown.simulate('click');
- const firstChoice = searchbar.find('Option').at(0);
- await act(async () => {
- firstChoice.simulate('click');
- });
- await searchbar.update();
- expectProductDropdownValues(searchbar, 'Realm', 'Latest');
-
- const applyButton = searchbar.find('FilterFooterButton');
- expect(applyButton.text()).toBe('Apply Search Criteria (2)');
- await act(async () => {
- applyButton.simulate('click');
- // Re-running a debounced search, so we must trigger the timeout
- jest.runAllTimers();
- });
- await searchbar.update();
-
- // At this point, we should see the filtered result
- checkSearchResult(searchbar, FILTERED_RESULT);
- });
-
- it('should reset filters', async () => {
- const { searchbar } = await getAdvancedFiltersPane();
- let firstDropdown = searchbar.find('StyledCustomSelect').at(0);
- firstDropdown.simulate('click');
- const firstChoice = searchbar.find('Option').at(0);
- await act(async () => {
- firstChoice.simulate('click');
- });
- await searchbar.update();
-
- const applyButton = searchbar.find('FilterFooterButton');
- expect(applyButton.text()).toBe('Apply Search Criteria (2)');
- await act(async () => {
- applyButton.simulate('click');
- // Re-running a debounced search, so we must trigger the timeout
- jest.runAllTimers();
- });
- await searchbar.update();
-
- // At this point, we should see the filtered result
- checkSearchResult(searchbar, FILTERED_RESULT);
- searchbar.find('FilterFooterButton').simulate('click');
- await searchbar.update();
- await act(async () => {
- searchbar.find('FilterResetButton').simulate('click');
- // Re-running a debounced search, so we must trigger the timeout
- jest.runAllTimers();
- });
- expectProductDropdownValues(searchbar, 'Select a Product', 'Select a Version');
- await act(async () => {
- searchbar.find('FilterFooterButton').simulate('click');
- // Re-running a debounced search, so we must trigger the timeout
- jest.runAllTimers();
- });
- await searchbar.update();
- checkSearchResult(searchbar, UNFILTERED_RESULT);
- });
-
- it('should properly update the go button href on query changes', async () => {
- const searchbar = mount(
-
- );
- // The go button does not render if there is no search query yet
- expect(!searchbar.exists('GoButton'));
-
- await act(async () => {
- searchbar.find('input').simulate('change', { target: { value: 'stitch' } });
- });
- jest.runAllTimers();
- await searchbar.update();
- await act(async () => {
- await searchbar.update();
- // Need re-render for child array prop to update (shallow compare seems to fail)
- searchbar.mount();
- });
- expect(searchbar.exists('GoButton'));
- expect(searchbar.find('GoButton').props()).toHaveProperty('href', `${DOCS_URL}/search?q=stitch`);
- await act(async () => {
- searchbar.find('FilterFooterButton').simulate('click');
- });
- await searchbar.update();
- await fillInFilterDropdowns(searchbar);
- const applyButton = searchbar.find('FilterFooterButton');
- expect(applyButton.text()).toBe('Apply Search Criteria (2)');
- await act(async () => {
- applyButton.simulate('click');
- // Re-running a debounced search, so we must trigger the timeout
- jest.runAllTimers();
- });
- expect(searchbar.find('GoButton').props()).toHaveProperty(
- 'href',
- `${DOCS_URL}/search?q=stitch&searchProperty=realm-master`
- );
- });
-});
-
-describe('Searchbar on Realm', () => {
- beforeAll(() => {
- window.fetch = mockMarianFetch;
- jest.useFakeTimers();
- setProject('realm');
- });
-
- afterAll(() => {
- window.fetch = null;
- });
-
- it('should apply the Realm product filter by default', async () => {
- const searchbar = mount(
-
- );
- await act(async () => {
- searchbar.find('input').simulate('change', { target: { value: 'stitch' } });
- });
- jest.runAllTimers();
- await searchbar.update();
- await act(async () => {
- await searchbar.update();
- expect(searchbar.find('input').props().value).toEqual('stitch');
- // Need re-render for child array prop to update (shallow compare seems to fail)
- searchbar.mount();
- });
- const searchResult = checkSearchResult(searchbar, FILTERED_RESULT);
- const searchResultLink = searchResult.find('SearchResultLink').at(0);
- expect(searchResultLink.props()).toHaveProperty('href', FILTERED_RESULT.url);
- });
-});
diff --git a/tests/unit/__snapshots__/Lightbox.test.js.snap b/tests/unit/__snapshots__/Lightbox.test.js.snap
index 65a70c44d..cd7eec0bc 100644
--- a/tests/unit/__snapshots__/Lightbox.test.js.snap
+++ b/tests/unit/__snapshots__/Lightbox.test.js.snap
@@ -1,122 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Lightbox renders correctly 1`] = `
-
-
-
-
-
- click to enlarge
-
-
-
-
-
-
-
-
-`;
-
-exports[`Lightbox renders correctly 2`] = `
-.emotion-3 {
+
+ .emotion-3 {
width: 700px;
cursor: pointer;
margin: 0;
@@ -136,176 +22,24 @@ exports[`Lightbox renders correctly 2`] = `
text-align: center;
}
-.emotion-5 {
- z-index: 10;
-}
-
-@media not all and (max-width:1023px) {
- .emotion-5 div[role='dialog'] {
- width: 80%;
- }
-}
-
-@media only screen and (max-width:1023px) {
- .emotion-5 div[role='dialog'] {
- width: 100%;
- }
-}
-
-.emotion-5 img {
- width: 100%;
-}
-
-
-
+
-
-
-
-
-
- click to enlarge
-
-
+ click to enlarge
-
-
-
-
-
-
-
-
+
+
`;
diff --git a/tests/unit/__snapshots__/ListTable.test.js.snap b/tests/unit/__snapshots__/ListTable.test.js.snap
index 967fc3c88..d7688c980 100644
--- a/tests/unit/__snapshots__/ListTable.test.js.snap
+++ b/tests/unit/__snapshots__/ListTable.test.js.snap
@@ -1,7 +1,8 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`when rendering a list table with fixed widths renders correctly 1`] = `
-.emotion-36 {
+
+ .emotion-36 {
position: relative;
max-width: 100%;
}
@@ -109,22 +110,6 @@ exports[`when rendering a list table with fixed widths renders correctly 1`] = `
color: #3D4F58;
}
-.emotion-33 {
- border-top: 1px solid #E7EEEC;
- color: #3D4F58;
- opacity: 0;
-}
-
-.emotion-33 > td > [data-leafygreen-ui="td-inner-div"] {
- min-height: 40px;
- -webkit-transition: all 150ms ease-in-out;
- transition: all 150ms ease-in-out;
-}
-
-.emotion-33 > td:nth-child(1) {
- padding-left: 8px;
-}
-
.emotion-22 {
min-width: 40px;
padding: 8px 8px;
@@ -147,6 +132,63 @@ exports[`when rendering a list table with fixed widths renders correctly 1`] = `
margin-bottom: 0;
}
+.emotion-33 {
+ border-top: 1px solid #E7EEEC;
+ color: #3D4F58;
+}
+
+.emotion-33 > td > [data-leafygreen-ui="td-inner-div"] {
+ min-height: 40px;
+ -webkit-transition: all 150ms ease-in-out;
+ transition: all 150ms ease-in-out;
+}
+
+.emotion-33 > td:nth-child(1) {
+ padding-left: 8px;
+}
+
+.emotion-33 td:nth-child(1) > div {
+ -webkit-box-pack: start;
+ -webkit-justify-content: flex-start;
+ -ms-flex-pack: start;
+ justify-content: flex-start;
+}
+
+.emotion-33 td:nth-child(2) > div {
+ -webkit-box-pack: start;
+ -webkit-justify-content: flex-start;
+ -ms-flex-pack: start;
+ justify-content: flex-start;
+}
+
+.emotion-33 td:nth-child(3) > div {
+ -webkit-box-pack: start;
+ -webkit-justify-content: flex-start;
+ -ms-flex-pack: start;
+ justify-content: flex-start;
+}
+
+.emotion-33 td:nth-child(4) > div {
+ -webkit-box-pack: start;
+ -webkit-justify-content: flex-start;
+ -ms-flex-pack: start;
+ justify-content: flex-start;
+}
+
+.emotion-33 td:nth-child(5) > div {
+ -webkit-box-pack: start;
+ -webkit-justify-content: flex-start;
+ -ms-flex-pack: start;
+ justify-content: flex-start;
+}
+
+.emotion-33 td:nth-child(6) > div {
+ -webkit-box-pack: start;
+ -webkit-justify-content: flex-start;
+ -ms-flex-pack: start;
+ justify-content: flex-start;
+}
+
.emotion-4 {
border-width: 0px 1px 3px 1px;
border-style: solid;
@@ -213,200 +255,202 @@ exports[`when rendering a list table with fixed widths renders correctly 1`] = `
}
-
-
-
-
+
+
-
-
-
+
+
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
+
+
+
+
-
-
-
-
-
+
+
+
+
-
-
-
-
-
+
+
+
+
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
-
-
- notebook
-
-
-
-
-
+
+ notebook
+
+
+
+
-
- 50
-
-
-
-
-
+
+ 50
+
+
+
+
-
- 8.5x11,in
-
-
-
-
-
+
+ 8.5x11,in
+
+
+
+
-
- A
-
-
-
-
-
+
+ A
+
+
+
+
-
- college-ruled,perforated
-
-
-
-
-
+
+ college-ruled,perforated
+
+
+
+
-
- 8
-
-
-
-
-
-
+
+
+ 8
+
+
+
+
+
+
+
-
+
`;
exports[`when rendering a list-table directive renders correctly 1`] = `
-.emotion-87 {
+
+ .emotion-87 {
position: relative;
max-width: 100%;
}
@@ -520,22 +564,6 @@ exports[`when rendering a list-table directive renders correctly 1`] = `
color: #3D4F58;
}
-.emotion-32 {
- border-top: 1px solid #E7EEEC;
- color: #3D4F58;
- opacity: 0;
-}
-
-.emotion-32 > td > [data-leafygreen-ui="td-inner-div"] {
- min-height: 40px;
- -webkit-transition: all 150ms ease-in-out;
- transition: all 150ms ease-in-out;
-}
-
-.emotion-32 > td:nth-child(1) {
- padding-left: 8px;
-}
-
.emotion-21 {
min-width: 40px;
padding: 8px 8px;
@@ -583,529 +611,587 @@ exports[`when rendering a list-table directive renders correctly 1`] = `
margin-bottom: 0;
}
+.emotion-32 {
+ border-top: 1px solid #E7EEEC;
+ color: #3D4F58;
+}
+
+.emotion-32 > td > [data-leafygreen-ui="td-inner-div"] {
+ min-height: 40px;
+ -webkit-transition: all 150ms ease-in-out;
+ transition: all 150ms ease-in-out;
+}
+
+.emotion-32 > td:nth-child(1) {
+ padding-left: 8px;
+}
+
+.emotion-32 td:nth-child(1) > div {
+ -webkit-box-pack: start;
+ -webkit-justify-content: flex-start;
+ -ms-flex-pack: start;
+ justify-content: flex-start;
+}
+
+.emotion-32 td:nth-child(2) > div {
+ -webkit-box-pack: start;
+ -webkit-justify-content: flex-start;
+ -ms-flex-pack: start;
+ justify-content: flex-start;
+}
+
+.emotion-32 td:nth-child(3) > div {
+ -webkit-box-pack: start;
+ -webkit-justify-content: flex-start;
+ -ms-flex-pack: start;
+ justify-content: flex-start;
+}
+
+.emotion-32 td:nth-child(4) > div {
+ -webkit-box-pack: start;
+ -webkit-justify-content: flex-start;
+ -ms-flex-pack: start;
+ justify-content: flex-start;
+}
+
+.emotion-32 td:nth-child(5) > div {
+ -webkit-box-pack: start;
+ -webkit-justify-content: flex-start;
+ -ms-flex-pack: start;
+ justify-content: flex-start;
+}
+
+.emotion-32 td:nth-child(6) > div {
+ -webkit-box-pack: start;
+ -webkit-justify-content: flex-start;
+ -ms-flex-pack: start;
+ justify-content: flex-start;
+}
+
-
-
-
-
+
+
-
-
-
+
+
-
-
- name
-
-
-
-
-
+ name
+
+
+
+
-
- quantity
-
-
-
-
-
+ quantity
+
+
+
+
-
- size
-
-
-
-
-
+ size
+
+
+
+
-
- status
-
-
-
-
-
+ status
+
+
+
+
-
- tags
-
-
-
-
-
+ tags
+
+
+
+
-
- rating
-
-
-
-
-
-
-
-
+ rating
+
+
+
+
+
+
+
-
-
- journal
-
-
-
-
-
+
+ journal
+
+
+
+
-
- 25
-
-
-
-
-
+
+ 25
+
+
+
+
-
- 14x21,cm
-
-
-
-
-
+
+ 14x21,cm
+
+
+
+
-
- A
-
-
-
-
-
+
+ A
+
+
+
+
-
- brown, lined
-
-
-
-
-
+
+ brown, lined
+
+
+
+
-
- 9
-
-
-
-
-
-
+
+ 9
+
+
+
+
+
-
-
- notebook
-
-
-
-
-
+
+ notebook
+
+
+
+
-
- 50
-
-
-
-
-
+
+ 50
+
+
+
+
-
- 8.5x11,in
-
-
-
-
-
+
+ 8.5x11,in
+
+
+
+
-
- A
-
-
-
-
-
+
+ A
+
+
+
+
-
- college-ruled,perforated
-
-
-
-
-
+
+ college-ruled,perforated
+
+
+
+
-
- 8
-
-
-
-
-
-
+
+ 8
+
+
+
+
+
-
-
- paper
-
-
-
-
-
+
+ paper
+
+
+
+
-
- 100
-
-
-
-
-
+
+ 100
+
+
+
+
-
- 8.5x11,in
-
-
-
-
-
+
+ 8.5x11,in
+
+
+
+
-
- D
-
-
-
-
-
+
+ D
+
+
+
+
-
- watercolor
-
-
-
-
-
+
+ watercolor
+
+
+
+
-
- 10
-
-
-
-
-
-
+
+ 10
+
+
+
+
+
-
-
- planner
-
-
-
-
-
+
+ planner
+
+
+
+
-
- 75
-
-
-
-
-
+
+ 75
+
+
+
+
-
- 22.85x30,cm
-
-
-
-
-
+
+ 22.85x30,cm
+
+
+
+
-
- D
-
-
-
-
-
+
+ D
+
+
+
+
-
- 2019
-
-
-
-
-
+
+ 2019
+
+
+
+
-
- 10
-
-
-
-
-
-
+
+ 10
+
+
+
+
+
-
-
- postcard
-
-
-
-
-
+
+ postcard
+
+
+
+
-
- 45
-
-
-
-
-
+
+ 45
+
+
+
+
-
- 10x,cm
-
-
-
-
-
+
+ 10x,cm
+
+
+
+
-
- D
-
-
-
-
-
+
+ D
+
+
+
+
-
- double-sided,white
-
-
-
-
-
+
+ double-sided,white
+
+
+
+
-
- 2
-
-
-
-
-
-
+
+
+ 2
+
+
+
+
+
+
+
-
+
`;
diff --git a/tests/unit/__snapshots__/Operation.test.js.snap b/tests/unit/__snapshots__/Operation.test.js.snap
index e29c25a8b..76694a987 100644
--- a/tests/unit/__snapshots__/Operation.test.js.snap
+++ b/tests/unit/__snapshots__/Operation.test.js.snap
@@ -1,136 +1,863 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`when no summary is present renders correctly 1`] = `
-
-
+ .emotion-3 {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ -webkit-box-pack: center;
+ -webkit-justify-content: center;
+ -ms-flex-pack: center;
+ justify-content: center;
+}
+
+.emotion-15 {
+ position: relative;
+ border-radius: 7px;
+ -webkit-transition: border 300ms ease-in-out,box-shadow 300ms ease-in-out;
+ transition: border 300ms ease-in-out,box-shadow 300ms ease-in-out;
+ border: 1px solid #E7EEEC;
+ box-shadow: 0 4px 10px -4px rgba(6,22,33,0.3);
+ background-color: white;
+ color: #21313C;
+}
+
+.emotion-0 {
+ display: -webkit-inline-box;
+ display: -webkit-inline-flex;
+ display: -ms-inline-flexbox;
+ display: inline-flex;
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ font-weight: bold;
+ font-size: 11px;
+ line-height: 20px;
+ border-radius: 50px;
+ height: 20px;
+ padding-left: 9px;
+ padding-right: 9px;
+ text-transform: uppercase;
+ border: 1px solid;
+ background-color: #E1F2F6;
+ border-color: #C5E4F2;
+ color: #1A567E;
+}
+
+.emotion-5 {
+ border: none;
+ -webkit-appearance: unset;
+ padding: unset;
+ display: inline-block;
+ border-radius: 100px;
+ color: #89979B;
+ position: relative;
+ cursor: pointer;
+ -webkit-flex-shrink: 0;
+ -ms-flex-negative: 0;
+ flex-shrink: 0;
+ -webkit-transition: color 150ms ease-in-out;
+ transition: color 150ms ease-in-out;
+ background-color: rgba(255,255,255,0);
+ height: 28px;
+ width: 28px;
+}
+
+.emotion-5:before {
+ content: '';
+ -webkit-transition: 150ms all ease-in-out;
+ transition: 150ms all ease-in-out;
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ border-radius: 100%;
+ opacity: 0;
+ -webkit-transform: scale(0.8);
+ -ms-transform: scale(0.8);
+ transform: scale(0.8);
+}
+
+.emotion-5:active:before,
+.emotion-5:hover:before,
+.emotion-5:focus:before {
+ opacity: 1;
+ -webkit-transform: scale(1);
+ -ms-transform: scale(1);
+ transform: scale(1);
+}
+
+.emotion-5:focus {
+ outline: none;
+}
+
+.emotion-5:active,
+.emotion-5:hover {
+ color: #3D4F58;
+}
+
+.emotion-5:active:before,
+.emotion-5:hover:before {
+ background-color: #E7EEEC;
+}
+
+.emotion-5:focus {
+ color: #1A567E;
+}
+
+.emotion-5:focus:before {
+ background-color: #C5E4F2;
+}
+
+.emotion-14 {
+ margin-bottom: 16px;
+}
+
+.emotion-10 {
+ -webkit-align-items: baseline;
+ -webkit-box-align: baseline;
+ -ms-flex-align: baseline;
+ align-items: baseline;
+ background-color: #F9FBFA;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-flex-direction: row;
+ -ms-flex-direction: row;
+ flex-direction: row;
+ -webkit-box-pack: justify;
+ -webkit-justify-content: space-between;
+ -ms-flex-pack: justify;
+ justify-content: space-between;
+ padding: 16px 32px;
+}
+
+.emotion-10 > *:not(:last-child) {
+ margin-right: 16px;
+}
+
+@media only screen and (max-width:420px) {
+ .emotion-10 {
+ padding: 16px;
+ }
+}
+
+.emotion-1 {
+ color: #061621;
+}
+
+@media only screen and (max-width:420px) {
+ .emotion-1 {
+ word-break: break-all;
+ }
+}
+
+.emotion-6 {
+ top: -5px;
+ margin-left: 4px;
+ position: relative;
+}
+
+.emotion-4 {
+ -webkit-align-self: center;
+ -ms-flex-item-align: center;
+ align-self: center;
+ color: #89979B;
+}
+
+.emotion-8 {
+ top: -5px;
+ margin-left: auto;
+}
+
+.emotion-12 {
+ margin: 24px 32px;
+}
+
+@media only screen and (max-width:420px) {
+ .emotion-12 {
+ margin: 16px;
+ }
+}
+
+.emotion-12 > p {
+ display: -webkit-box;
+ -webkit-line-clamp: 2;
+ -webkit-box-orient: vertical;
+ overflow: hidden;
+}
+
+
- GET
-
-
-
-
-
-
+
+ GET
+
+
+
+ /auth/providers
+
+
+
+
+
+
+
+
+
+
+
+
+
+ This is a description. Lorem ipsum dolor sit amet, consectetur adipiscing
elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi
ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit
in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur
sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt
-mollit anim id est laborum.",
- },
- ],
- "position": Object {
- "start": Object {
- "line": 23,
- },
- },
- "type": "paragraph",
- }
- }
- />
-
+mollit anim id est laborum.
+
+
+
+
`;
exports[`when no summary or description is present renders correctly 1`] = `
-
-
+ .emotion-3 {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ -webkit-box-pack: center;
+ -webkit-justify-content: center;
+ -ms-flex-pack: center;
+ justify-content: center;
+}
+
+.emotion-13 {
+ position: relative;
+ border-radius: 7px;
+ -webkit-transition: border 300ms ease-in-out,box-shadow 300ms ease-in-out;
+ transition: border 300ms ease-in-out,box-shadow 300ms ease-in-out;
+ border: 1px solid #E7EEEC;
+ box-shadow: 0 4px 10px -4px rgba(6,22,33,0.3);
+ background-color: white;
+ color: #21313C;
+}
+
+.emotion-5 {
+ border: none;
+ -webkit-appearance: unset;
+ padding: unset;
+ display: inline-block;
+ border-radius: 100px;
+ color: #89979B;
+ position: relative;
+ cursor: pointer;
+ -webkit-flex-shrink: 0;
+ -ms-flex-negative: 0;
+ flex-shrink: 0;
+ -webkit-transition: color 150ms ease-in-out;
+ transition: color 150ms ease-in-out;
+ background-color: rgba(255,255,255,0);
+ height: 28px;
+ width: 28px;
+}
+
+.emotion-5:before {
+ content: '';
+ -webkit-transition: 150ms all ease-in-out;
+ transition: 150ms all ease-in-out;
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ border-radius: 100%;
+ opacity: 0;
+ -webkit-transform: scale(0.8);
+ -ms-transform: scale(0.8);
+ transform: scale(0.8);
+}
+
+.emotion-5:active:before,
+.emotion-5:hover:before,
+.emotion-5:focus:before {
+ opacity: 1;
+ -webkit-transform: scale(1);
+ -ms-transform: scale(1);
+ transform: scale(1);
+}
+
+.emotion-5:focus {
+ outline: none;
+}
+
+.emotion-5:active,
+.emotion-5:hover {
+ color: #3D4F58;
+}
+
+.emotion-5:active:before,
+.emotion-5:hover:before {
+ background-color: #E7EEEC;
+}
+
+.emotion-5:focus {
+ color: #1A567E;
+}
+
+.emotion-5:focus:before {
+ background-color: #C5E4F2;
+}
+
+.emotion-0 {
+ display: -webkit-inline-box;
+ display: -webkit-inline-flex;
+ display: -ms-inline-flexbox;
+ display: inline-flex;
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ font-weight: bold;
+ font-size: 11px;
+ line-height: 20px;
+ border-radius: 50px;
+ height: 20px;
+ padding-left: 9px;
+ padding-right: 9px;
+ text-transform: uppercase;
+ border: 1px solid;
+ background-color: #E4F4E4;
+ border-color: #C3E7CA;
+ color: #116149;
+}
+
+.emotion-12 {
+ margin-bottom: 16px;
+}
+
+.emotion-10 {
+ -webkit-align-items: baseline;
+ -webkit-box-align: baseline;
+ -ms-flex-align: baseline;
+ align-items: baseline;
+ background-color: #F9FBFA;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-flex-direction: row;
+ -ms-flex-direction: row;
+ flex-direction: row;
+ -webkit-box-pack: justify;
+ -webkit-justify-content: space-between;
+ -ms-flex-pack: justify;
+ justify-content: space-between;
+ padding: 16px 32px;
+}
+
+.emotion-10 > *:not(:last-child) {
+ margin-right: 16px;
+}
+
+@media only screen and (max-width:420px) {
+ .emotion-10 {
+ padding: 16px;
+ }
+}
+
+.emotion-1 {
+ color: #061621;
+}
+
+@media only screen and (max-width:420px) {
+ .emotion-1 {
+ word-break: break-all;
+ }
+}
+
+.emotion-6 {
+ top: -5px;
+ margin-left: 4px;
+ position: relative;
+}
+
+.emotion-4 {
+ -webkit-align-self: center;
+ -ms-flex-item-align: center;
+ align-self: center;
+ color: #89979B;
+}
+
+.emotion-8 {
+ top: -5px;
+ margin-left: auto;
+}
+
+
- POST
-
-
-
{provider}/login",
- }
- }
- />
-
+
+
+ POST
+
+
+
+ /auth/providers/
+
+ {provider}
+
+ /login
+
+
+
+
+
+
+
+
+
+
+
-
-
+
`;
exports[`when rendering all fields renders correctly 1`] = `
-
-
+ .emotion-3 {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ -webkit-box-pack: center;
+ -webkit-justify-content: center;
+ -ms-flex-pack: center;
+ justify-content: center;
+}
+
+.emotion-15 {
+ position: relative;
+ border-radius: 7px;
+ -webkit-transition: border 300ms ease-in-out,box-shadow 300ms ease-in-out;
+ transition: border 300ms ease-in-out,box-shadow 300ms ease-in-out;
+ border: 1px solid #E7EEEC;
+ box-shadow: 0 4px 10px -4px rgba(6,22,33,0.3);
+ background-color: white;
+ color: #21313C;
+}
+
+.emotion-0 {
+ display: -webkit-inline-box;
+ display: -webkit-inline-flex;
+ display: -ms-inline-flexbox;
+ display: inline-flex;
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ font-weight: bold;
+ font-size: 11px;
+ line-height: 20px;
+ border-radius: 50px;
+ height: 20px;
+ padding-left: 9px;
+ padding-right: 9px;
+ text-transform: uppercase;
+ border: 1px solid;
+ background-color: #E1F2F6;
+ border-color: #C5E4F2;
+ color: #1A567E;
+}
+
+.emotion-5 {
+ border: none;
+ -webkit-appearance: unset;
+ padding: unset;
+ display: inline-block;
+ border-radius: 100px;
+ color: #89979B;
+ position: relative;
+ cursor: pointer;
+ -webkit-flex-shrink: 0;
+ -ms-flex-negative: 0;
+ flex-shrink: 0;
+ -webkit-transition: color 150ms ease-in-out;
+ transition: color 150ms ease-in-out;
+ background-color: rgba(255,255,255,0);
+ height: 28px;
+ width: 28px;
+}
+
+.emotion-5:before {
+ content: '';
+ -webkit-transition: 150ms all ease-in-out;
+ transition: 150ms all ease-in-out;
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ border-radius: 100%;
+ opacity: 0;
+ -webkit-transform: scale(0.8);
+ -ms-transform: scale(0.8);
+ transform: scale(0.8);
+}
+
+.emotion-5:active:before,
+.emotion-5:hover:before,
+.emotion-5:focus:before {
+ opacity: 1;
+ -webkit-transform: scale(1);
+ -ms-transform: scale(1);
+ transform: scale(1);
+}
+
+.emotion-5:focus {
+ outline: none;
+}
+
+.emotion-5:active,
+.emotion-5:hover {
+ color: #3D4F58;
+}
+
+.emotion-5:active:before,
+.emotion-5:hover:before {
+ background-color: #E7EEEC;
+}
+
+.emotion-5:focus {
+ color: #1A567E;
+}
+
+.emotion-5:focus:before {
+ background-color: #C5E4F2;
+}
+
+.emotion-14 {
+ margin-bottom: 16px;
+}
+
+.emotion-10 {
+ -webkit-align-items: baseline;
+ -webkit-box-align: baseline;
+ -ms-flex-align: baseline;
+ align-items: baseline;
+ background-color: #F9FBFA;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-flex-direction: row;
+ -ms-flex-direction: row;
+ flex-direction: row;
+ -webkit-box-pack: justify;
+ -webkit-justify-content: space-between;
+ -ms-flex-pack: justify;
+ justify-content: space-between;
+ padding: 16px 32px;
+}
+
+.emotion-10 > *:not(:last-child) {
+ margin-right: 16px;
+}
+
+@media only screen and (max-width:420px) {
+ .emotion-10 {
+ padding: 16px;
+ }
+}
+
+.emotion-1 {
+ color: #061621;
+}
+
+@media only screen and (max-width:420px) {
+ .emotion-1 {
+ word-break: break-all;
+ }
+}
+
+.emotion-6 {
+ top: -5px;
+ margin-left: 4px;
+ position: relative;
+}
+
+.emotion-4 {
+ -webkit-align-self: center;
+ -ms-flex-item-align: center;
+ align-self: center;
+ color: #89979B;
+}
+
+.emotion-8 {
+ top: -5px;
+ margin-left: auto;
+}
+
+.emotion-12 {
+ margin: 24px 32px;
+}
+
+@media only screen and (max-width:420px) {
+ .emotion-12 {
+ margin: 16px;
+ }
+}
+
+.emotion-12 > p {
+ display: -webkit-box;
+ -webkit-line-clamp: 2;
+ -webkit-box-orient: vertical;
+ overflow: hidden;
+}
+
+
- GET
-
-
-
-
+
+
+ GET
+
+
+
+ /auth/profile
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Get information about the currently logged in user.
+
+
-
-
-
-
-
+
`;
diff --git a/tests/unit/__snapshots__/Pagination.test.js.snap b/tests/unit/__snapshots__/Pagination.test.js.snap
index a48a7afad..9b2197efd 100644
--- a/tests/unit/__snapshots__/Pagination.test.js.snap
+++ b/tests/unit/__snapshots__/Pagination.test.js.snap
@@ -1,35 +1,261 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Pagination renders pagination correctly 1`] = `
-
-
-
-
-
-
- 1
- /
- 10
-
-
-
+ .emotion-0 {
+ color: #B8C4C2;
+}
+
+.emotion-7 {
+ color: #3D4F58;
+}
+
+.emotion-1 {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ -webkit-box-pack: center;
+ -webkit-justify-content: center;
+ -ms-flex-pack: center;
+ justify-content: center;
+}
+
+.emotion-4 {
+ border: none;
+ -webkit-appearance: unset;
+ padding: unset;
+ display: inline-block;
+ border-radius: 100px;
+ color: #89979B;
+ position: relative;
+ cursor: pointer;
+ -webkit-flex-shrink: 0;
+ -ms-flex-negative: 0;
+ flex-shrink: 0;
+ -webkit-transition: color 150ms ease-in-out;
+ transition: color 150ms ease-in-out;
+ background-color: rgba(255,255,255,0);
+ height: 28px;
+ width: 28px;
+ color: #E7EEEC;
+ pointer-events: none;
+}
+
+.emotion-4:before {
+ content: '';
+ -webkit-transition: 150ms all ease-in-out;
+ transition: 150ms all ease-in-out;
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ border-radius: 100%;
+ opacity: 0;
+ -webkit-transform: scale(0.8);
+ -ms-transform: scale(0.8);
+ transform: scale(0.8);
+}
+
+.emotion-4:active:before,
+.emotion-4:hover:before,
+.emotion-4:focus:before {
+ opacity: 1;
+ -webkit-transform: scale(1);
+ -ms-transform: scale(1);
+ transform: scale(1);
+}
+
+.emotion-4:focus {
+ outline: none;
+}
+
+.emotion-4:active,
+.emotion-4:hover {
+ color: #3D4F58;
+}
+
+.emotion-4:active:before,
+.emotion-4:hover:before {
+ background-color: #E7EEEC;
+}
+
+.emotion-4:focus {
+ color: #1A567E;
+}
+
+.emotion-4:focus:before {
+ background-color: #C5E4F2;
+}
+
+.emotion-11 {
+ border: none;
+ -webkit-appearance: unset;
+ padding: unset;
+ display: inline-block;
+ border-radius: 100px;
+ color: #89979B;
+ position: relative;
+ cursor: pointer;
+ -webkit-flex-shrink: 0;
+ -ms-flex-negative: 0;
+ flex-shrink: 0;
+ -webkit-transition: color 150ms ease-in-out;
+ transition: color 150ms ease-in-out;
+ background-color: rgba(255,255,255,0);
+ height: 28px;
+ width: 28px;
+}
+
+.emotion-11:before {
+ content: '';
+ -webkit-transition: 150ms all ease-in-out;
+ transition: 150ms all ease-in-out;
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ border-radius: 100%;
+ opacity: 0;
+ -webkit-transform: scale(0.8);
+ -ms-transform: scale(0.8);
+ transform: scale(0.8);
+}
+
+.emotion-11:active:before,
+.emotion-11:hover:before,
+.emotion-11:focus:before {
+ opacity: 1;
+ -webkit-transform: scale(1);
+ -ms-transform: scale(1);
+ transform: scale(1);
+}
+
+.emotion-11:focus {
+ outline: none;
+}
+
+.emotion-11:active,
+.emotion-11:hover {
+ color: #3D4F58;
+}
+
+.emotion-11:active:before,
+.emotion-11:hover:before {
+ background-color: #E7EEEC;
+}
+
+.emotion-11:focus {
+ color: #1A567E;
+}
+
+.emotion-11:focus:before {
+ background-color: #C5E4F2;
+}
+
+.emotion-12 {
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+}
+
+.emotion-2 {
+ background-color: #fff;
+ height: 20px;
+ padding: 0;
+ width: 20px;
+ z-index: 1;
+}
+
+.emotion-5 {
+ font-size: 16px;
+ margin: 0 4px;
+}
+
+
-
-
-
+
+
+
+
+
+ 1/10
+
+
+
+
+
+
+
`;
diff --git a/tests/unit/__snapshots__/Pills.test.js.snap b/tests/unit/__snapshots__/Pills.test.js.snap
index e393d312a..7b5ca3f8f 100644
--- a/tests/unit/__snapshots__/Pills.test.js.snap
+++ b/tests/unit/__snapshots__/Pills.test.js.snap
@@ -1,48 +1,44 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Pills component renders correctly 1`] = `
-
-
+
-
-
+ Windows
+
+
+
- macOS
-
-
-
-
+ macOS
+
+
+
- Linux
-
-
-
+
+ Linux
+
+
+
+
`;
diff --git a/tests/unit/useDelightedSurvey.test.js b/tests/unit/useDelightedSurvey.test.js
index 537f087c2..9bec9e6ee 100644
--- a/tests/unit/useDelightedSurvey.test.js
+++ b/tests/unit/useDelightedSurvey.test.js
@@ -1,7 +1,7 @@
import React from 'react';
import * as Gatsby from 'gatsby';
import { useDelightedSurvey } from '../../src/hooks/useDelightedSurvey';
-import { mount } from 'enzyme';
+import { render } from '@testing-library/react';
const useStaticQuery = jest.spyOn(Gatsby, 'useStaticQuery');
@@ -47,26 +47,26 @@ describe('useDelightedSurvey()', () => {
const branch = 'test';
const project = 'node';
mockStaticQuery(branch, 'production', project);
- mount( );
+ render( );
expect(testSurveyObj).toEqual(expectedSurveyObj(branch, project));
});
it('succeeds in reporting a project name different from its snooty project', () => {
const branch = 'test-different';
mockStaticQuery(branch, 'production', 'cloud-docs');
- mount( );
+ render( );
expect(testSurveyObj).toEqual(expectedSurveyObj(branch, 'atlas'));
});
it('fails to report a survey when not in production', () => {
mockStaticQuery('test-not-production', 'staging', 'cloud-docs');
- mount( );
+ render( );
expect(testSurveyObj).toEqual({});
});
it('fails to report a survey when project is not eligible', () => {
mockStaticQuery('test-not-project', 'production', 'test-docs');
- mount( );
+ render( );
expect(testSurveyObj).toEqual({});
});
});
diff --git a/tests/unit/useFeedbackData.test.js b/tests/unit/useFeedbackData.test.js
index 4830075e2..72fad4abc 100644
--- a/tests/unit/useFeedbackData.test.js
+++ b/tests/unit/useFeedbackData.test.js
@@ -1,6 +1,6 @@
import React from 'react';
import * as Gatsby from 'gatsby';
-import { mount } from 'enzyme';
+import { render } from '@testing-library/react';
import useFeedbackData from '../../src/components/Widgets/FeedbackWidget/useFeedbackData';
const useStaticQuery = jest.spyOn(Gatsby, 'useStaticQuery');
@@ -19,18 +19,18 @@ const Test = (props) => {
const feedbackData = useFeedbackData(props.data);
return (
<>
-
-
-
-
-
+ {feedbackData.slug}
+ {feedbackData.url}
+ {feedbackData.title}
+ {feedbackData.docs_property}
+ {feedbackData.docs_version}
>
);
};
describe('useFeedbackData', () => {
it('returns information on the current project', () => {
- const wrapper = mount(
+ const wrapper = render(
{
/>
);
- expect(wrapper.find('#slug').prop('value')).toEqual('/test');
- expect(wrapper.find('#url').prop('value')).toEqual('https://docs.mongodb.com/test');
- expect(wrapper.find('#title').prop('value')).toEqual('Test Page Please Ignore');
- expect(wrapper.find('#docs_property').prop('value')).toEqual('testproject');
- expect(wrapper.find('#docs_version').prop('value')).toEqual(null);
+ expect(wrapper.getByText('/test')).toBeTruthy();
+ expect(wrapper.getByText('https://docs.mongodb.com/test')).toBeTruthy();
+ expect(wrapper.getByText('Test Page Please Ignore')).toBeTruthy();
+ expect(wrapper.getByText('testproject')).toBeTruthy();
+ expect(wrapper.queryByText('4.2')).toEqual(null);
});
it('returns the current docs version, if applicable', () => {
- const wrapper = mount(
+ const wrapper = render(
{
}}
/>
);
-
- expect(wrapper.find('#slug').prop('value')).toEqual('/test');
- expect(wrapper.find('#url').prop('value')).toEqual('https://docs.mongodb.com/test');
- expect(wrapper.find('#title').prop('value')).toEqual('Test Page Please Ignore');
- expect(wrapper.find('#docs_property').prop('value')).toEqual('testproject');
- expect(wrapper.find('#docs_version').prop('value')).toEqual('4.2');
+ expect(wrapper.getByText('4.2')).toBeTruthy();
});
});
diff --git a/tests/unit/useScreenSize.test.js b/tests/unit/useScreenSize.test.js
index e7362132c..20878f2b0 100644
--- a/tests/unit/useScreenSize.test.js
+++ b/tests/unit/useScreenSize.test.js
@@ -1,5 +1,5 @@
import React from 'react';
-import { mount } from 'enzyme';
+import { render } from '@testing-library/react';
import useScreenSize from '../../src/hooks/useScreenSize';
import { setDesktop, setMobile, setTablet } from '../utils';
@@ -7,10 +7,10 @@ const Test = () => {
const { isTabletOrMobile, isMobile } = useScreenSize();
return (
<>
-
-
-
-
+ {isTabletOrMobile && isTabletOrMobile
}
+ {isMobile && isMobile
}
+ {window.innerWidth}
+ {window.innerHeight}
>
);
};
@@ -18,25 +18,25 @@ const Test = () => {
describe('useScreenSize()', () => {
it('returns the correct data for large screens', async () => {
setDesktop();
- const wrapper = mount( );
+ const wrapper = render( );
- expect(wrapper.find('#isTabletOrMobile').prop('value')).toEqual(false);
- expect(wrapper.find('#isMobile').prop('value')).toEqual(false);
+ expect(wrapper.queryByText('isTabletOrMobile')).not.toBeTruthy();
+ expect(wrapper.queryByText('isMobile')).not.toBeTruthy();
});
it('returns the correct data for medium/tablet screens', () => {
setTablet();
- const wrapper = mount( );
+ const wrapper = render( );
- expect(wrapper.find('#isTabletOrMobile').prop('value')).toEqual(true);
- expect(wrapper.find('#isMobile').prop('value')).toEqual(false);
+ expect(wrapper.queryByText('isTabletOrMobile')).toBeTruthy();
+ expect(wrapper.queryByText('isMobile')).not.toBeTruthy();
});
it('returns the correct data for small/mobile screens', () => {
setMobile();
- const wrapper = mount( );
+ const wrapper = render( );
- expect(wrapper.find('#isTabletOrMobile').prop('value')).toEqual(true);
- expect(wrapper.find('#isMobile').prop('value')).toEqual(true);
+ expect(wrapper.queryByText('isTabletOrMobile')).toBeTruthy();
+ expect(wrapper.queryByText('isMobile')).toBeTruthy();
});
});
diff --git a/tests/unit/useStickyTopValues.test.js b/tests/unit/useStickyTopValues.test.js
index 268cfbbea..b81545cd2 100644
--- a/tests/unit/useStickyTopValues.test.js
+++ b/tests/unit/useStickyTopValues.test.js
@@ -1,7 +1,7 @@
import React from 'react';
import useStickyTopValues from '../../src/hooks/useStickyTopValues';
import { HeaderContext } from '../../src/components/header-context';
-import { mount } from 'enzyme';
+import { render } from '@testing-library/react';
const HelperComponent = () => {
const { topLarge, topMedium, topSmall } = useStickyTopValues();
@@ -24,16 +24,16 @@ const TestComponent = ({ mockBannerContent }) => {
describe('useStickyTopValues()', () => {
it('provides the correct top values without any banner content', () => {
- const wrapper = mount( );
- expect(wrapper.find('div.topLarge').text()).toEqual('88px');
- expect(wrapper.find('div.topMedium').text()).toEqual('56px');
- expect(wrapper.find('div.topSmall').text()).toEqual('108px');
+ const wrapper = render( );
+ expect(wrapper.queryByText('88px')).toBeTruthy();
+ expect(wrapper.queryByText('56px')).toBeTruthy();
+ expect(wrapper.queryByText('108px')).toBeTruthy();
});
it('provides the correct top values with banner content', () => {
- const wrapper = mount( );
- expect(wrapper.find('div.topLarge').text()).toEqual('128px');
- expect(wrapper.find('div.topMedium').text()).toEqual('96px');
- expect(wrapper.find('div.topSmall').text()).toEqual('148px');
+ const wrapper = render( );
+ expect(wrapper.queryByText('128px')).toBeTruthy();
+ expect(wrapper.queryByText('96px')).toBeTruthy();
+ expect(wrapper.queryByText('148px')).toBeTruthy();
});
});
diff --git a/tests/unit/useViewport.test.js b/tests/unit/useViewport.test.js
index 8eaffc43a..629897868 100644
--- a/tests/unit/useViewport.test.js
+++ b/tests/unit/useViewport.test.js
@@ -1,6 +1,6 @@
import React from 'react';
import { act } from 'react-dom/test-utils';
-import { mount } from 'enzyme';
+import { render } from '@testing-library/react';
import useViewport, { getViewport } from '../../src/hooks/useViewport';
import { tick } from '../utils';
@@ -8,10 +8,10 @@ const TestComponent = () => {
const { width, height, scrollX, scrollY } = useViewport();
return (
<>
-
-
-
-
+
+
+
+
>
);
};
@@ -85,7 +85,7 @@ describe('useViewport()', () => {
expect(getAddResizeListenerCalls().length).toBe(0);
expect(getAddScrollListenerCalls().length).toBe(0);
- const wrapper = mount( );
+ const wrapper = render( );
expect(getAddResizeListenerCalls().length).toBe(1);
expect(getAddScrollListenerCalls().length).toBe(1);
expect(getRemoveResizeListenerCalls().length).toBe(0);
@@ -99,67 +99,67 @@ describe('useViewport()', () => {
});
it('updates the viewport on scroll', async () => {
- const wrapper = mount( );
+ const wrapper = render( );
- expect(wrapper.find('#scrollX').prop('value')).toEqual(0);
- expect(wrapper.find('#scrollY').prop('value')).toEqual(0);
+ expect(wrapper.getByTestId('#scrollX')).toHaveValue(0);
+ expect(wrapper.getByTestId('#scrollY')).toHaveValue(0);
scroll(40, 10);
- await tick({ wrapper, waitFor: 200 });
+ await tick({ waitFor: 200 });
- expect(wrapper.find('#scrollX').prop('value')).toEqual(10);
- expect(wrapper.find('#scrollY').prop('value')).toEqual(40);
+ expect(wrapper.getByTestId('#scrollX')).toHaveValue(10);
+ expect(wrapper.getByTestId('#scrollY')).toHaveValue(40);
});
it('updates the viewport on resize', async () => {
- const wrapper = mount( );
+ const wrapper = render( );
- expect(wrapper.find('#width').prop('value')).toEqual(1024);
- expect(wrapper.find('#height').prop('value')).toEqual(768);
+ expect(wrapper.getByTestId('#width')).toHaveValue(1024);
+ expect(wrapper.getByTestId('#height')).toHaveValue(768);
resize(800, 670);
- await tick({ wrapper, waitFor: 200 });
+ await tick({ waitFor: 200 });
- expect(wrapper.find('#width').prop('value')).toEqual(800);
- expect(wrapper.find('#height').prop('value')).toEqual(670);
+ expect(wrapper.getByTestId('#width')).toHaveValue(800);
+ expect(wrapper.getByTestId('#height')).toHaveValue(670);
});
it('debounces the event listeners for 200ms', async () => {
- const wrapper = mount( );
+ const wrapper = render( );
- expect(wrapper.find('#width').prop('value')).toEqual(1024);
- expect(wrapper.find('#height').prop('value')).toEqual(768);
+ expect(wrapper.getByTestId('#width')).toHaveValue(1024);
+ expect(wrapper.getByTestId('#height')).toHaveValue(768);
// Resize the window
resize(800, 670);
// Before 200ms the viewport values shouldn't update
- await tick({ wrapper, waitFor: 199 });
- expect(wrapper.find('#width').prop('value')).toEqual(1024);
- expect(wrapper.find('#height').prop('value')).toEqual(768);
+ await tick({ waitFor: 199 });
+ expect(wrapper.getByTestId('#width')).toHaveValue(1024);
+ expect(wrapper.getByTestId('#height')).toHaveValue(768);
// After 200ms the viewport values should update
- await tick({ wrapper, waitFor: 1 });
- expect(wrapper.find('#width').prop('value')).toEqual(800);
- expect(wrapper.find('#height').prop('value')).toEqual(670);
+ await tick({ waitFor: 1 });
+ expect(wrapper.getByTestId('#width')).toHaveValue(800);
+ expect(wrapper.getByTestId('#height')).toHaveValue(670);
// Now let's make sure that the debounce waits 200ms from the most recent scroll event
resize(900, 535);
- await tick({ wrapper, waitFor: 100 });
+ await tick({ waitFor: 100 });
resize(1000, 400);
- await tick({ wrapper, waitFor: 100 });
+ await tick({ waitFor: 100 });
// 200ms have passed since the original resize
// The second resize reset the debounce interval, so nothing should change yet
- expect(wrapper.find('#width').prop('value')).toEqual(800);
- expect(wrapper.find('#height').prop('value')).toEqual(670);
+ expect(wrapper.getByTestId('#width')).toHaveValue(800);
+ expect(wrapper.getByTestId('#height')).toHaveValue(670);
- await tick({ wrapper, waitFor: 100 });
+ await tick({ waitFor: 100 });
// It's now 300ms since the first resize and 200ms since the second resize
// After 200ms without another resize event, the second resize updates the viewport values
- expect(wrapper.find('#width').prop('value')).toEqual(1000);
- expect(wrapper.find('#height').prop('value')).toEqual(400);
+ expect(wrapper.getByTestId('#width')).toHaveValue(1000);
+ expect(wrapper.getByTestId('#height')).toHaveValue(400);
});
});
From 3a85dfe27be7841582d2f3c9a4903c94e1b815c3 Mon Sep 17 00:00:00 2001
From: Cassidy Schaufele
Date: Thu, 20 Jan 2022 00:02:56 -0700
Subject: [PATCH 06/10] DOP-2642: Everything except Redoc
---
tests/unit/Code.test.js | 17 +-
tests/unit/FeedbackWidget.test.js | 211 ++++-----------
tests/unit/SearchResults.test.js | 75 +++---
tests/unit/Select.test.js | 97 +++----
tests/unit/Sidenav.test.js | 84 +++---
tests/unit/Tabs.test.js | 78 ++----
tests/unit/Toctree.test.js | 36 ++-
tests/unit/VersionDropdown.test.js | 65 +----
tests/unit/__snapshots__/Code.test.js.snap | 240 +++++++++++++++++-
.../__snapshots__/SearchResults.test.js.snap | 210 +++++++++++++--
.../unit/__snapshots__/Searchbar.test.js.snap | 42 ---
tests/unit/__snapshots__/Select.test.js.snap | 102 ++++++--
tests/unit/useFeedbackState.test.js | 237 -----------------
tests/unit/useVisibleOnScroll.test.js | 14 +-
14 files changed, 731 insertions(+), 777 deletions(-)
delete mode 100644 tests/unit/__snapshots__/Searchbar.test.js.snap
delete mode 100644 tests/unit/useFeedbackState.test.js
diff --git a/tests/unit/Code.test.js b/tests/unit/Code.test.js
index 7309a3aaa..ddb46957d 100644
--- a/tests/unit/Code.test.js
+++ b/tests/unit/Code.test.js
@@ -4,7 +4,6 @@ import Code from '../../src/components/Code';
import { CodeProvider } from '../../src/components/code-context';
import { TabProvider } from '../../src/components/tab-context';
import * as browserStorage from '../../src/utils/browser-storage';
-import { tick } from '../utils';
// data for this component
import mockData from './data/Code.test.json';
@@ -85,20 +84,8 @@ describe('when rendering with selectors', () => {
it('renders with the correct active tab', () => {
const wrapper = mountCodeWithSelector({ data: testData });
- const codeComponent = wrapper.find('Code').last();
- expect(codeComponent.props().language).toEqual('MongoDB Shell');
- expect(wrapper.find('LanguageSwitcher').exists()).toBeTruthy();
- });
-
- it('changes the selected driver', async () => {
- const wrapper = mountCodeWithSelector({ data: testData });
- let codeComponent = wrapper.find('Code').last();
- // Assume that the LG component propagates events upwards successfully
- codeComponent.invoke('onChange')({ id: 'nodejs' });
-
- await tick({ wrapper });
- codeComponent = wrapper.find('Code').last();
- expect(codeComponent.props().language).toEqual('Node.js');
+ expect(wrapper.getByText('MongoDB Shell')).toBeTruthy();
+ expect(wrapper.getByRole('button')).toHaveAttribute('aria-labelledby', 'Language Picker');
});
});
diff --git a/tests/unit/FeedbackWidget.test.js b/tests/unit/FeedbackWidget.test.js
index 2f8a3bf0d..2e1e499f4 100644
--- a/tests/unit/FeedbackWidget.test.js
+++ b/tests/unit/FeedbackWidget.test.js
@@ -1,5 +1,5 @@
import React from 'react';
-import { render, screen } from '@testing-library/react';
+import { render } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import {
FeedbackProvider,
@@ -111,85 +111,55 @@ describe('FeedbackWidget', () => {
it('is visible on medium/tablet screens', async () => {
setTablet();
wrapper = await mountFormWithFeedbackState({});
- screen.debug();
- expect(wrapper.exists('FeedbackHeading')).toBe(true);
- expect(wrapper.find('FeedbackHeading').children()).toHaveLength(2);
+ expect(wrapper.queryAllByText('Give Feedback')).toHaveLength(2);
+ expect(wrapper.queryAllByText('Give Feedback')[0]).toHaveStyleRule('display', 'none', {
+ media: `${theme.screenSize.upToLarge}`,
+ });
});
it('is visible on small/mobile screens', async () => {
setMobile();
wrapper = await mountFormWithFeedbackState({});
- expect(wrapper.exists('FeedbackHeading')).toBe(true);
- expect(wrapper.find('FeedbackHeading').children()).toHaveLength(2);
+ expect(wrapper.queryAllByText('Give Feedback')).toHaveLength(2);
});
it('is hidden on small/mobile screens when configured with page option', async () => {
setMobile();
wrapper = await mountFormWithFeedbackState({ hideHeader: true });
- screen.debug();
- expect(wrapper.queryAllByText('Give Feedback')).toHaveLength(0);
+ expect(wrapper.queryAllByText('Give Feedback')).toHaveLength(1);
});
});
describe('FeedbackFooter', () => {
it('is hidden on large/desktop screens', async () => {
wrapper = await mountFormWithFeedbackState({});
- expect(wrapper.exists('FeedbackFooter')).toBe(true);
- expect(wrapper.find('FeedbackFooter').children()).toHaveLength(0);
+ expect(wrapper.queryAllByText('How helpful was this page?')).toHaveLength(0);
});
it('is visible on medium/tablet screens', async () => {
setTablet();
wrapper = await mountFormWithFeedbackState({});
- expect(wrapper.exists('FeedbackFooter')).toBe(true);
- expect(wrapper.find('FeedbackFooter').children()).toHaveLength(1);
+ expect(wrapper.queryAllByText('How helpful was this page?')).toHaveLength(1);
});
it('is visible on small/mobile screens', async () => {
setMobile();
wrapper = await mountFormWithFeedbackState({});
- expect(wrapper.exists('FeedbackFooter')).toBe(true);
- expect(wrapper.find('FeedbackFooter').children()).toHaveLength(1);
+ expect(wrapper.queryAllByText('How helpful was this page?')).toHaveLength(1);
});
});
describe('FeedbackForm', () => {
- it('renders as a floating card on large/desktop screens', async () => {
- wrapper = await mountFormWithFeedbackState({
- view: 'rating',
- _id: new BSON.ObjectId(),
- });
- expect(wrapper.exists('FeedbackCard')).toBe(true);
- });
-
- it('renders as a modal window on medium/tablet screens', async () => {
- setTablet();
- wrapper = await mountFormWithFeedbackState({
- view: 'rating',
- _id: new BSON.ObjectId(),
- });
- expect(wrapper.exists('FeedbackModal')).toBe(true);
- });
-
- it('renders as a full screen app on small/mobile screens', async () => {
- setMobile();
- wrapper = await mountFormWithFeedbackState({
- view: 'rating',
- _id: new BSON.ObjectId(),
- });
- expect(wrapper.exists('FeedbackFullScreen')).toBe(true);
- });
-
it('abandons feedback when the form is closed', async () => {
wrapper = await mountFormWithFeedbackState({
view: 'rating',
_id: new BSON.ObjectId(),
});
// Click the close button
- wrapper.find('FeedbackCard').find('CloseButton').simulate('click');
- await tick({ wrapper });
+ userEvent.click(wrapper.getByLabelText('Close Feedback Form'));
+ await tick();
expect(stitchFunctionMocks['abandonFeedback']).toHaveBeenCalledTimes(1);
- expect(wrapper.exists('FeedbackCard')).toBe(false);
+ expect(wrapper.queryAllByText('How helpful was this page?')).toHaveLength(0);
});
describe('RatingView', () => {
@@ -198,9 +168,7 @@ describe('FeedbackWidget', () => {
view: 'rating',
_id: new BSON.ObjectId(),
});
- expect(wrapper.exists('RatingView')).toBe(true);
- expect(wrapper.exists('StarRating')).toBe(true);
- expect(wrapper.find('RatingView').find('Star')).toHaveLength(5);
+ expect(wrapper.container.getElementsByClassName('fa-star').length).toBe(5);
});
it('transitions to the qualifiers view when a star is clicked', async () => {
@@ -210,11 +178,9 @@ describe('FeedbackWidget', () => {
});
// Simulate a 1-star rating
- wrapper.find('RatingView').find('Star').first().simulate('click');
- await tick({ wrapper });
-
- expect(wrapper.exists('RatingView')).toBe(false);
- expect(wrapper.exists('QualifiersView')).toBe(true);
+ userEvent.click(wrapper.container.getElementsByClassName('fa-star')[0]);
+ await tick();
+ expect(wrapper.getByText('What seems to be the issue?')).toBeTruthy();
});
});
@@ -226,10 +192,8 @@ describe('FeedbackWidget', () => {
qualifiers: FEEDBACK_QUALIFIERS_POSITIVE,
comment: '',
});
- expect(wrapper.exists('QualifiersView')).toBe(true);
- expect(wrapper.find('QualifiersView').text()).toContain("We're glad to hear that!");
- expect(wrapper.find('QualifiersView').text()).toContain('Tell us more.');
- expect(wrapper.find('Qualifier')).toHaveLength(4);
+ expect(wrapper.queryByText("We're glad to hear that!")).toBeTruthy();
+ expect(wrapper.queryByText('Tell us more.')).toBeTruthy();
});
it('shows negative qualifiers for a negative rating', async () => {
@@ -239,49 +203,32 @@ describe('FeedbackWidget', () => {
qualifiers: FEEDBACK_QUALIFIERS_NEGATIVE,
comment: '',
});
- expect(wrapper.exists('QualifiersView')).toBe(true);
- expect(wrapper.find('QualifiersView').text()).toContain("We're sorry to hear that.");
- expect(wrapper.find('QualifiersView').text()).toContain('What seems to be the issue?');
- expect(wrapper.find('Qualifier')).toHaveLength(4);
+ expect(wrapper.queryByText("We're sorry to hear that.")).toBeTruthy();
+ expect(wrapper.queryByText('What seems to be the issue?')).toBeTruthy();
});
- it('selects/unselects a qualifier when clicked', async () => {
+ it('calls updateFeedback in stitch when qualifier clicked', async () => {
wrapper = await mountFormWithFeedbackState({
view: 'qualifiers',
rating: 4,
qualifiers: FEEDBACK_QUALIFIERS_POSITIVE,
comment: '',
});
- expect(wrapper.find('Qualifier')).toHaveLength(4);
-
- const isChecked = (q) => q.find('Checkbox').prop('checked');
- expect(isChecked(wrapper.find('Qualifier').at(0))).toBe(false);
+ expect(wrapper.queryAllByRole('checkbox').length).toBe(4);
+ expect(wrapper.queryAllByRole('checkbox', { checked: true }).length).toBe(0);
// Check the first qualifier
- wrapper.find('Qualifier').at(0).simulate('click');
- await tick({ wrapper });
- expect(isChecked(wrapper.find('Qualifier').at(0))).toBe(true);
- expect(isChecked(wrapper.find('Qualifier').at(1))).toBe(false);
- expect(isChecked(wrapper.find('Qualifier').at(2))).toBe(false);
- expect(isChecked(wrapper.find('Qualifier').at(3))).toBe(false);
+ userEvent.click(wrapper.queryAllByRole('checkbox')[0].closest('div'));
+ await tick();
expect(stitchFunctionMocks['updateFeedback']).toHaveBeenCalledTimes(1);
// Check the second qualifier
- wrapper.find('Qualifier').at(1).simulate('click');
- await tick({ wrapper });
- expect(isChecked(wrapper.find('Qualifier').at(0))).toBe(true);
- expect(isChecked(wrapper.find('Qualifier').at(1))).toBe(true);
- expect(isChecked(wrapper.find('Qualifier').at(2))).toBe(false);
- expect(isChecked(wrapper.find('Qualifier').at(3))).toBe(false);
+ userEvent.click(wrapper.queryAllByRole('checkbox')[1].closest('div'));
expect(stitchFunctionMocks['updateFeedback']).toHaveBeenCalledTimes(2);
// Uncheck the first qualifier
- wrapper.find('Qualifier').at(0).simulate('click');
- await tick({ wrapper });
- expect(isChecked(wrapper.find('Qualifier').at(0))).toBe(false);
- expect(isChecked(wrapper.find('Qualifier').at(1))).toBe(true);
- expect(isChecked(wrapper.find('Qualifier').at(2))).toBe(false);
- expect(isChecked(wrapper.find('Qualifier').at(3))).toBe(false);
+ userEvent.click(wrapper.queryAllByRole('checkbox')[0].closest('div'));
+ await tick();
expect(stitchFunctionMocks['updateFeedback']).toHaveBeenCalledTimes(3);
});
@@ -294,11 +241,10 @@ describe('FeedbackWidget', () => {
comment: '',
});
- wrapper.find('QualifiersView').find('Button').simulate('click');
- await tick({ wrapper });
+ userEvent.click(wrapper.getByText('Continue').closest('button'));
- expect(wrapper.exists('QualifiersView')).toBe(false);
- expect(wrapper.exists('CommentView')).toBe(true);
+ await tick();
+ expect(wrapper.getByText('What seems to be the issue?')).toBeTruthy();
});
});
});
@@ -311,16 +257,7 @@ describe('FeedbackWidget', () => {
qualifiers: FEEDBACK_QUALIFIERS_NEGATIVE,
comment: '',
});
- // View
- expect(wrapper.exists('CommentView')).toBe(true);
- // Input
- const commentInput = wrapper.find('CommentTextArea');
- expect(commentInput.exists()).toBe(true);
- expect(commentInput.prop('placeholder')).toBe('Describe your experience.');
- // Input label
- const commentInputLabel = wrapper.find('InputLabel').filter({ htmlFor: commentInput.prop('id') });
- expect(commentInputLabel.exists()).toBe(true);
- expect(commentInputLabel.text()).toBe('Comment');
+ expect(wrapper.getByLabelText('Comment')).toBeTruthy();
});
it('shows an email text input', async () => {
@@ -330,16 +267,7 @@ describe('FeedbackWidget', () => {
qualifiers: FEEDBACK_QUALIFIERS_NEGATIVE,
comment: '',
});
- // View
- expect(wrapper.exists('CommentView')).toBe(true);
- // Input
- const emailInput = wrapper.find('EmailInput');
- expect(emailInput.exists()).toBe(true);
- expect(emailInput.prop('placeholder')).toBe('someone@example.com');
- // Input label
- const emailInputLabel = wrapper.find('InputLabel').filter({ htmlFor: emailInput.prop('id') });
- expect(emailInputLabel.exists()).toBe(true);
- expect(emailInputLabel.text()).toBe('Email Address');
+ expect(wrapper.getByLabelText('Email Address')).toBeTruthy();
});
it('shows a Support button for feedback with a support request', async () => {
@@ -350,9 +278,7 @@ describe('FeedbackWidget', () => {
comment: '',
isSupportRequest: true,
});
-
- const button = wrapper.find('CommentView').find('SubmitButton');
- expect(button.text()).toBe('Continue for Support');
+ expect(wrapper.getByText('Continue for Support')).toBeTruthy();
});
it('shows a Submit button for feedback without a support request', async () => {
@@ -364,8 +290,7 @@ describe('FeedbackWidget', () => {
isSupportRequest: false,
});
- const button = wrapper.find('CommentView').find('SubmitButton');
- expect(button.text()).toBe('Send');
+ expect(wrapper.getByText('Send')).toBeTruthy();
});
describe('when the Support button is clicked', () => {
@@ -376,13 +301,10 @@ describe('FeedbackWidget', () => {
qualifiers: FEEDBACK_QUALIFIERS_NEGATIVE,
isSupportRequest: true,
});
-
- wrapper.find('CommentView').find('SubmitButton').simulate('click');
- await tick({ wrapper });
+ userEvent.click(wrapper.getByText('Continue for Support').closest('button'));
+ await tick();
expect(stitchFunctionMocks['submitFeedback']).toHaveBeenCalledTimes(1);
- expect(wrapper.exists('CommentView')).toBe(false);
- expect(wrapper.exists('SubmittedView')).toBe(false);
- expect(wrapper.exists('SupportView')).toBe(true);
+ expect(wrapper.getByText('Create a case on the Support Portal')).toBeTruthy();
});
});
describe('when the Submit button is clicked', () => {
@@ -395,12 +317,11 @@ describe('FeedbackWidget', () => {
user: { email: 'test@example.com' },
});
- wrapper.find('CommentView').find('SubmitButton').simulate('click');
- await tick({ wrapper });
+ // Click the submit button
+ userEvent.click(wrapper.getByText('Send').closest('button'));
+ await tick();
expect(stitchFunctionMocks['submitFeedback']).toHaveBeenCalledTimes(1);
- expect(wrapper.exists('CommentView')).toBe(false);
- expect(wrapper.exists('SubmittedView')).toBe(true);
});
it('raises an input error if an invalid email is specified', async () => {
wrapper = await mountFormWithFeedbackState({
@@ -411,20 +332,13 @@ describe('FeedbackWidget', () => {
});
// Type in an invalid email address
- const emailInput = wrapper.find('EmailInput');
- emailInput.simulate('change', { target: { value: 'not-a-valid-email-address' } });
- await tick({ wrapper });
+ const emailInput = wrapper.getByLabelText('Email Address');
+ userEvent.paste(emailInput, 'not-a-valid-email-address');
// Click the submit button
- const submitButton = wrapper.find('CommentView').find('SubmitButton');
- submitButton.simulate('click');
- await tick({ wrapper });
-
- expect(wrapper.exists('CommentView')).toBe(true);
- expect(wrapper.exists('SubmittedView')).toBe(false);
- const emailInputErrorLabel = wrapper.find('InputErrorLabel').filter({ htmlFor: emailInput.prop('id') });
- expect(emailInputErrorLabel.exists()).toBe(true);
- expect(emailInputErrorLabel.text()).toBe('Please enter a valid email address.');
+ userEvent.click(wrapper.getByText('Send').closest('button'));
+ await tick();
+ expect(wrapper.getByLabelText('Please enter a valid email address.')).toBeTruthy();
});
});
});
@@ -437,25 +351,9 @@ describe('FeedbackWidget', () => {
qualifiers: FEEDBACK_QUALIFIERS_NEGATIVE,
isSupportRequest: true,
});
- expect(wrapper.exists('SupportView')).toBe(true);
- const supportViewText = wrapper.find('SupportView').children().text();
- expect(supportViewText).toContain("We're sorry to hear that.");
- expect(supportViewText).toContain('Create a case on the Support Portal');
- expect(supportViewText).toContain('Visit MongoDB Community');
- });
-
- it('transitions to the submitted view when the Send button is clicked', async () => {
- wrapper = await mountFormWithFeedbackState({
- view: 'support',
- rating: 2,
- qualifiers: FEEDBACK_QUALIFIERS_NEGATIVE,
- isSupportRequest: true,
- });
- expect(wrapper.exists('SupportView')).toBe(true);
-
- // Click the Done button
- wrapper.find('Button').simulate('click');
- await tick({ wrapper });
+ expect(wrapper.getByText("We're sorry to hear that.")).toBeTruthy();
+ expect(wrapper.getByText('Create a case on the Support Portal')).toBeTruthy();
+ expect(wrapper.getByText('Visit MongoDB Community')).toBeTruthy();
});
});
@@ -469,13 +367,8 @@ describe('FeedbackWidget', () => {
isSubmitted: true,
},
});
- const view = wrapper.find('SubmittedView');
- expect(view.exists()).toBe(true);
- expect(view.find('Heading').text()).toBe('We appreciate your feedback.');
- expect(view.find('Subheading').at(0).text()).toBe(`We're working hard to improve the MongoDB Documentation.`);
- expect(view.find('Subheading').at(1).text()).toBe(
- `For additional support, explore the MongoDB discussion forum.`
- );
+ expect(wrapper.getByText('We appreciate your feedback.')).toBeTruthy();
+ expect(wrapper.getByText(`We're working hard to improve the MongoDB Documentation.`)).toBeTruthy();
});
});
});
diff --git a/tests/unit/SearchResults.test.js b/tests/unit/SearchResults.test.js
index 66d426907..bec445a49 100644
--- a/tests/unit/SearchResults.test.js
+++ b/tests/unit/SearchResults.test.js
@@ -1,7 +1,9 @@
// Tests for the search results page
import React from 'react';
-import { mount, shallow } from 'enzyme';
+import { render } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
import { act } from 'react-dom/test-utils';
+import { tick } from '../utils';
// Importing all specifically to use jest spyOn, mockImplementation for mocking
import * as reachRouter from '@reach/router';
import SearchResults from '../../src/components/SearchResults';
@@ -9,46 +11,47 @@ import { FILTERED_RESULT, mockMarianFetch, UNFILTERED_RESULT } from './utils/moc
// Check the search results include the property-filtered results
const expectFilteredResults = (wrapper) => {
- expect(wrapper.find('StyledSearchResult').length).toBe(1);
- const searchResult = wrapper.find('StyledSearchResult').at(0);
+ wrapper.getByText('Realm results for "stitch"');
+
+ expect(wrapper.queryAllByText('Realm').length).toBe(1);
// Check the search result card displays content according to the response
- expect(searchResult.exists());
- expect(searchResult.text()).toContain(FILTERED_RESULT.title);
- expect(searchResult.text()).toContain(FILTERED_RESULT.preview);
- expect(searchResult.text()).not.toContain(UNFILTERED_RESULT.title);
+ expect(wrapper.queryAllByText(FILTERED_RESULT.title)).toBeTruthy();
+ expect(wrapper.queryAllByText(FILTERED_RESULT.preview)).toBeTruthy();
+ expect(wrapper.queryAllByText(UNFILTERED_RESULT.title).length).toBe(0);
// Check the result does link to the provided doc
- const searchResultLink = searchResult.find('SearchResultLink').at(0);
- expect(searchResultLink.props()).toHaveProperty('href', FILTERED_RESULT.url);
- expect(wrapper.text()).toContain('Realm results for "stitch"');
+ expect(wrapper.queryByText('stitch').closest('a')).toHaveProperty('href', `http://localhost/${FILTERED_RESULT.url}`);
+ expect(wrapper.queryAllByText('Realm results for "stitch"').length).toBe(1);
// Check the dropdowns are filled in
expectValuesForFilters(wrapper, 'Realm', 'Latest');
};
const expectValuesForFilters = (wrapper, product, branch) => {
- expect(wrapper.find('Select').at(0).text()).toContain(product);
- expect(wrapper.find('Select').at(1).text()).toContain(branch);
+ expect(wrapper.queryByText(product)).toBeTruthy();
+ expect(wrapper.queryByText(branch)).toBeTruthy();
};
// Check the search results match the expected unfiltered results
const expectUnfilteredResults = (wrapper) => {
- expect(wrapper.find('StyledSearchResult').length).toBe(1);
- const searchResult = wrapper.find('StyledSearchResult').at(0);
+ wrapper.getByText(`All search results for "stitch"`);
+
+ expect(wrapper.queryAllByText('(no filters)').length).toBe(1);
// Check the search result card displays content according to the response
- expect(searchResult.exists());
- expect(searchResult.text()).toContain(UNFILTERED_RESULT.title);
- expect(searchResult.text()).toContain(UNFILTERED_RESULT.preview);
- expect(searchResult.text()).not.toContain(FILTERED_RESULT.title);
+ expect(wrapper.queryAllByText(UNFILTERED_RESULT.title)).toBeTruthy();
+ expect(wrapper.queryAllByText(UNFILTERED_RESULT.preview)).toBeTruthy();
+ expect(wrapper.queryAllByText(FILTERED_RESULT.title).length).toBe(0);
// Check the result does link to the provided doc
- const searchResultLink = searchResult.find('SearchResultLink').at(0);
- expect(searchResultLink.props()).toHaveProperty('href', UNFILTERED_RESULT.url);
- expect(wrapper.text()).not.toContain('Realm');
+ expect(wrapper.queryByText('stitch').closest('a')).toHaveProperty(
+ 'href',
+ `http://localhost/${UNFILTERED_RESULT.url}`
+ );
+ expect(wrapper.queryAllByText('Realm results for "stitch"').length).toBe(0);
- // Check the dropdowns are not filled in
+ // // Check the dropdowns are not filled in
expectValuesForFilters(wrapper, 'Select a Product', 'Select a Version');
};
@@ -56,6 +59,8 @@ const expectUnfilteredResults = (wrapper) => {
const mockLocation = (search) => jest.spyOn(reachRouter, 'useLocation').mockImplementation(() => ({ search }));
describe('Search Results Page', () => {
+ jest.useFakeTimers();
+
beforeAll(() => {
window.fetch = mockMarianFetch;
});
@@ -66,17 +71,16 @@ describe('Search Results Page', () => {
it('renders correctly without browser', () => {
mockLocation(null);
- const tree = shallow( );
- expect(tree).toMatchSnapshot();
+ const tree = render( );
+ expect(tree.asFragment()).toMatchSnapshot();
});
it('renders results from a given search term query param', async () => {
let renderStitchResults;
mockLocation('?q=stitch');
await act(async () => {
- renderStitchResults = mount( );
+ renderStitchResults = render( );
});
- await renderStitchResults.update();
expectUnfilteredResults(renderStitchResults);
});
@@ -84,10 +88,8 @@ describe('Search Results Page', () => {
let renderStitchResults;
mockLocation('?q=stitch&searchProperty=realm-master');
await act(async () => {
- renderStitchResults = mount( );
+ renderStitchResults = render( );
});
-
- await renderStitchResults.update();
expectFilteredResults(renderStitchResults);
});
@@ -95,20 +97,19 @@ describe('Search Results Page', () => {
let renderStitchResults;
mockLocation('?q=stitch');
await act(async () => {
- renderStitchResults = mount( );
+ renderStitchResults = render( );
});
- await renderStitchResults.update();
expectUnfilteredResults(renderStitchResults);
// Change the filters, which should change the shown results
- let firstDropdown = renderStitchResults.find('StyledCustomSelect').at(0);
- firstDropdown.simulate('click');
- const firstChoice = renderStitchResults.find('Option').at(0);
+
await act(async () => {
- firstChoice.simulate('click');
+ const dropdown = renderStitchResults.queryAllByRole('listbox')[0];
+ expect(dropdown).toHaveAttribute('aria-expanded', 'false');
+ userEvent.click(dropdown);
+ tick();
+ userEvent.click(renderStitchResults.getByText('Realm'));
});
- await renderStitchResults.update();
-
expectFilteredResults(renderStitchResults);
});
});
diff --git a/tests/unit/Select.test.js b/tests/unit/Select.test.js
index 4d9ea9e78..4dc34d0e0 100644
--- a/tests/unit/Select.test.js
+++ b/tests/unit/Select.test.js
@@ -1,6 +1,7 @@
import React, { useState } from 'react';
-import { shallow, mount } from 'enzyme';
+import { render } from '@testing-library/react';
import Select from '../../src/components/Select';
+import userEvent from '@testing-library/user-event';
const DEFAULT_ATLAS_CHOICE = { text: 'MongoDB Atlas', value: 'atlas' };
const DEFAULT_SERVER_CHOICE = { text: 'MongoDB Server', value: 'server' };
@@ -34,35 +35,38 @@ const SelectController = ({
describe('Select', () => {
// Helper to open the dropdown passed a series of simulate args (click, keypress)
- const dropdownOpen = (args = ['click'], props = {}) => {
- const wrapper = mount( );
+ const dropdownOpen = (props = {}, openWithKeyboard = false) => {
+ const wrapper = render( );
// Dropdown should be closed by default
- expect(!wrapper.find('Options').exists());
- const selectParent = wrapper.find('StyledCustomSelect');
- selectParent.simulate(...args);
+ const dropdown = wrapper.getByRole('listbox');
+ expect(dropdown).toHaveAttribute('aria-expanded', 'false');
+ if (openWithKeyboard) {
+ userEvent.tab();
+ userEvent.keyboard('{Enter}');
+ } else {
+ userEvent.click(dropdown);
+ }
// Now it should be open
- expect(wrapper.find('Options').exists());
+ expect(dropdown).toHaveAttribute('aria-expanded', 'true');
return wrapper;
};
it('renders select correctly', () => {
- const wrapper = shallow( );
- expect(wrapper).toMatchSnapshot();
+ const wrapper = render( );
+ expect(wrapper.asFragment()).toMatchSnapshot();
});
it('displays default text', () => {
const defaultText = 'Some default text';
- const wrapper = mount( );
- const renderedText = wrapper.find('SelectedText').text();
- expect(renderedText).toBe(defaultText);
+ const wrapper = render( );
+ const renderedText = wrapper.getByText(defaultText);
+ expect(renderedText).toBeTruthy();
});
it('conditionally should render a label', () => {
- const wrapperWithoutLabel = mount( );
- expect(!wrapperWithoutLabel.find('Label').exists());
const labelText = 'Select Label';
- const wrapperWithLabel = mount( );
- expect(wrapperWithLabel.find('Label').text()).toBe(labelText);
+ const wrapperWithLabel = render( );
+ expect(wrapperWithLabel.getByText(labelText)).toBeTruthy();
});
it('opens a dropdown with options when clicked', () => {
@@ -70,59 +74,58 @@ describe('Select', () => {
});
it('opens a dropdown with options with the enter key for accessibility', () => {
- dropdownOpen(['keypress', { key: 'Enter' }]);
+ dropdownOpen({ key: 'Enter' }, true);
});
- it('prevents interaction when disabled', () => {
- const wrapper = mount( );
+ it('passes disabled prop through to select implementation when given', () => {
+ const wrapper = render( );
// Dropdown should be closed by default
- expect(!wrapper.find('Options').exists());
- const selectParent = wrapper.find('StyledCustomSelect');
- selectParent.simulate('click');
- selectParent.simulate('keypress', { key: 'Enter' });
- // It should still be closed
- expect(!wrapper.find('Options').exists());
+ // parent element access is limitation of implementation
+ // TODO: look at select implementation to see if disabled div and listbox role div can be coalesced
+ expect(wrapper.getByRole('listbox').parentElement).toHaveAttribute('aria-disabled', 'true');
});
it('closes the dropdown by clicking again on the toggle parent', () => {
const wrapper = dropdownOpen();
- const selectParent = wrapper.find('StyledCustomSelect');
- selectParent.simulate('click');
+ const dropdown = wrapper.getByRole('listbox');
+ userEvent.click(dropdown);
// Dropdown was previously open, it should now be closed
- expect(!wrapper.find('Options').exists());
+ expect(dropdown).toHaveAttribute('aria-expanded', 'false');
});
it('updates the selected text when an item is clicked', () => {
const defaultText = 'Default Text';
- const wrapper = dropdownOpen(['click'], { defaultText });
- let renderedText = wrapper.find('SelectedText').text();
- expect(renderedText).toBe(defaultText);
- const firstOption = wrapper.find('Option').at(0);
- expect(firstOption.text()).toBe(DEFAULT_CHOICES[0].text);
- firstOption.simulate('click');
- renderedText = wrapper.find('SelectedText').text();
- expect(renderedText).toBe(DEFAULT_CHOICES[0].text);
+ const wrapper = dropdownOpen({ defaultText });
+ let renderedText = wrapper.getByText(defaultText);
+ expect(renderedText).toBeTruthy();
+ //Implementation stores the 'select' in the first option field, as rendered html
+ const firstOption = wrapper.queryAllByRole('option')[1];
+ expect(firstOption.textContent).toBe(DEFAULT_CHOICES[0].text);
+ userEvent.click(firstOption);
+ //check the first option field to make sure it updated
+ renderedText = wrapper.queryAllByRole('option')[0];
+ expect(renderedText.textContent).toBe(DEFAULT_CHOICES[0].text);
});
it('passes the entire choice to the onChange callback', () => {
const customOnChange = jest.fn();
- const wrapper = dropdownOpen(['click'], { customOnChange });
- const firstOption = wrapper.find('Option').at(0);
- expect(firstOption.text()).toBe(DEFAULT_CHOICES[0].text);
- firstOption.simulate('click');
+ const wrapper = dropdownOpen({ customOnChange });
+ const firstOption = wrapper.queryAllByRole('option')[1];
+ expect(firstOption.textContent).toBe(DEFAULT_CHOICES[0].text);
+ userEvent.click(firstOption);
expect(customOnChange.mock.calls.length).toBe(1);
expect(customOnChange.mock.calls[0][0]).toStrictEqual(DEFAULT_CHOICES[0]);
});
it('should update selected text given a value', () => {
- const wrapper = mount( );
- expect(wrapper.find('SelectedText').text()).toBe(DEFAULT_CHOICES[0].text);
+ const wrapper = render( );
+ expect(wrapper.getByText(DEFAULT_CHOICES[0].text)).toBeTruthy();
});
it('should reset the form when null/empty string is passed as value', () => {
const defaultText = 'Reset text';
- // Bypass SelectController so we can directly modify the value prop
- const wrapper = mount(
+ // Bypass SelectController so we can directly rerender with equivalent component + state
+ const wrapper = render(
{
value={DEFAULT_CHOICES[0].value}
/>
);
- expect(wrapper.find('SelectedText').text()).toBe(DEFAULT_CHOICES[0].text);
- wrapper.setProps({ value: '' });
- expect(wrapper.find('SelectedText').text()).toBe('Reset text');
+ expect(wrapper.getByText(DEFAULT_CHOICES[0].text)).toBeTruthy();
+ wrapper.rerender( {}} value={''} />);
+ expect(wrapper.getByText(defaultText)).toBeTruthy();
});
});
diff --git a/tests/unit/Sidenav.test.js b/tests/unit/Sidenav.test.js
index 0977b6812..87f461475 100644
--- a/tests/unit/Sidenav.test.js
+++ b/tests/unit/Sidenav.test.js
@@ -1,6 +1,7 @@
import React from 'react';
import * as Gatsby from 'gatsby';
-import { mount } from 'enzyme';
+import { render } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
import { Sidenav, SidenavContextProvider, SidenavMobileMenuButton } from '../../src/components/Sidenav';
import { theme } from '../../src/theme/docsTheme';
import { tick, setMatchMedia, setMobile } from '../utils';
@@ -18,14 +19,13 @@ const setProject = (project) => {
const mountSidenav = async () => {
setProject('test-project');
- const wrapper = mount(
+ const wrapper = render(
);
- await tick({ wrapper });
-
+ await tick();
return wrapper;
};
@@ -35,63 +35,33 @@ const resizeWindowWidth = (width) => {
};
const findCollapseButton = (wrapper) => {
- return wrapper.find('button[data-testid="side-nav-collapse-toggle"]');
-};
-
-// Used to check for collapsed state since we cannot reach the Sidenav component's
-// isCollapsed state.
-const expectSidenavCollapsed = (wrapper, value) => {
- const collapseButton = findCollapseButton(wrapper);
- expect(collapseButton.exists('ChevronRight')).toEqual(value);
- expect(collapseButton.exists('ChevronLeft')).toEqual(!value);
-};
-
-const expectMobileSidenavHidden = (wrapper, value) => {
- // LG's collapse button should still be in its open state,
- // even though the button itself should not be displayed as none
- expectSidenavCollapsed(wrapper, false);
-
- const mobileMenuButton = wrapper.find('SidenavMobileMenuButton');
- expect(mobileMenuButton.exists('Menu')).toEqual(value);
- expect(mobileMenuButton.exists('X')).toEqual(!value);
- expect(wrapper.find('SidenavMobileTransition').prop('hideMobile')).toEqual(value);
+ return wrapper.getByTestId('side-nav-collapse-toggle');
};
describe('Sidenav', () => {
jest.useFakeTimers();
- let wrapper;
it('works on desktop', async () => {
// Sidenav open by default
- wrapper = await mountSidenav();
- expectSidenavCollapsed(wrapper, false);
-
+ const wrapper = await mountSidenav();
+ expect(findCollapseButton(wrapper)).toHaveAttribute('aria-expanded', 'true');
// Close the sidenav
- findCollapseButton(wrapper).simulate('click');
- await tick({ wrapper });
- expectSidenavCollapsed(wrapper, true);
+ userEvent.click(findCollapseButton(wrapper));
+ await tick();
+ expect(findCollapseButton(wrapper)).toHaveAttribute('aria-expanded', 'false');
});
it('works on tablet', async () => {
- const contentOverlayStr = 'ContentOverlay';
setMatchMedia(theme.screenSize.tablet);
// Sidenav collapsed by default
- wrapper = await mountSidenav();
- expectSidenavCollapsed(wrapper, true);
- expect(wrapper.exists(contentOverlayStr)).toEqual(false);
+ const wrapper = await mountSidenav();
+ expect(findCollapseButton(wrapper)).toHaveAttribute('aria-expanded', 'false');
// Open the sidenav
- findCollapseButton(wrapper).simulate('click');
- await tick({ wrapper });
- expectSidenavCollapsed(wrapper, false);
- expect(wrapper.exists(contentOverlayStr)).toEqual(true);
-
- // Clicking on the ContentOverlay closes the sidenav
- wrapper.find(contentOverlayStr).simulate('click');
- await tick({ wrapper });
- expectSidenavCollapsed(wrapper, true);
- expect(wrapper.exists(contentOverlayStr)).toEqual(false);
+ userEvent.click(findCollapseButton(wrapper));
+ await tick();
+ expect(findCollapseButton(wrapper)).toHaveAttribute('aria-expanded', 'true');
});
it('works on mobile', async () => {
@@ -100,19 +70,23 @@ describe('Sidenav', () => {
resizeWindowWidth(mobileWidth);
// Sidenav open by default, but is hidden
- wrapper = await mountSidenav();
- expectMobileSidenavHidden(wrapper, true);
- expect(wrapper.find('SideNav').prop('widthOverride')).toEqual(mobileWidth);
+ const wrapper = await mountSidenav();
+ expect(findCollapseButton(wrapper)).toHaveAttribute('aria-expanded', 'true');
+
+ // js-dom isn't properly reflecting styled components updating active css across media queries
+ // TODO: replace this or otherwise fix if ever a fix is released
+ // expect(wrapper.getByTestId('side-nav-container')).toHaveStyle('display: none')
// Clicking menu button displays Sidenav
- let mobileMenuButton = wrapper.find('SidenavMobileMenuButton');
- mobileMenuButton.find('IconButton').simulate('click');
- await tick({ wrapper });
- expectMobileSidenavHidden(wrapper, false);
+ userEvent.click(findCollapseButton(wrapper));
+ await tick();
+ expect(findCollapseButton(wrapper)).toHaveAttribute('aria-expanded', 'false');
+ // expect(wrapper.getByTestId('side-nav-container')).toBeVisible();
// Clicking menu button again closes Sidenav
- mobileMenuButton.find('IconButton').simulate('click');
- await tick({ wrapper });
- expectMobileSidenavHidden(wrapper, true);
+ userEvent.click(findCollapseButton(wrapper));
+ await tick();
+ // expect(wrapper.getByTestId('side-nav-container')).not.toBeVisible();
+ expect(findCollapseButton(wrapper)).toHaveAttribute('aria-expanded', 'true');
});
});
diff --git a/tests/unit/Tabs.test.js b/tests/unit/Tabs.test.js
index 2d896e85c..34a0046ec 100644
--- a/tests/unit/Tabs.test.js
+++ b/tests/unit/Tabs.test.js
@@ -1,5 +1,5 @@
import React from 'react';
-import { mount, shallow } from 'enzyme';
+import { render } from '@testing-library/react';
import Tabs from '../../src/components/Tabs';
import { TabProvider } from '../../src/components/tab-context';
import { theme } from '../../src/theme/docsTheme';
@@ -12,98 +12,76 @@ import mockDataAnonymous from './data/Tabs-anonymous.test.json';
import { ThemeProvider } from 'emotion-theming';
const mountTabs = ({ mockData }) => {
- return mount(
+ return render(
- )
- .childAt(0)
- .childAt(0)
- .childAt(1);
+ );
};
-const shallowTabs = ({ mockData, mockAddTabset }) =>
- shallow(
-
-
-
- )
- .childAt(0)
- .childAt(1);
-
describe('Tabs testing', () => {
describe('Tab unit tests', () => {
- let wrapper;
const mockAddTabset = jest.fn();
- beforeAll(() => {
- wrapper = mountTabs({
+ it('tabs container exists with correct number of children', () => {
+ const wrapper = mountTabs({
mockData: mockDataAnonymous,
});
- });
-
- it('tabs container exists with correct number of children', () => {
const tabCount = mockDataAnonymous.children.length;
- expect(wrapper.find('Tabs')).toHaveLength(1);
- expect(wrapper.find('Tab').exists()).toEqual(true);
- expect(wrapper.find('Tab')).toHaveLength(tabCount);
+ expect(wrapper.queryAllByRole('tablist')).toHaveLength(1);
+ expect(wrapper.queryAllByRole('tab')).toHaveLength(tabCount);
});
it('did not call mockAddTabset for a non-guides tabset', () => {
+ const wrapper = mountTabs({
+ mockData: mockDataAnonymous,
+ });
+ expect(wrapper.queryAllByRole('tablist')).toHaveLength(1);
expect(mockAddTabset.mock.calls.length).toBe(0);
});
it('active tab is set in DOM', () => {
- expect(wrapper.find('Tab').first().prop('selected')).toEqual(true);
+ const wrapper = mountTabs({
+ mockData: mockDataAnonymous,
+ });
+ expect(wrapper.queryByRole('tab', { selected: true })).toBeTruthy();
});
it('exists non-active tab', () => {
- expect(wrapper.find('Tab').at(1).prop('selected')).toEqual(false);
+ const wrapper = mountTabs({
+ mockData: mockDataAnonymous,
+ });
+ expect(wrapper.queryAllByRole('tab', { selected: false })).toBeTruthy();
});
});
describe('Ecosystem unit tests', () => {
- let wrapper;
-
- beforeAll(() => {
+ it('tabset should be created for drivers/language pills', () => {
process.env = Object.assign(process.env, { GATSBY_SITE: 'ecosystem' });
- wrapper = mountTabs({
+ const wrapper = mountTabs({
mockData: mockDataLanguages,
});
- });
-
- it('tabset should be created for drivers/language pills', () => {
- expect(wrapper.find('Tabs').exists()).toEqual(true);
+ expect(wrapper.queryAllByRole('tablist')).toHaveLength(1);
});
});
describe('when a hidden tabset is passed in', () => {
- let wrapper;
-
- beforeAll(() => {
- wrapper = shallowTabs({
+ it('does not render a tabset', () => {
+ const wrapper = mountTabs({
mockData: mockDataHidden,
});
- });
-
- it('does not render a tabset', () => {
- expect(wrapper.find('Tabs')).toHaveLength(0);
+ expect(wrapper.queryAllByRole('tablist')).toHaveLength(0);
});
});
describe('when javascript is disabled', () => {
- let wrapper;
-
- beforeAll(() => {
- wrapper = mountTabs({
+ it('renders tabs in the set', () => {
+ const wrapper = mountTabs({
mockData: mockDataPlatforms,
});
- });
-
- it('renders tabs in the set', () => {
- expect(wrapper.find('Tabs')).toHaveLength(1);
+ expect(wrapper.queryAllByRole('tablist')).toHaveLength(1);
});
});
});
diff --git a/tests/unit/Toctree.test.js b/tests/unit/Toctree.test.js
index 4a8413052..ef6da4c3c 100644
--- a/tests/unit/Toctree.test.js
+++ b/tests/unit/Toctree.test.js
@@ -1,5 +1,6 @@
import React from 'react';
-import { mount } from 'enzyme';
+import { render } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
import Toctree from '../../src/components/Sidenav/Toctree';
import mockData from './data/Toctree.test.json';
import { tick } from '../utils';
@@ -15,7 +16,7 @@ import { tick } from '../utils';
// /sdk/ios
const mountToctree = (slug) => {
- return mount( );
+ return render( );
};
describe('Toctree', () => {
@@ -23,31 +24,28 @@ describe('Toctree', () => {
it('renders parent nodes', () => {
const wrapper = mountToctree('/');
- expect(wrapper.children()).toHaveLength(2);
+ expect(wrapper.getByText('Get Started')).toBeTruthy();
+ expect(wrapper.getByText('Realm Database SDKs')).toBeTruthy();
});
it('clicking on a drawer shows nested children', async () => {
const wrapper = mountToctree('/');
- const parentDrawer = wrapper.childAt(0);
-
- expect(parentDrawer.find('button')).toHaveLength(1);
- parentDrawer.find('button').simulate('click');
- await tick({ wrapper });
-
- expect(parentDrawer.prop('level')).toBe(1);
- expect(wrapper.childAt(0).findWhere((n) => n.is('TOCNode') && n.prop('level') === 2)).toHaveLength(2);
+ const parentDrawer = wrapper.queryAllByRole('button');
+ expect(parentDrawer).toBeTruthy();
+ userEvent.click(parentDrawer[0]);
+ await tick();
+ expect(wrapper.getByText('Introduction for Mobile Developers')).toBeTruthy();
});
it('correct item set as active based off current page', () => {
- const testActivePage = (testPage, expectedLevel) => {
- const wrapper = mountToctree(testPage);
- let activeItem = wrapper.findWhere((n) => n.is('SideNavItem') && n.prop('active') === true);
- expect(activeItem).toHaveLength(1);
- expect(activeItem.prop('to')).toEqual(testPage);
- expect(activeItem.parents().at(1).prop('level')).toEqual(expectedLevel);
+ const wrapper = render( );
+ const testActivePage = (testPage, testText) => {
+ wrapper.rerender( );
+ expect(wrapper.getByText(testText).closest('a')).toHaveAttribute('aria-current', 'page');
+ expect(wrapper.getByText(testText).closest('a')).toHaveAttribute('href', `/${testPage}/`);
};
- testActivePage('sdk/android/fundamentals/async-api', 4);
- testActivePage('sdk/ios', 2);
+ testActivePage('sdk/android/fundamentals/async-api', 'Asynchronous API');
+ testActivePage('sdk/ios', 'iOS SDK');
});
});
diff --git a/tests/unit/VersionDropdown.test.js b/tests/unit/VersionDropdown.test.js
index d3231152b..fa7449c7c 100644
--- a/tests/unit/VersionDropdown.test.js
+++ b/tests/unit/VersionDropdown.test.js
@@ -1,5 +1,5 @@
import React from 'react';
-import { shallow } from 'enzyme';
+import { render } from '@testing-library/react';
import VersionDropdown from '../../src/components/VersionDropdown';
import * as Gatsby from 'gatsby';
@@ -18,21 +18,6 @@ const publishedBranches = {
},
};
-const publishedBranchesNoLegacy = {
- version: {
- published: ['2.12', '2.11', '2.10', '2.9', '2.8', '2.7', '2.6', '2.5'],
- active: ['2.12', '2.11', '2.10', '2.9', '2.8', '2.7', '2.6', '2.5'],
- stable: null,
- upcoming: null,
- },
- git: {
- branches: {
- manual: 'master',
- published: ['master', 'v2.11', 'v2.10', 'v2.9', 'v2.8', 'v2.7', 'v2.6', 'v2.5'],
- },
- },
-};
-
const publishedBranchesUnversioned = {
version: {
published: ['master'],
@@ -63,57 +48,25 @@ useStaticQuery.mockImplementation(() => ({
// Testing a property with legacy docs
describe('when rendered', () => {
- let wrapper;
-
- beforeAll(() => {
- wrapper = shallow( );
- });
-
it('shows the dropdown menu', () => {
- expect(wrapper.find('StyledSelect')).toHaveLength(1);
+ const wrapper = render( );
+ expect(wrapper.getByRole('button')).toBeTruthy();
});
it('shows the "master" list item is active', () => {
- expect(wrapper.find('StyledSelect').prop('value')).toBe('master');
- });
-
- it('has 9 list elements', () => {
- expect(wrapper.find('Option')).toHaveLength(9);
- });
-
- it('shows `Legacy Docs` as the last list element', () => {
- expect(wrapper.find('Option').last().prop('value')).toBe('legacy');
+ const wrapper = render( );
+ expect(wrapper.getByText('Version 2.12')).toBeTruthy();
});
it('shows the proper name for master', () => {
- expect(wrapper.find('Option').first().text()).not.toBe('master');
- });
-});
-
-describe('when rendering a property without legacy docs', () => {
- let wrapper;
-
- beforeAll(() => {
- wrapper = shallow( );
- });
-
- it('has 8 list elements', () => {
- expect(wrapper.find('Option').children()).toHaveLength(8);
- });
-
- it('does not show `Legacy Docs` as the last list element', () => {
- expect(wrapper.find('Option').last().prop('value')).not.toBe('legacy');
+ const wrapper = render( );
+ expect(wrapper.getByText('Version 2.12')).toBeTruthy();
});
});
describe('when rendering an unversioned property', () => {
- let wrapper;
-
- beforeAll(() => {
- wrapper = shallow( );
- });
-
it('does not render', () => {
- expect(wrapper.find('StyledSelect')).toHaveLength(0);
+ const wrapper = render( );
+ expect(wrapper.queryAllByText('Version 2.12')).toHaveLength(0);
});
});
diff --git a/tests/unit/__snapshots__/Code.test.js.snap b/tests/unit/__snapshots__/Code.test.js.snap
index bd94e74b6..4b372173a 100644
--- a/tests/unit/__snapshots__/Code.test.js.snap
+++ b/tests/unit/__snapshots__/Code.test.js.snap
@@ -1,17 +1,231 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`renders correctly 1`] = `
-
- mongoimport --db test --collection inventory ^
- --authenticationDatabase admin --username <user> --password <password> ^
- --drop --file ~\\downloads\\inventory.crud.json
-
+
+ .emotion-7 {
+ border-spacing: 0;
+ vertical-align: top;
+ padding: 0 16px;
+}
+
+.emotion-11 {
+ color: inherit;
+ font-size: 13px;
+ font-family: 'Source Code Pro',Menlo,monospace;
+ line-height: 24px;
+}
+
+.emotion-3 {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ height: 12px;
+}
+
+.emotion-5 {
+ height: 12px;
+ width: 60px;
+}
+
+.emotion-4 {
+ padding-left: 8px;
+ padding-right: 8px;
+ font-size: 14px;
+}
+
+.emotion-12 {
+ border: 2px solid;
+ overflow-x: auto;
+ border-radius: 0;
+ border: 0;
+ padding-top: 8px;
+ padding-bottom: 8px;
+ margin: 0;
+ position: relative;
+ -webkit-box-flex: 1;
+ -webkit-flex-grow: 1;
+ -ms-flex-positive: 1;
+ flex-grow: 1;
+ white-space: pre;
+ border-color: #E7EEEC;
+ background-color: #F9FBFA;
+ color: #061621;
+ border-left: 0;
+}
+
+@media only screen and (max-device-width:812px) and (-webkit-min-device-pixel-ratio:2) {
+ .emotion-12 {
+ white-space: pre-wrap;
+ }
+}
+
+@media only screen and (min-device-width:813px) and (-webkit-min-device-pixel-ratio:2) {
+ .emotion-12 {
+ white-space: pre;
+ }
+}
+
+.emotion-14 {
+ border: 1px solid #E7EEEC;
+ border-radius: 4px;
+ overflow: hidden;
+}
+
+.emotion-13 {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+}
+
+.emotion-6 {
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ -webkit-box-pack: justify;
+ -webkit-justify-content: space-between;
+ -ms-flex-pack: justify;
+ justify-content: space-between;
+ height: 28px;
+ padding-left: 12px;
+ padding-right: 12px;
+ border-radius: 4px 4px 0 0;
+ background-color: #E7EEEC;
+ color: #5D6C74;
+}
+
+.emotion-0 {
+ height: 12px;
+ width: 12px;
+ border-radius: 50px;
+ margin-right: 8px;
+ background-color: #FF5952;
+ border: 1px solid #ff4a43;
+}
+
+.emotion-1 {
+ height: 12px;
+ width: 12px;
+ border-radius: 50px;
+ margin-right: 8px;
+ background-color: #E7BF2A;
+ border: 1px solid #e5bb1c;
+}
+
+.emotion-2 {
+ height: 12px;
+ width: 12px;
+ border-radius: 50px;
+ margin-right: 8px;
+ background-color: #54C22C;
+ border: 1px solid #4fb629;
+}
+
+.emotion-10 {
+ border-spacing: 0;
+ width: 100%;
+}
+
+.emotion-15 {
+ display: table;
+ margin: 16px 0;
+ min-width: 150px;
+ table-layout: fixed;
+ width: 100%;
+}
+
+.emotion-15 > div > div {
+ width: unset;
+}
+
+.emotion-15 button > div > div {
+ font-size: 16px;
+}
+
+
+
+
+
+
+
+
+
+
+
+ mongoimport --db test --collection inventory ^
+
+
+
+
+ --authenticationDatabase admin --username <user> --password <password> ^
+
+
+
+
+ --drop --file ~\\downloads\\inventory.crud.json
+
+
+
+
+
+
+
+
+
+
`;
diff --git a/tests/unit/__snapshots__/SearchResults.test.js.snap b/tests/unit/__snapshots__/SearchResults.test.js.snap
index ca57e08b7..3e2c3496c 100644
--- a/tests/unit/__snapshots__/SearchResults.test.js.snap
+++ b/tests/unit/__snapshots__/SearchResults.test.js.snap
@@ -1,25 +1,195 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Search Results Page renders correctly without browser 1`] = `
-
-
+ .emotion-2 {
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ -webkit-box-pack: center;
+ -webkit-justify-content: center;
+ -ms-flex-pack: center;
+ justify-content: center;
+}
+
+.emotion-5 {
+ border: none;
+ -webkit-appearance: unset;
+ padding: unset;
+ display: inline-block;
+ border-radius: 100px;
+ color: #89979B;
+ position: relative;
+ cursor: pointer;
+ -webkit-flex-shrink: 0;
+ -ms-flex-negative: 0;
+ flex-shrink: 0;
+ -webkit-transition: color 150ms ease-in-out;
+ transition: color 150ms ease-in-out;
+ background-color: rgba(255,255,255,0);
+ height: 28px;
+ width: 28px;
+}
+
+.emotion-5:before {
+ content: '';
+ -webkit-transition: 150ms all ease-in-out;
+ transition: 150ms all ease-in-out;
+ position: absolute;
+ top: 0;
+ bottom: 0;
+ left: 0;
+ right: 0;
+ border-radius: 100%;
+ opacity: 0;
+ -webkit-transform: scale(0.8);
+ -ms-transform: scale(0.8);
+ transform: scale(0.8);
+}
+
+.emotion-5:active:before,
+.emotion-5:hover:before,
+.emotion-5:focus:before {
+ opacity: 1;
+ -webkit-transform: scale(1);
+ -ms-transform: scale(1);
+ transform: scale(1);
+}
+
+.emotion-5:focus {
+ outline: none;
+}
+
+.emotion-5:active,
+.emotion-5:hover {
+ color: #3D4F58;
+}
+
+.emotion-5:active:before,
+.emotion-5:hover:before {
+ background-color: #E7EEEC;
+}
+
+.emotion-5:focus {
+ color: #1A567E;
+}
+
+.emotion-5:focus:before {
+ background-color: #C5E4F2;
+}
+
+.emotion-12 {
+ margin-bottom: calc(50vh - 28px - 40px - 166px / 2);
+ margin-top: calc(50vh - 28px - 40px - 166px / 2);
+}
+
+.emotion-10 {
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-flex-direction: column;
+ -ms-flex-direction: column;
+ flex-direction: column;
+ font-family: Akzidenz;
+ -webkit-letter-spacing: 0.5px;
+ -moz-letter-spacing: 0.5px;
+ -ms-letter-spacing: 0.5px;
+ letter-spacing: 0.5px;
+ margin: 0 auto;
+ max-width: 337px;
+ text-align: center;
+}
+
+.emotion-3 {
+ height: calc(40px + 16px);
+ width: calc(40px + 16px);
+}
+
+.emotion-3 span {
+ height: 40px;
+ width: 40px;
+}
+
+.emotion-0 {
+ color: #061621;
+ height: 40px;
+ width: 40px;
+}
+
+.emotion-6 {
+ color: #061621;
+ font-size: 18px;
+ line-height: 21px;
+ margin-bottom: 16px;
+}
+
+.emotion-8 {
+ font-size: 16px;
+ line-height: 24px;
+}
+
+
-
- Search Results
-
-
-
-
-
-
+
+
+
+
+
+
+ No results found. Please search again.
+
+
+
+ Sorry. We weren't able to find any results for your query. The page might have been moved or deleted.
+
+
+
+
`;
diff --git a/tests/unit/__snapshots__/Searchbar.test.js.snap b/tests/unit/__snapshots__/Searchbar.test.js.snap
deleted file mode 100644
index b4b236460..000000000
--- a/tests/unit/__snapshots__/Searchbar.test.js.snap
+++ /dev/null
@@ -1,42 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`Searchbar renders correctly without browser 1`] = `
-
-
-
-`;
-
-exports[`Searchbar renders correctly without browser 2`] = `
-
-
-
-
-
-`;
diff --git a/tests/unit/__snapshots__/Select.test.js.snap b/tests/unit/__snapshots__/Select.test.js.snap
index b59ba9d3a..3aa5616c3 100644
--- a/tests/unit/__snapshots__/Select.test.js.snap
+++ b/tests/unit/__snapshots__/Select.test.js.snap
@@ -1,23 +1,87 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Select renders select correctly 1`] = `
-
+
+ .emotion-6 {
+ font-size: 14px;
+ -webkit-letter-spacing: 0.5px;
+ -moz-letter-spacing: 0.5px;
+ -ms-letter-spacing: 0.5px;
+ letter-spacing: 0.5px;
+ line-height: 16px;
+ opacity: 1;
+}
+
+.emotion-4 {
+ background-color: #fff;
+ border: 1px solid rgba(184,196,194,0.4);
+ border-radius: 2px;
+ box-shadow: 0 0 4px 0 rgba(233,233,233,0.3);
+ color: #000;
+ cursor: pointer;
+ position: relative;
+}
+
+.emotion-2 {
+ -webkit-align-items: center;
+ -webkit-box-align: center;
+ -ms-flex-align: center;
+ align-items: center;
+ display: -webkit-box;
+ display: -webkit-flex;
+ display: -ms-flexbox;
+ display: flex;
+ -webkit-box-pack: justify;
+ -webkit-justify-content: space-between;
+ -ms-flex-pack: justify;
+ justify-content: space-between;
+ padding: 10px 16px;
+}
+
+.emotion-0 {
+ display: inline-block;
+ font-family: Akzidenz;
+ font-size: 14px;
+ margin: 0 !important;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+
+
`;
diff --git a/tests/unit/useFeedbackState.test.js b/tests/unit/useFeedbackState.test.js
deleted file mode 100644
index 39bea0b06..000000000
--- a/tests/unit/useFeedbackState.test.js
+++ /dev/null
@@ -1,237 +0,0 @@
-import React from 'react';
-import { mount } from 'enzyme';
-import { FeedbackProvider, useFeedbackState } from '../../src/components/Widgets/FeedbackWidget/context';
-import { FEEDBACK_QUALIFIERS_NEGATIVE } from './data/FeedbackWidget';
-import screenshot from './data/screenshot.test.json';
-
-import { tick, mockSegmentAnalytics } from '../utils';
-import {
- stitchFunctionMocks,
- mockStitchFunctions,
- clearMockStitchFunctions,
-} from '../utils/feedbackWidgetStitchFunctions';
-
-const FeedbackStateTest = () => {
- const {
- feedback,
- view,
- isSupportRequest,
- initializeFeedback,
- setRating,
- setQualifier,
- submitQualifiers,
- submitComment,
- submitScreenshot,
- submitSupport,
- abandon,
- } = useFeedbackState();
- return (
- <>
-
-
- {feedback && (
-
- {feedback.page && (
- <>
-
-
-
-
-
- >
- )}
- {feedback.user && (
- <>
-
-
-
-
- >
- )}
-
-
-
- {feedback.qualifiers && (
-
- {feedback.qualifiers.map((q) => (
-
- ))}
-
- )}
-
- )}
- initializeFeedback()} />
- setRating(rating)} />
- setQualifier(id, value)} />
- submitQualifiers()} />
-
+
`;
exports[`renders with "connected" styling by default 1`] = `
-.emotion-6 {
+
+ .emotion-6 {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
@@ -168,36 +171,38 @@ exports[`renders with "connected" styling by default 1`] = `
}
+
-
+
`;
exports[`renders with "normal" or YAML steps styling 1`] = `
-.emotion-6 {
+
+ .emotion-6 {
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
@@ -243,34 +248,31 @@ exports[`renders with "normal" or YAML steps styling 1`] = `
}
+
-<<<<<<< HEAD
-=======
-
->>>>>>> master
`;
From 2375b5c32c451a173c48a7306e9e7054509e7b8e Mon Sep 17 00:00:00 2001
From: Cassidy Schaufele
Date: Thu, 20 Jan 2022 23:18:15 -0700
Subject: [PATCH 09/10] DOP-2642: Pardon the dust
---
tests/unit/Chapters.test.js | 2 --
tests/unit/DeprecatedVersionSelector.test.js | 7 ++-----
tests/unit/Pagination.test.js | 1 -
tests/unit/Pills.test.js | 2 --
tests/unit/ProductsList.test.js | 1 -
tests/unit/QuizWidget.test.js | 2 +-
tests/unit/SearchResults.test.js | 2 +-
tests/unit/Sidenav.test.js | 1 +
8 files changed, 5 insertions(+), 13 deletions(-)
diff --git a/tests/unit/Chapters.test.js b/tests/unit/Chapters.test.js
index c442e66f3..b88c08260 100644
--- a/tests/unit/Chapters.test.js
+++ b/tests/unit/Chapters.test.js
@@ -25,7 +25,6 @@ describe('Chapters', () => {
it('renders chapters', () => {
const wrapper = mountChapters();
- // screen.debug()
// We expect 2 chapter entries and 1 chapter view selector, per test data.
expect(wrapper.queryAllByText('Chapter', { exact: false })).toHaveLength(3);
@@ -40,7 +39,6 @@ describe('Chapters', () => {
// Only the Chapter view selector should be rendered.
expect(wrapper.queryAllByText('Chapter', { exact: false })).toHaveLength(1);
- // screen.debug()
// Three cards should render with Atlas chapter icons, per test data.
const cardImages = wrapper.queryAllByAltText('Atlas chapter icon');
diff --git a/tests/unit/DeprecatedVersionSelector.test.js b/tests/unit/DeprecatedVersionSelector.test.js
index f15960cf7..b16e75bd4 100644
--- a/tests/unit/DeprecatedVersionSelector.test.js
+++ b/tests/unit/DeprecatedVersionSelector.test.js
@@ -36,11 +36,8 @@ describe('when rendered', () => {
const wrapper = render( );
const versionDropdown = wrapper.getByText('Select a Version');
- // Limitation of implementation here - may be questionable to have the dropdown text in a tag
- // and not in the actual dropdown div
- // div is also likely not tab navigable.
- // TODO: refactor for accessibility in the future,
- // moving from a div to a if time permits
+ // Limitation of implementation here - may be desirable to move text from the tag
+ // to the actual dropdown div
expect(versionDropdown.parentElement).toHaveAttribute('aria-disabled', 'true');
});
diff --git a/tests/unit/Pagination.test.js b/tests/unit/Pagination.test.js
index e23805faa..d693102ae 100644
--- a/tests/unit/Pagination.test.js
+++ b/tests/unit/Pagination.test.js
@@ -18,7 +18,6 @@ describe('Pagination', () => {
it('should not allow page 1 to be decremented', () => {
const wrapper = render( );
let paginationText = wrapper.getByText('1/10');
- // let paginationText = wrapper.find('PaginationText').text();
expect(paginationText).toBeTruthy();
const decrementButton = wrapper.getByTitle('Back Page');
expect(decrementButton).toHaveAttribute('aria-disabled', 'true');
diff --git a/tests/unit/Pills.test.js b/tests/unit/Pills.test.js
index 032ad9926..196a2be8a 100644
--- a/tests/unit/Pills.test.js
+++ b/tests/unit/Pills.test.js
@@ -16,8 +16,6 @@ describe('Pills component', () => {
const mockData = ['windows', 'macos', 'linux'];
const mockSetActiveTab = jest.fn();
- beforeAll(() => {});
-
it('renders correctly', () => {
const wrapper = renderPills({
activeTabs: { platforms: PLATFORMS[1] },
diff --git a/tests/unit/ProductsList.test.js b/tests/unit/ProductsList.test.js
index 415d0a294..b3b94a81a 100644
--- a/tests/unit/ProductsList.test.js
+++ b/tests/unit/ProductsList.test.js
@@ -30,7 +30,6 @@ describe('ProductsList', () => {
// Products still technically render, but should be displayed as none
const productsListEntry = wrapper.getByText(mockProducts[0].title);
expect(productsListEntry).toBeTruthy();
- // expect(productsList.childAt(0).children()).toHaveLength(2);
expect(productsListEntry).not.toBeVisible();
});
diff --git a/tests/unit/QuizWidget.test.js b/tests/unit/QuizWidget.test.js
index 0f059a0e5..8c0f1f1c9 100644
--- a/tests/unit/QuizWidget.test.js
+++ b/tests/unit/QuizWidget.test.js
@@ -17,7 +17,7 @@ jest.mock('../../src/hooks/use-site-metadata', () => ({
describe('quiz widget snapshots', () => {
const spy = jest.spyOn(global, 'Date').mockImplementation(() => mockDate);
- Date.now = jest.fn(() => 1466424490000);
+ Date.now = jest.fn(() => timestamp);
it('renders quiz widget correctly', () => {
const tree = render( );
diff --git a/tests/unit/SearchResults.test.js b/tests/unit/SearchResults.test.js
index bec445a49..fbb2561bd 100644
--- a/tests/unit/SearchResults.test.js
+++ b/tests/unit/SearchResults.test.js
@@ -51,7 +51,7 @@ const expectUnfilteredResults = (wrapper) => {
);
expect(wrapper.queryAllByText('Realm results for "stitch"').length).toBe(0);
- // // Check the dropdowns are not filled in
+ // Check the dropdowns are not filled in
expectValuesForFilters(wrapper, 'Select a Product', 'Select a Version');
};
diff --git a/tests/unit/Sidenav.test.js b/tests/unit/Sidenav.test.js
index 87f461475..c20822ad2 100644
--- a/tests/unit/Sidenav.test.js
+++ b/tests/unit/Sidenav.test.js
@@ -75,6 +75,7 @@ describe('Sidenav', () => {
// js-dom isn't properly reflecting styled components updating active css across media queries
// TODO: replace this or otherwise fix if ever a fix is released
+ // commented expect statements *should* work, but styles are not rendering properly in this test.
// expect(wrapper.getByTestId('side-nav-container')).toHaveStyle('display: none')
// Clicking menu button displays Sidenav
From 07715db574940382bc616965349759f2d4941d0c Mon Sep 17 00:00:00 2001
From: Cassidy Schaufele
Date: Fri, 21 Jan 2022 11:36:20 -0700
Subject: [PATCH 10/10] DOP-2642: Workaround for css not updating properly
across viewports
---
tests/unit/Sidenav.test.js | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/tests/unit/Sidenav.test.js b/tests/unit/Sidenav.test.js
index c20822ad2..de53a833e 100644
--- a/tests/unit/Sidenav.test.js
+++ b/tests/unit/Sidenav.test.js
@@ -5,6 +5,7 @@ import userEvent from '@testing-library/user-event';
import { Sidenav, SidenavContextProvider, SidenavMobileMenuButton } from '../../src/components/Sidenav';
import { theme } from '../../src/theme/docsTheme';
import { tick, setMatchMedia, setMobile } from '../utils';
+import { matchers } from 'jest-emotion';
const useStaticQuery = jest.spyOn(Gatsby, 'useStaticQuery');
const setProject = (project) => {
@@ -38,6 +39,8 @@ const findCollapseButton = (wrapper) => {
return wrapper.getByTestId('side-nav-collapse-toggle');
};
+expect.extend(matchers);
+
describe('Sidenav', () => {
jest.useFakeTimers();
@@ -76,18 +79,22 @@ describe('Sidenav', () => {
// js-dom isn't properly reflecting styled components updating active css across media queries
// TODO: replace this or otherwise fix if ever a fix is released
// commented expect statements *should* work, but styles are not rendering properly in this test.
- // expect(wrapper.getByTestId('side-nav-container')).toHaveStyle('display: none')
+ expect(wrapper.getByTestId('side-nav-container')).toHaveStyleRule('display', 'none', {
+ media: `${theme.screenSize.upToSmall}`,
+ });
// Clicking menu button displays Sidenav
userEvent.click(findCollapseButton(wrapper));
await tick();
expect(findCollapseButton(wrapper)).toHaveAttribute('aria-expanded', 'false');
- // expect(wrapper.getByTestId('side-nav-container')).toBeVisible();
+ expect(wrapper.getByTestId('side-nav-container')).toBeVisible();
// Clicking menu button again closes Sidenav
userEvent.click(findCollapseButton(wrapper));
await tick();
- // expect(wrapper.getByTestId('side-nav-container')).not.toBeVisible();
+ expect(wrapper.getByTestId('side-nav-container')).toHaveStyleRule('display', 'none', {
+ media: `${theme.screenSize.upToSmall}`,
+ });
expect(findCollapseButton(wrapper)).toHaveAttribute('aria-expanded', 'true');
});
});