fix: test updates

This commit is contained in:
Wyatt Johnson
2018-09-26 17:48:24 -06:00
parent 5acd19790a
commit bc447dbde0
21 changed files with 379 additions and 11 deletions
@@ -22,6 +22,12 @@ it("renders correctly", () => {
me: null,
localReply: false,
disableReplies: false,
settings: {
reaction: {
icon: "thumb_up_alt",
label: "Respect",
},
},
};
const wrapper = shallow(<ReplyListN {...props} />);
expect(wrapper).toMatchSnapshot();
@@ -37,6 +43,12 @@ describe("when there is more", () => {
disableShowAll: false,
indentLevel: 1,
me: null,
settings: {
reaction: {
icon: "thumb_up_alt",
label: "Respect",
},
},
};
const wrapper = shallow(<ReplyListN {...props} />);
@@ -17,6 +17,12 @@ it("renders correctly", () => {
isClosed: false,
},
comments: [{ id: "comment-1" }, { id: "comment-2" }],
settings: {
reaction: {
icon: "thumb_up_alt",
label: "Respect",
},
},
onLoadMore: noop,
disableLoadMore: false,
hasMore: false,
@@ -38,6 +44,12 @@ describe("when use is logged in", () => {
disableLoadMore: false,
hasMore: false,
me: {},
settings: {
reaction: {
icon: "thumb_up_alt",
label: "Respect",
},
},
};
const wrapper = shallow(<StreamN {...props} />);
expect(wrapper).toMatchSnapshot();
@@ -51,6 +63,12 @@ describe("when there is more", () => {
isClosed: false,
},
comments: [{ id: "comment-1" }, { id: "comment-2" }],
settings: {
reaction: {
icon: "thumb_up_alt",
label: "Respect",
},
},
onLoadMore: sinon.spy(),
disableLoadMore: false,
hasMore: true,
@@ -24,6 +24,14 @@ exports[`renders correctly 1`] = `
key="comment-1"
localReply={false}
me={null}
settings={
Object {
"reaction": Object {
"icon": "thumb_up_alt",
"label": "Respect",
},
}
}
/>
</withPropsOnChange(HorizontalGutter)>
<withPropsOnChange(HorizontalGutter)
@@ -45,6 +53,14 @@ exports[`renders correctly 1`] = `
key="comment-2"
localReply={false}
me={null}
settings={
Object {
"reaction": Object {
"icon": "thumb_up_alt",
"label": "Respect",
},
}
}
/>
</withPropsOnChange(HorizontalGutter)>
</withPropsOnChange(HorizontalGutter)>
@@ -72,6 +88,14 @@ exports[`when there is more disables load more button 1`] = `
indentLevel={1}
key="comment-1"
me={null}
settings={
Object {
"reaction": Object {
"icon": "thumb_up_alt",
"label": "Respect",
},
}
}
/>
</withPropsOnChange(HorizontalGutter)>
<withPropsOnChange(HorizontalGutter)
@@ -91,6 +115,14 @@ exports[`when there is more disables load more button 1`] = `
indentLevel={1}
key="comment-2"
me={null}
settings={
Object {
"reaction": Object {
"icon": "thumb_up_alt",
"label": "Respect",
},
}
}
/>
</withPropsOnChange(HorizontalGutter)>
<Indent
@@ -137,6 +169,14 @@ exports[`when there is more renders a load more button 1`] = `
indentLevel={1}
key="comment-1"
me={null}
settings={
Object {
"reaction": Object {
"icon": "thumb_up_alt",
"label": "Respect",
},
}
}
/>
</withPropsOnChange(HorizontalGutter)>
<withPropsOnChange(HorizontalGutter)
@@ -156,6 +196,14 @@ exports[`when there is more renders a load more button 1`] = `
indentLevel={1}
key="comment-2"
me={null}
settings={
Object {
"reaction": Object {
"icon": "thumb_up_alt",
"label": "Respect",
},
}
}
/>
</withPropsOnChange(HorizontalGutter)>
<Indent
@@ -34,6 +34,14 @@ exports[`renders correctly 1`] = `
}
}
me={null}
settings={
Object {
"reaction": Object {
"icon": "thumb_up_alt",
"label": "Respect",
},
}
}
/>
<withProps(Relay(ReplyListContainer))
asset={
@@ -48,6 +56,14 @@ exports[`renders correctly 1`] = `
}
}
me={null}
settings={
Object {
"reaction": Object {
"icon": "thumb_up_alt",
"label": "Respect",
},
}
}
/>
</withPropsOnChange(HorizontalGutter)>
<withPropsOnChange(HorizontalGutter)
@@ -66,6 +82,14 @@ exports[`renders correctly 1`] = `
}
}
me={null}
settings={
Object {
"reaction": Object {
"icon": "thumb_up_alt",
"label": "Respect",
},
}
}
/>
<withProps(Relay(ReplyListContainer))
asset={
@@ -80,6 +104,14 @@ exports[`renders correctly 1`] = `
}
}
me={null}
settings={
Object {
"reaction": Object {
"icon": "thumb_up_alt",
"label": "Respect",
},
}
}
/>
</withPropsOnChange(HorizontalGutter)>
</withPropsOnChange(HorizontalGutter)>
@@ -120,6 +152,14 @@ exports[`when there is more disables load more button 1`] = `
}
}
me={null}
settings={
Object {
"reaction": Object {
"icon": "thumb_up_alt",
"label": "Respect",
},
}
}
/>
<withProps(Relay(ReplyListContainer))
asset={
@@ -134,6 +174,14 @@ exports[`when there is more disables load more button 1`] = `
}
}
me={null}
settings={
Object {
"reaction": Object {
"icon": "thumb_up_alt",
"label": "Respect",
},
}
}
/>
</withPropsOnChange(HorizontalGutter)>
<withPropsOnChange(HorizontalGutter)
@@ -152,6 +200,14 @@ exports[`when there is more disables load more button 1`] = `
}
}
me={null}
settings={
Object {
"reaction": Object {
"icon": "thumb_up_alt",
"label": "Respect",
},
}
}
/>
<withProps(Relay(ReplyListContainer))
asset={
@@ -166,6 +222,14 @@ exports[`when there is more disables load more button 1`] = `
}
}
me={null}
settings={
Object {
"reaction": Object {
"icon": "thumb_up_alt",
"label": "Respect",
},
}
}
/>
</withPropsOnChange(HorizontalGutter)>
<Localized
@@ -220,6 +284,14 @@ exports[`when there is more renders a load more button 1`] = `
}
}
me={null}
settings={
Object {
"reaction": Object {
"icon": "thumb_up_alt",
"label": "Respect",
},
}
}
/>
<withProps(Relay(ReplyListContainer))
asset={
@@ -234,6 +306,14 @@ exports[`when there is more renders a load more button 1`] = `
}
}
me={null}
settings={
Object {
"reaction": Object {
"icon": "thumb_up_alt",
"label": "Respect",
},
}
}
/>
</withPropsOnChange(HorizontalGutter)>
<withPropsOnChange(HorizontalGutter)
@@ -252,6 +332,14 @@ exports[`when there is more renders a load more button 1`] = `
}
}
me={null}
settings={
Object {
"reaction": Object {
"icon": "thumb_up_alt",
"label": "Respect",
},
}
}
/>
<withProps(Relay(ReplyListContainer))
asset={
@@ -266,6 +354,14 @@ exports[`when there is more renders a load more button 1`] = `
}
}
me={null}
settings={
Object {
"reaction": Object {
"icon": "thumb_up_alt",
"label": "Respect",
},
}
}
/>
</withPropsOnChange(HorizontalGutter)>
<Localized
@@ -322,6 +418,14 @@ exports[`when use is logged in renders correctly 1`] = `
}
}
me={Object {}}
settings={
Object {
"reaction": Object {
"icon": "thumb_up_alt",
"label": "Respect",
},
}
}
/>
<withProps(Relay(ReplyListContainer))
asset={
@@ -336,6 +440,14 @@ exports[`when use is logged in renders correctly 1`] = `
}
}
me={Object {}}
settings={
Object {
"reaction": Object {
"icon": "thumb_up_alt",
"label": "Respect",
},
}
}
/>
</withPropsOnChange(HorizontalGutter)>
<withPropsOnChange(HorizontalGutter)
@@ -354,6 +466,14 @@ exports[`when use is logged in renders correctly 1`] = `
}
}
me={Object {}}
settings={
Object {
"reaction": Object {
"icon": "thumb_up_alt",
"label": "Respect",
},
}
}
/>
<withProps(Relay(ReplyListContainer))
asset={
@@ -368,6 +488,14 @@ exports[`when use is logged in renders correctly 1`] = `
}
}
me={Object {}}
settings={
Object {
"reaction": Object {
"icon": "thumb_up_alt",
"label": "Respect",
},
}
}
/>
</withPropsOnChange(HorizontalGutter)>
</withPropsOnChange(HorizontalGutter)>
@@ -30,6 +30,12 @@ it("renders username and body", () => {
},
pending: false,
},
settings: {
reaction: {
icon: "thumb_up_alt",
label: "Respect",
},
},
indentLevel: 1,
showAuthPopup: noop as any,
localReply: false,
@@ -60,6 +66,12 @@ it("renders body only", () => {
},
pending: false,
},
settings: {
reaction: {
icon: "thumb_up_alt",
label: "Respect",
},
},
indentLevel: 1,
showAuthPopup: noop as any,
};
@@ -88,6 +100,12 @@ it("hide reply button", () => {
},
pending: false,
},
settings: {
reaction: {
icon: "thumb_up_alt",
label: "Respect",
},
},
indentLevel: 1,
showAuthPopup: noop as any,
localReply: false,
@@ -22,6 +22,12 @@ it("renders correctly", () => {
edges: [{ node: { id: "comment-1" } }, { node: { id: "comment-2" } }],
},
},
settings: {
reaction: {
icon: "thumb_up_alt",
label: "Respect",
},
},
relay: {
hasMore: noop,
isLoading: noop,
@@ -49,6 +55,12 @@ it("renders correctly when replies are empty", () => {
isLoading: noop,
} as any,
me: null,
settings: {
reaction: {
icon: "thumb_up_alt",
label: "Respect",
},
},
indentLevel: 1,
ReplyListComponent: undefined,
localReply: false,
@@ -69,6 +81,12 @@ describe("when has more replies", () => {
edges: [{ node: { id: "comment-1" } }, { node: { id: "comment-2" } }],
},
},
settings: {
reaction: {
icon: "thumb_up_alt",
label: "Respect",
},
},
relay: {
hasMore: () => true,
isLoading: () => false,
@@ -21,6 +21,12 @@ it("renders correctly", () => {
},
},
me: null,
settings: {
reaction: {
icon: "thumb_up_alt",
label: "Respect",
},
},
relay: {
hasMore: noop,
isLoading: noop,
@@ -41,6 +47,12 @@ describe("when has more comments", () => {
},
},
me: null,
settings: {
reaction: {
icon: "thumb_up_alt",
label: "Respect",
},
},
relay: {
hasMore: () => true,
isLoading: () => false,
@@ -42,6 +42,14 @@ exports[`renders correctly 1`] = `
localReply={false}
me={null}
onShowAll={[Function]}
settings={
Object {
"reaction": Object {
"icon": "thumb_up_alt",
"label": "Respect",
},
}
}
/>
`;
@@ -89,6 +97,14 @@ exports[`when has more replies renders hasMore 1`] = `
localReply={false}
me={null}
onShowAll={[Function]}
settings={
Object {
"reaction": Object {
"icon": "thumb_up_alt",
"label": "Respect",
},
}
}
/>
`;
@@ -134,6 +150,14 @@ exports[`when has more replies when showing all disables show all button 1`] = `
localReply={false}
me={null}
onShowAll={[Function]}
settings={
Object {
"reaction": Object {
"icon": "thumb_up_alt",
"label": "Respect",
},
}
}
/>
`;
@@ -179,5 +203,13 @@ exports[`when has more replies when showing all enable show all button after loa
localReply={false}
me={null}
onShowAll={[Function]}
settings={
Object {
"reaction": Object {
"icon": "thumb_up_alt",
"label": "Respect",
},
}
}
/>
`;
@@ -35,6 +35,14 @@ exports[`renders correctly 1`] = `
disableLoadMore={false}
me={null}
onLoadMore={[Function]}
settings={
Object {
"reaction": Object {
"icon": "thumb_up_alt",
"label": "Respect",
},
}
}
/>
`;
@@ -74,6 +82,14 @@ exports[`when has more comments renders hasMore 1`] = `
hasMore={true}
me={null}
onLoadMore={[Function]}
settings={
Object {
"reaction": Object {
"icon": "thumb_up_alt",
"label": "Respect",
},
}
}
/>
`;
@@ -113,6 +129,14 @@ exports[`when has more comments when loading more disables load more button 1`]
hasMore={true}
me={null}
onLoadMore={[Function]}
settings={
Object {
"reaction": Object {
"icon": "thumb_up_alt",
"label": "Respect",
},
}
}
/>
`;
@@ -152,5 +176,13 @@ exports[`when has more comments when loading more enable load more button after
hasMore={true}
me={null}
onLoadMore={[Function]}
settings={
Object {
"reaction": Object {
"icon": "thumb_up_alt",
"label": "Respect",
},
}
}
/>
`;
@@ -3,7 +3,7 @@ import timekeeper from "timekeeper";
import { timeout } from "talk-common/utils";
import { createSinonStub } from "talk-framework/testHelpers";
import { assets, users } from "../fixtures";
import { assets, settings, users } from "../fixtures";
import create from "./create";
function createTestRenderer() {
@@ -20,6 +20,10 @@ function createTestRenderer() {
s => s.throws(),
s => s.withArgs(undefined).returns(users[0])
),
settings: createSinonStub(
s => s.throws(),
s => s.withArgs(undefined).returns(settings)
),
},
Mutation: {
editComment: createSinonStub(
@@ -4,7 +4,7 @@ import sinon from "sinon";
import { timeout } from "talk-common/utils";
import { createSinonStub } from "talk-framework/testHelpers";
import { assets, comments } from "../fixtures";
import { assets, comments, settings } from "../fixtures";
import create from "./create";
let testRenderer: ReactTestRenderer;
@@ -66,6 +66,10 @@ beforeEach(() => {
)
.returns(assetStub)
),
settings: createSinonStub(
s => s.throws(),
s => s.withArgs(undefined).returns(settings)
),
},
};
@@ -4,7 +4,7 @@ import sinon from "sinon";
import { timeout } from "talk-common/utils";
import { createSinonStub } from "talk-framework/testHelpers";
import { assets, comments } from "../fixtures";
import { assets, comments, settings } from "../fixtures";
import create from "./create";
let testRenderer: ReactTestRenderer;
@@ -41,6 +41,10 @@ beforeEach(() => {
.withArgs(undefined, { id: assetStub.id, url: null })
.returns(assetStub)
),
settings: createSinonStub(
s => s.throws(),
s => s.withArgs(undefined).returns(settings)
),
},
};
@@ -1,7 +1,9 @@
import { ReactTestRenderer } from "react-test-renderer";
import { timeout } from "talk-common/utils";
import { createSinonStub } from "talk-framework/testHelpers";
import { settings } from "../fixtures";
import create from "./create";
let testRenderer: ReactTestRenderer;
@@ -10,6 +12,10 @@ beforeEach(() => {
Query: {
comment: () => null,
asset: () => null,
settings: createSinonStub(
s => s.throws(),
s => s.withArgs(undefined).returns(settings)
),
},
};
@@ -4,7 +4,7 @@ import sinon from "sinon";
import { timeout } from "talk-common/utils";
import { createSinonStub } from "talk-framework/testHelpers";
import { assets, comments } from "../fixtures";
import { assets, comments, settings } from "../fixtures";
import create from "./create";
let testRenderer: ReactTestRenderer;
@@ -38,6 +38,10 @@ beforeEach(() => {
.withArgs(undefined, { id: assetStub.id, url: null })
.returns(assetStub)
),
settings: createSinonStub(
s => s.throws(),
s => s.withArgs(undefined).returns(settings)
),
},
};
@@ -4,7 +4,7 @@ import timekeeper from "timekeeper";
import { timeout } from "talk-common/utils";
import { createSinonStub } from "talk-framework/testHelpers";
import { assets, users } from "../fixtures";
import { assets, settings, users } from "../fixtures";
import create from "./create";
let testRenderer: ReactTestRenderer;
@@ -13,6 +13,10 @@ beforeEach(() => {
Query: {
asset: createSinonStub(s => s.throws(), s => s.returns(assets[0])),
me: createSinonStub(s => s.throws(), s => s.returns(users[0])),
settings: createSinonStub(
s => s.throws(),
s => s.withArgs(undefined).returns(settings)
),
},
Mutation: {
createComment: createSinonStub(
@@ -4,7 +4,7 @@ import timekeeper from "timekeeper";
import { timeout } from "talk-common/utils";
import { createSinonStub } from "talk-framework/testHelpers";
import { assetWithDeepestReplies, users } from "../fixtures";
import { assetWithDeepestReplies, settings, users } from "../fixtures";
import create from "./create";
let testRenderer: ReactTestRenderer;
@@ -16,6 +16,7 @@ beforeEach(() => {
s => s.returns(assetWithDeepestReplies)
),
me: createSinonStub(s => s.throws(), s => s.returns(users[0])),
settings: createSinonStub(s => s.returns(settings)),
},
Mutation: {
createComment: createSinonStub(
@@ -61,7 +62,7 @@ beforeEach(() => {
({ testRenderer } = create({
// Set this to true, to see graphql responses.
logNetwork: false,
logNetwork: true,
resolvers,
initLocalState: localRecord => {
localRecord.setValue(assetWithDeepestReplies.id, "assetID");
@@ -4,7 +4,7 @@ import timekeeper from "timekeeper";
import { timeout } from "talk-common/utils";
import { createSinonStub } from "talk-framework/testHelpers";
import { assets, users } from "../fixtures";
import { assets, settings, users } from "../fixtures";
import create from "./create";
let testRenderer: ReactTestRenderer;
@@ -13,6 +13,10 @@ beforeEach(() => {
Query: {
asset: createSinonStub(s => s.throws(), s => s.returns(assets[0])),
me: createSinonStub(s => s.throws(), s => s.returns(users[0])),
settings: createSinonStub(
s => s.throws(),
s => s.withArgs(undefined).returns(settings)
),
},
Mutation: {
createComment: createSinonStub(
@@ -3,7 +3,7 @@ import { ReactTestRenderer } from "react-test-renderer";
import { timeout } from "talk-common/utils";
import { createSinonStub } from "talk-framework/testHelpers";
import { assetWithDeepReplies } from "../fixtures";
import { assetWithDeepReplies, settings } from "../fixtures";
import create from "./create";
let testRenderer: ReactTestRenderer;
@@ -17,6 +17,10 @@ beforeEach(() => {
.withArgs(undefined, { id: assetWithDeepReplies.id, url: null })
.returns(assetWithDeepReplies)
),
settings: createSinonStub(
s => s.throws(),
s => s.withArgs(undefined).returns(settings)
),
},
};
@@ -3,7 +3,7 @@ import { ReactTestRenderer } from "react-test-renderer";
import { timeout } from "talk-common/utils";
import { createSinonStub } from "talk-framework/testHelpers";
import { assets } from "../fixtures";
import { assets, settings } from "../fixtures";
import create from "./create";
let testRenderer: ReactTestRenderer;
@@ -17,6 +17,10 @@ beforeEach(() => {
.withArgs(undefined, { id: assets[0].id, url: null })
.returns(assets[0])
),
settings: createSinonStub(
s => s.throws(),
s => s.withArgs(undefined).returns(settings)
),
},
};
@@ -4,7 +4,7 @@ import sinon from "sinon";
import { timeout } from "talk-common/utils";
import { createSinonStub } from "talk-framework/testHelpers";
import { assets, comments } from "../fixtures";
import { assets, comments, settings } from "../fixtures";
import create from "./create";
let testRenderer: ReactTestRenderer;
@@ -76,6 +76,10 @@ beforeEach(() => {
.withArgs(undefined, { id: assetStub.id, url: null })
.returns(assetStub)
),
settings: createSinonStub(
s => s.throws(),
s => s.withArgs(undefined).returns(settings)
),
},
};
+7
View File
@@ -1,3 +1,10 @@
export const settings = {
reaction: {
icon: "thumb_up_alt",
label: "Respect",
},
};
export const users = [
{
id: "user-0",