summaryrefslogtreecommitdiffstats
path: root/frontend/__tests__/__snapshots__
diff options
context:
space:
mode:
authorWes Bos <wesbos@gmail.com>2018-03-14 12:19:54 -0400
committerWes Bos <wesbos@gmail.com>2018-03-14 12:19:54 -0400
commit331da87bd53bc1fb79063d142764c75df9f32170 (patch)
treed80aac98154a811fdf57b10e90ac0350fe14568e /frontend/__tests__/__snapshots__
parent46a0ba30ef54a7e36206481a4f5b2bf1f9702fca (diff)
tests
Diffstat (limited to 'frontend/__tests__/__snapshots__')
-rw-r--r--frontend/__tests__/__snapshots__/CartCount.test.js.snap201
-rw-r--r--frontend/__tests__/__snapshots__/CreateItem.test.js.snap58
-rw-r--r--frontend/__tests__/__snapshots__/Item.test.js.snap60
-rw-r--r--frontend/__tests__/__snapshots__/Nav.test.js.snap69
-rw-r--r--frontend/__tests__/__snapshots__/Pagination.test.js.snap67
5 files changed, 455 insertions, 0 deletions
diff --git a/frontend/__tests__/__snapshots__/CartCount.test.js.snap b/frontend/__tests__/__snapshots__/CartCount.test.js.snap
new file mode 100644
index 0000000..ddb6710
--- /dev/null
+++ b/frontend/__tests__/__snapshots__/CartCount.test.js.snap
@@ -0,0 +1,201 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`<CartCount></CartCount> matches snapshot 1`] = `
+<styled.span>
+ <TransitionGroup
+ childFactory={[Function]}
+ component="div"
+ >
+ <CSSTransition
+ className="count"
+ classNames="count"
+ key="10"
+ timeout={
+ Object {
+ "enter": 2000,
+ "exit": 2000,
+ }
+ }
+ >
+ <styled.div>
+ 10
+ </styled.div>
+ </CSSTransition>
+ </TransitionGroup>
+</styled.span>
+`;
+
+exports[`<CartCount></CartCount> updates via props 1`] = `
+<CartCount
+ count="50"
+>
+ <styled.span>
+ <span
+ className="sc-bwzfXH fWZfOZ"
+ >
+ <TransitionGroup
+ childFactory={[Function]}
+ component="div"
+ >
+ <div>
+ <CSSTransition
+ className="count"
+ classNames="count"
+ in={true}
+ key=".$50"
+ onExited={[Function]}
+ timeout={
+ Object {
+ "enter": 2000,
+ "exit": 2000,
+ }
+ }
+ >
+ <Transition
+ appear={false}
+ className="count"
+ enter={true}
+ exit={true}
+ in={true}
+ mountOnEnter={false}
+ onEnter={[Function]}
+ onEntered={[Function]}
+ onEntering={[Function]}
+ onExit={[Function]}
+ onExited={[Function]}
+ onExiting={[Function]}
+ timeout={
+ Object {
+ "enter": 2000,
+ "exit": 2000,
+ }
+ }
+ unmountOnExit={false}
+ >
+ <styled.div
+ className="count"
+ >
+ <div
+ className="count sc-bdVaJa cYFOmX"
+ >
+ 50
+ </div>
+ </styled.div>
+ </Transition>
+ </CSSTransition>
+ </div>
+ </TransitionGroup>
+ </span>
+ </styled.span>
+</CartCount>
+`;
+
+exports[`<CartCount></CartCount> updates via props 2`] = `
+<CartCount
+ count={10}
+>
+ <styled.span>
+ <span
+ className="sc-bwzfXH fWZfOZ"
+ >
+ <TransitionGroup
+ childFactory={[Function]}
+ component="div"
+ >
+ <div>
+ <CSSTransition
+ className="count"
+ classNames="count"
+ in={true}
+ key=".$10"
+ onExited={[Function]}
+ timeout={
+ Object {
+ "enter": 2000,
+ "exit": 2000,
+ }
+ }
+ >
+ <Transition
+ appear={false}
+ className="count"
+ enter={true}
+ exit={true}
+ in={true}
+ mountOnEnter={false}
+ onEnter={[Function]}
+ onEntered={[Function]}
+ onEntering={[Function]}
+ onExit={[Function]}
+ onExited={[Function]}
+ onExiting={[Function]}
+ timeout={
+ Object {
+ "enter": 2000,
+ "exit": 2000,
+ }
+ }
+ unmountOnExit={false}
+ >
+ <styled.div
+ className="count"
+ >
+ <div
+ className="count sc-bdVaJa cYFOmX"
+ >
+ 10
+ </div>
+ </styled.div>
+ </Transition>
+ </CSSTransition>
+ <CSSTransition
+ className="count"
+ classNames="count"
+ in={false}
+ key=".$50"
+ onExited={[Function]}
+ timeout={
+ Object {
+ "enter": 2000,
+ "exit": 2000,
+ }
+ }
+ >
+ <Transition
+ appear={false}
+ className="count"
+ enter={true}
+ exit={true}
+ in={false}
+ mountOnEnter={false}
+ onEnter={[Function]}
+ onEntered={[Function]}
+ onEntering={[Function]}
+ onExit={[Function]}
+ onExited={[Function]}
+ onExiting={[Function]}
+ timeout={
+ Object {
+ "enter": 2000,
+ "exit": 2000,
+ }
+ }
+ unmountOnExit={false}
+ >
+ <styled.div
+ className="count"
+ >
+ <div
+ className="count sc-bdVaJa cYFOmX"
+ >
+ 50
+ </div>
+ </styled.div>
+ </Transition>
+ </CSSTransition>
+ </div>
+ </TransitionGroup>
+ </span>
+ </styled.span>
+</CartCount>
+`;
diff --git a/frontend/__tests__/__snapshots__/CreateItem.test.js.snap b/frontend/__tests__/__snapshots__/CreateItem.test.js.snap
new file mode 100644
index 0000000..66b7965
--- /dev/null
+++ b/frontend/__tests__/__snapshots__/CreateItem.test.js.snap
@@ -0,0 +1,58 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`<Createitem/> renders the form out 1`] = `
+<div>
+ <Form
+ onSubmit={[Function]}
+ >
+ <DisplayError
+ error={
+ Object {
+ "message": null,
+ }
+ }
+ onButtonClick={[Function]}
+ />
+ <p>
+ Image
+ <input
+ accept=".png, .jpg, .jpeg"
+ onChange={[Function]}
+ type="file"
+ />
+ </p>
+ <p>
+ Title
+ <input
+ id="title"
+ name="title"
+ onChange={[Function]}
+ placeholder="Title"
+ type="text"
+ />
+ </p>
+ <label>
+ Price
+ <input
+ id="price"
+ min="0"
+ name="price"
+ onChange={[Function]}
+ type="number"
+ />
+ </label>
+ <textarea
+ id="description"
+ name="description"
+ onChange={[Function]}
+ placeholder="The desc for this item"
+ />
+ <button
+ disabled={false}
+ type="submit"
+ >
+ Submit
+ </button>
+ </Form>
+</div>
+`;
diff --git a/frontend/__tests__/__snapshots__/Item.test.js.snap b/frontend/__tests__/__snapshots__/Item.test.js.snap
new file mode 100644
index 0000000..f088121
--- /dev/null
+++ b/frontend/__tests__/__snapshots__/Item.test.js.snap
@@ -0,0 +1,60 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`<Item/> Renders an item 1`] = `
+<styled.div
+ key="ABC123"
+>
+ <img
+ alt="A Cool Item"
+ src="dog.jpg"
+ />
+ <styled.h3>
+ <Link
+ href={
+ Object {
+ "pathname": "/item",
+ "query": Object {
+ "id": "ABC123",
+ },
+ }
+ }
+ >
+ <a>
+ A Cool Item
+ </a>
+ </Link>
+ </styled.h3>
+ <styled.span>
+ $50
+ </styled.span>
+ <p>
+ This item is really cool!
+ </p>
+ <div
+ className="buttonList"
+ >
+ <Link
+ href={
+ Object {
+ "pathname": "/admin/update",
+ "query": Object {
+ "id": "ABC123",
+ },
+ }
+ }
+ >
+ <a>
+ Edit ✏️
+ </a>
+ </Link>
+ <Apollo(Apollo(AddToCart))
+ id="ABC123"
+ />
+ <button
+ onClick={[Function]}
+ >
+ × Delete item
+ </button>
+ </div>
+</styled.div>
+`;
diff --git a/frontend/__tests__/__snapshots__/Nav.test.js.snap b/frontend/__tests__/__snapshots__/Nav.test.js.snap
new file mode 100644
index 0000000..d8520ac
--- /dev/null
+++ b/frontend/__tests__/__snapshots__/Nav.test.js.snap
@@ -0,0 +1,69 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`<Nav></Nav> Renders minimal nav when logged out 1`] = `
+<styled.ul>
+ <Link
+ href="/items"
+ prefetch={true}
+ >
+ <a>
+ Shop
+ </a>
+ </Link>
+ <Link
+ href="/add"
+ prefetch={true}
+ >
+ <a>
+ Sell
+ </a>
+ </Link>
+ <Link
+ href="/signup"
+ prefetch={true}
+ >
+ <a>
+ Sign In
+ </a>
+ </Link>
+</styled.ul>
+`;
+
+exports[`<Nav></Nav> renders full nav when logged in 1`] = `
+<styled.ul>
+ <Link
+ href="/items"
+ prefetch={true}
+ >
+ <a>
+ Shop
+ </a>
+ </Link>
+ <Link
+ href="/add"
+ prefetch={true}
+ >
+ <a>
+ Sell
+ </a>
+ </Link>
+ <React.Fragment>
+ <Link
+ href="/orders"
+ >
+ <a>
+ Orders
+ </a>
+ </Link>
+ <Link
+ href="/me"
+ >
+ <a>
+ My Account
+ </a>
+ </Link>
+ <Apollo(Signout) />
+ <[object Object] />
+ </React.Fragment>
+</styled.ul>
+`;
diff --git a/frontend/__tests__/__snapshots__/Pagination.test.js.snap b/frontend/__tests__/__snapshots__/Pagination.test.js.snap
new file mode 100644
index 0000000..f2abcdf
--- /dev/null
+++ b/frontend/__tests__/__snapshots__/Pagination.test.js.snap
@@ -0,0 +1,67 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`<Pagination/> displays loading message 1`] = `
+<p>
+ Loading...
+</p>
+`;
+
+exports[`<Pagination/> renders pagination for 18 items 1`] = `
+<styled.div>
+ <Link
+ href={
+ Object {
+ "pathname": "items",
+ "query": Object {
+ "page": 0,
+ },
+ }
+ }
+ prefetch={true}
+ >
+ <a
+ aria-disabled={true}
+ className="prev"
+ >
+ ←Prev
+ </a>
+ </Link>
+ <p>
+ Page
+ <strong>
+ 1
+
+ </strong>
+ of
+ <strong
+ className="totalPages"
+ >
+ 2
+ </strong>
+ </p>
+ <p>
+ <strong>
+ 18
+ </strong>
+ Items Total
+ </p>
+ <Link
+ href={
+ Object {
+ "pathname": "items",
+ "query": Object {
+ "page": 2,
+ },
+ }
+ }
+ prefetch={true}
+ >
+ <a
+ aria-disabled={false}
+ className="next"
+ >
+ Next →
+ </a>
+ </Link>
+</styled.div>
+`;