Merge branch 'next' into pym-storage

This commit is contained in:
Chi Vinh Le
2018-09-05 23:27:59 +02:00
62 changed files with 2231 additions and 420 deletions
@@ -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();
});