-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for Blocks (+ Update test environment)
- Loading branch information
1 parent
9ba421b
commit 107b9ad
Showing
5 changed files
with
84 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* set up test environment for jest | ||
* @jest-environment jsdom | ||
*/ | ||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
|
||
import { ContentBlockProse } from '$styles/content-block'; | ||
import Block from '$components/discoveries/blocks'; | ||
import Figure from '$components/discoveries/blocks/figure'; | ||
import { Caption } from '$components/discoveries/images'; | ||
|
||
test('Throws an error when content is not wrapped with Prose', () => { | ||
const { getByText } = render( | ||
<Block> | ||
<p>test</p> | ||
</Block> | ||
); | ||
expect(getByText(/There is an error in this block: /)).toBeDefined(); | ||
}); | ||
|
||
test('Throws an error when a block has two captions', () => { | ||
const { getByText } = render( | ||
<Block> | ||
<Figure> | ||
<Caption /> | ||
<Caption /> | ||
</Figure> | ||
</Block> | ||
); | ||
expect(getByText(/There is an error in this block: /)).toBeDefined(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3284,6 +3284,13 @@ browserslist@^4.0.0, browserslist@^4.12.0, browserslist@^4.16.6, browserslist@^4 | |
node-releases "^2.0.2" | ||
picocolors "^1.0.0" | ||
|
||
[email protected]: | ||
version "0.2.6" | ||
resolved "http://ec2-3-82-125-171.compute-1.amazonaws.com:4873/bs-logger/-/bs-logger-0.2.6.tgz#eb7d365307a72cf974cc6cda76b68354ad336bd8" | ||
integrity sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog== | ||
dependencies: | ||
fast-json-stable-stringify "2.x" | ||
|
||
[email protected]: | ||
version "2.1.1" | ||
resolved "http://ec2-3-82-125-171.compute-1.amazonaws.com:4873/bser/-/bser-2.1.1.tgz#e6787da20ece9d07998533cfd9de6f5c38f4bc05" | ||
|
@@ -4835,7 +4842,7 @@ fast-glob@^3.2.5, fast-glob@^3.2.7, fast-glob@^3.2.9: | |
merge2 "^1.3.0" | ||
micromatch "^4.0.4" | ||
|
||
fast-json-stable-stringify@^2.0.0: | ||
fast-json-stable-stringify@2.x, fast-json-stable-stringify@^2.0.0: | ||
version "2.1.0" | ||
resolved "http://ec2-3-82-125-171.compute-1.amazonaws.com:4873/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" | ||
integrity sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw== | ||
|
@@ -6513,7 +6520,7 @@ jest-snapshot@^27.5.1: | |
pretty-format "^27.5.1" | ||
semver "^7.3.2" | ||
|
||
jest-util@^27.5.1: | ||
jest-util@^27.0.0, jest-util@^27.5.1: | ||
version "27.5.1" | ||
resolved "http://ec2-3-82-125-171.compute-1.amazonaws.com:4873/jest-util/-/jest-util-27.5.1.tgz#3ba9771e8e31a0b85da48fe0b0891fb86c01c2f9" | ||
integrity sha512-Kv2o/8jNvX1MQ0KGtw480E/w4fBCDOnH6+6DmeKi6LZUIlKA5kwY0YNdlzaWTiVgxqAqik11QyxDOKk543aKXw== | ||
|
@@ -6656,7 +6663,7 @@ json-stable-stringify-without-jsonify@^1.0.1: | |
resolved "http://ec2-3-82-125-171.compute-1.amazonaws.com:4873/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" | ||
integrity sha1-nbe1lJatPzz+8wp1FC0tkwrXJlE= | ||
|
||
json5@^2.1.2, json5@^2.2.0: | ||
json5@2.x, json5@^2.1.2, json5@^2.2.0: | ||
version "2.2.0" | ||
resolved "http://ec2-3-82-125-171.compute-1.amazonaws.com:4873/json5/-/json5-2.2.0.tgz#2dfefe720c6ba525d9ebd909950f0515316c89a3" | ||
integrity sha512-f+8cldu7X/y7RAJurMEJmdoKXGB/X550w2Nr3tTbezL6RwEE/iMcm+tZnXeoZtKuOq6ft8+CqzEkrIgx1fPoQA== | ||
|
@@ -6852,7 +6859,7 @@ lodash.isfinite@^3.3.2: | |
resolved "http://ec2-3-82-125-171.compute-1.amazonaws.com:4873/lodash.isfinite/-/lodash.isfinite-3.3.2.tgz#fb89b65a9a80281833f0b7478b3a5104f898ebb3" | ||
integrity sha1-+4m2WpqAKBgz8LdHizpRBPiY67M= | ||
|
||
lodash.memoize@^4.1.2: | ||
lodash.memoize@4.x, lodash.memoize@^4.1.2: | ||
version "4.1.2" | ||
resolved "http://ec2-3-82-125-171.compute-1.amazonaws.com:4873/lodash.memoize/-/lodash.memoize-4.1.2.tgz#bcc6c49a42a2840ed997f323eada5ecd182e0bfe" | ||
integrity sha1-vMbEmkKihA7Zl/Mj6tpezRguC/4= | ||
|
@@ -6921,6 +6928,11 @@ make-dir@^3.0.0: | |
dependencies: | ||
semver "^6.0.0" | ||
|
||
[email protected]: | ||
version "1.3.6" | ||
resolved "http://ec2-3-82-125-171.compute-1.amazonaws.com:4873/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" | ||
integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== | ||
|
||
make-iterator@^1.0.0: | ||
version "1.0.1" | ||
resolved "http://ec2-3-82-125-171.compute-1.amazonaws.com:4873/make-iterator/-/make-iterator-1.0.1.tgz#29b33f312aa8f547c4a5e490f56afcec99133ad6" | ||
|
@@ -9423,18 +9435,18 @@ [email protected]: | |
resolved "http://ec2-3-82-125-171.compute-1.amazonaws.com:4873/semver/-/semver-7.0.0.tgz#5f3ca35761e47e05b206c6daff2cf814f0316b8e" | ||
integrity sha512-+GB6zVA9LWh6zovYQLALHwv5rb2PHGlJi3lfiqIHxR0uuwCgefcOJc59v9fv1w8GbStwxuuqqAjI9NMAOOgq1A== | ||
|
||
semver@^6.0.0, semver@^6.1.1, semver@^6.1.2, semver@^6.3.0: | ||
version "6.3.0" | ||
resolved "http://ec2-3-82-125-171.compute-1.amazonaws.com:4873/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" | ||
integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== | ||
|
||
semver@^7.3.2, semver@^7.3.4, semver@^7.3.5: | ||
[email protected], semver@^7.3.2, semver@^7.3.4, semver@^7.3.5: | ||
version "7.3.5" | ||
resolved "http://ec2-3-82-125-171.compute-1.amazonaws.com:4873/semver/-/semver-7.3.5.tgz#0b621c879348d8998e4b0e4be94b3f12e6018ef7" | ||
integrity sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ== | ||
dependencies: | ||
lru-cache "^6.0.0" | ||
|
||
semver@^6.0.0, semver@^6.1.1, semver@^6.1.2, semver@^6.3.0: | ||
version "6.3.0" | ||
resolved "http://ec2-3-82-125-171.compute-1.amazonaws.com:4873/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" | ||
integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== | ||
|
||
set-blocking@^2.0.0: | ||
version "2.0.0" | ||
resolved "http://ec2-3-82-125-171.compute-1.amazonaws.com:4873/set-blocking/-/set-blocking-2.0.0.tgz#045f9782d011ae9a6803ddd382b24392b3d890f7" | ||
|
@@ -10204,6 +10216,20 @@ trough@^2.0.0: | |
resolved "http://ec2-3-82-125-171.compute-1.amazonaws.com:4873/trough/-/trough-2.1.0.tgz#0f7b511a4fde65a46f18477ab38849b22c554876" | ||
integrity sha512-AqTiAOLcj85xS7vQ8QkAV41hPDIJ71XJB4RCUrzo/1GM2CQwhkJGaf9Hgr7BOugMRpgGUrqRg/DrBDl4H40+8g== | ||
|
||
ts-jest@^27.1.3: | ||
version "27.1.3" | ||
resolved "http://ec2-3-82-125-171.compute-1.amazonaws.com:4873/ts-jest/-/ts-jest-27.1.3.tgz#1f723e7e74027c4da92c0ffbd73287e8af2b2957" | ||
integrity sha512-6Nlura7s6uM9BVUAoqLH7JHyMXjz8gluryjpPXxr3IxZdAXnU6FhjvVLHFtfd1vsE1p8zD1OJfskkc0jhTSnkA== | ||
dependencies: | ||
bs-logger "0.x" | ||
fast-json-stable-stringify "2.x" | ||
jest-util "^27.0.0" | ||
json5 "2.x" | ||
lodash.memoize "4.x" | ||
make-error "1.x" | ||
semver "7.x" | ||
yargs-parser "20.x" | ||
|
||
tslib@^1.8.1: | ||
version "1.14.1" | ||
resolved "http://ec2-3-82-125-171.compute-1.amazonaws.com:4873/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" | ||
|
@@ -10918,7 +10944,7 @@ yaml@^1.10.0, yaml@^1.10.2: | |
resolved "http://ec2-3-82-125-171.compute-1.amazonaws.com:4873/yaml/-/yaml-1.10.2.tgz#2301c5ffbf12b467de8da2333a459e29e7920e4b" | ||
integrity sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg== | ||
|
||
yargs-parser@^20.2.2, yargs-parser@^20.2.3: | ||
yargs-parser@20.x, yargs-parser@^20.2.2, yargs-parser@^20.2.3: | ||
version "20.2.9" | ||
resolved "http://ec2-3-82-125-171.compute-1.amazonaws.com:4873/yargs-parser/-/yargs-parser-20.2.9.tgz#2eb7dc3b0289718fc295f362753845c41a0c94ee" | ||
integrity sha512-y11nGElTIV+CT3Zv9t7VKl+Q3hTQoT9a1Qzezhhl6Rp21gJ/IVTW7Z3y9EWXhuUBC2Shnf+DX0antecpAwSP8w== | ||
|