mirror of
https://github.com/wassname/talk.git
synced 2026-07-04 10:47:46 +08:00
Fix showAllReplies test
This commit is contained in:
@@ -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,
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user