Keep time!

This commit is contained in:
Chi Vinh Le
2018-08-31 18:34:00 +02:00
parent 51e6d5b29e
commit a4002b262b
4 changed files with 13 additions and 3 deletions
@@ -194,10 +194,10 @@ exports[`post a comment 1`] = `
</span>
<time
className="Timestamp-root RelativeTime-root"
dateTime="2018-08-31T16:14:09.617Z"
title="2018-08-31T16:14:09.617Z"
dateTime="2018-07-06T18:24:00.002Z"
title="2018-07-06T18:24:00.002Z"
>
2018-08-31T16:14:09.617Z
2018-07-06T18:24:00.002Z
</time>
</div>
<div
@@ -1,6 +1,7 @@
import React from "react";
import TestRenderer, { ReactTestRenderer } from "react-test-renderer";
import { RecordProxy } from "relay-runtime";
import timekeeper from "timekeeper";
import { timeout } from "talk-common/utils";
import { TalkContext, TalkContextProvider } from "talk-framework/lib/bootstrap";
@@ -94,11 +95,13 @@ it("post a comment", async () => {
.findByProps({ inputId: "comments-postCommentForm-field" })
.props.onChange({ html: "<strong>Hello world!</strong>" });
timekeeper.travel(new Date("2018-07-06T18:24:00.000Z"));
testRenderer.root
.findByProps({ id: "comments-postCommentForm-form" })
.props.onSubmit();
// Test optimistic response.
expect(testRenderer.toJSON()).toMatchSnapshot();
timekeeper.reset();
// Wait for loading.
await timeout();