From 77eb53808216597530b4c59f3057c9da127504bd Mon Sep 17 00:00:00 2001 From: Chi Vinh Le Date: Mon, 6 Aug 2018 20:13:50 +0200 Subject: [PATCH] Add more integration tests --- .../containers/PermalinkViewContainer.tsx | 11 +- .../permalinkViewAssetNotFound.spec.tsx.snap | 17 +++ ...permalinkViewCommentNotFound.spec.tsx.snap | 109 ++++++++++++++++++ .../test/permalinkViewAssetNotFound.spec.tsx | 43 +++++++ .../permalinkViewCommentNotFound.spec.tsx | 78 +++++++++++++ 5 files changed, 254 insertions(+), 4 deletions(-) create mode 100644 src/core/client/stream/test/__snapshots__/permalinkViewAssetNotFound.spec.tsx.snap create mode 100644 src/core/client/stream/test/__snapshots__/permalinkViewCommentNotFound.spec.tsx.snap create mode 100644 src/core/client/stream/test/permalinkViewAssetNotFound.spec.tsx create mode 100644 src/core/client/stream/test/permalinkViewCommentNotFound.spec.tsx diff --git a/src/core/client/stream/containers/PermalinkViewContainer.tsx b/src/core/client/stream/containers/PermalinkViewContainer.tsx index 769ecc7ff..65fede9d8 100644 --- a/src/core/client/stream/containers/PermalinkViewContainer.tsx +++ b/src/core/client/stream/containers/PermalinkViewContainer.tsx @@ -10,8 +10,8 @@ import { import PermalinkView from "../components/PermalinkView"; interface PermalinkViewContainerProps { - comment: CommentData; - asset: AssetData; + comment: CommentData | null; + asset: AssetData | null; setCommentID: SetCommentIDMutation; } @@ -26,7 +26,7 @@ class PermalinkViewContainer extends React.Component< return ( ); @@ -34,7 +34,10 @@ class PermalinkViewContainer extends React.Component< } const enhanced = withSetCommentIDMutation( - withFragmentContainer<{ comment: CommentData; asset: AssetData }>({ + withFragmentContainer<{ + comment: CommentData | null; + asset: AssetData | null; + }>({ comment: graphql` fragment PermalinkViewContainer_comment on Comment { ...CommentContainer diff --git a/src/core/client/stream/test/__snapshots__/permalinkViewAssetNotFound.spec.tsx.snap b/src/core/client/stream/test/__snapshots__/permalinkViewAssetNotFound.spec.tsx.snap new file mode 100644 index 000000000..270fae18d --- /dev/null +++ b/src/core/client/stream/test/__snapshots__/permalinkViewAssetNotFound.spec.tsx.snap @@ -0,0 +1,17 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`renders permalink view with unknown asset 1`] = ` +
+
+

+ Comment not found +

+
+
+`; diff --git a/src/core/client/stream/test/__snapshots__/permalinkViewCommentNotFound.spec.tsx.snap b/src/core/client/stream/test/__snapshots__/permalinkViewCommentNotFound.spec.tsx.snap new file mode 100644 index 000000000..6e094cf1e --- /dev/null +++ b/src/core/client/stream/test/__snapshots__/permalinkViewCommentNotFound.spec.tsx.snap @@ -0,0 +1,109 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`renders permalink view with unknown comment 1`] = ` +
+
+ +

+ Comment not found +

+
+
+`; + +exports[`show all comments 1`] = ` +
+
+
+
+