Fix showAllReplies test

This commit is contained in:
Chi Vinh Le
2018-07-09 17:41:39 -03:00
parent 25c931cc05
commit 11de453aac
2 changed files with 50 additions and 43 deletions
@@ -164,16 +164,20 @@ exports[`show all replies 1`] = `
What's up?
</p>
</div>
<button
className="root root invert fullWidth secondary"
id="talk-reply-list--show-all--comment-0"
onBlur={[Function]}
onClick={[Function]}
onFocus={[Function]}
onMouseDown={[Function]}
<div
className="root gutterBottom"
>
Show All Replies
</button>
<p
className="root body1 gutterBottom author"
>
Isabelle
</p>
<p
className="root body1"
>
Hey!
</p>
</div>
</div>
</div>
</div>
@@ -10,6 +10,40 @@ import AppQuery from "talk-stream/queries/AppQuery";
import createEnvironment from "./createEnvironment";
import { assets, comments } from "./fixtures";
const commentStub = {
...comments[0],
replies: {
edges: sinon
.stub()
.onFirstCall()
.returns([
{
node: comments[1],
cursor: comments[1].createdAt,
},
])
.onSecondCall()
.returns([
{
node: comments[2],
cursor: comments[2].createdAt,
},
]),
pageInfo: sinon
.stub()
.onFirstCall()
.returns({
endCursor: comments[1].createdAt,
hasNextPage: true,
})
.onSecondCall()
.returns({
endCursor: comments[2].createdAt,
hasNextPage: false,
}),
},
};
const assetStub = {
...assets[0],
comments: {
@@ -18,40 +52,8 @@ const assetStub = {
},
edges: [
{
node: {
...comments[0],
replies: {
edges: sinon
.stub()
.onFirstCall()
.returns([
{
node: comments[1],
cursor: comments[1].createdAt,
},
])
.onSecondCall()
.returns([
{
node: comments[2],
cursor: comments[2].createdAt,
},
]),
pageInfo: sinon
.stub()
.onFirstCall()
.returns({
endCursor: comments[1].createdAt,
hasNextPage: true,
})
.onSecondCall()
.returns({
endCursor: comments[2].createdAt,
hasNextPage: false,
}),
},
},
cursor: comments[0].createdAt,
node: commentStub,
cursor: commentStub.createdAt,
},
],
},
@@ -59,6 +61,7 @@ const assetStub = {
const resolvers = {
Query: {
comment: () => commentStub,
asset: () => assetStub,
},
};