mirror of
https://github.com/wassname/talk.git
synced 2026-08-08 11:28:12 +08:00
Merge branch 'next' into pym-storage
This commit is contained in:
@@ -19,7 +19,7 @@ export type CreateCommentInput = Omit<
|
||||
const mutation = graphql`
|
||||
mutation CreateCommentMutation($input: CreateCommentInput!) {
|
||||
createComment(input: $input) {
|
||||
commentEdge {
|
||||
edge {
|
||||
cursor
|
||||
node {
|
||||
id
|
||||
@@ -51,7 +51,7 @@ function commit(environment: Environment, input: CreateCommentInput) {
|
||||
},
|
||||
optimisticResponse: {
|
||||
createComment: {
|
||||
commentEdge: {
|
||||
edge: {
|
||||
cursor: currentDate,
|
||||
node: {
|
||||
id: uuid(),
|
||||
@@ -77,7 +77,7 @@ function commit(environment: Environment, input: CreateCommentInput) {
|
||||
},
|
||||
],
|
||||
parentID: input.assetID,
|
||||
edgeName: "commentEdge",
|
||||
edgeName: "edge",
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
@@ -33,7 +33,8 @@ beforeEach(() => {
|
||||
},
|
||||
})
|
||||
.returns({
|
||||
commentEdge: {
|
||||
// TODO: add a type assertion here to ensure that if the type changes, that the test will fail
|
||||
edge: {
|
||||
cursor: "2018-07-06T18:24:00.000Z",
|
||||
node: {
|
||||
id: "comment-x",
|
||||
@@ -72,15 +73,19 @@ it("post a comment", async () => {
|
||||
.props.onChange({ html: "<strong>Hello world!</strong>" });
|
||||
|
||||
timekeeper.freeze(new Date("2018-07-06T18:24:00.000Z"));
|
||||
|
||||
testRenderer.root
|
||||
.findByProps({ id: "comments-postCommentForm-form" })
|
||||
.props.onSubmit();
|
||||
|
||||
timekeeper.reset();
|
||||
|
||||
// Test optimistic response.
|
||||
expect(testRenderer.toJSON()).toMatchSnapshot();
|
||||
timekeeper.reset();
|
||||
|
||||
// Wait for loading.
|
||||
await timeout();
|
||||
|
||||
// Test after server response.
|
||||
expect(testRenderer.toJSON()).toMatchSnapshot();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user