Mark comments as always returning a value

This commit is contained in:
Chi Vinh Le
2018-07-10 19:14:42 -03:00
parent 8e87cba52f
commit ec1eff2b9d
5 changed files with 4 additions and 23 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ const config: Config = {
"core/client/stream/**/*.ts",
"core/client/stream/**/*.tsx",
"core/client/stream/**/*.graphql",
"core/client/server/**/*.graphql",
"core/server/**/*.graphql",
],
ignore: [
"core/**/*.d.ts",
@@ -18,19 +18,6 @@ it("renders correctly", () => {
expect(wrapper).toMatchSnapshot();
});
it("renders when comments is null", () => {
const props = {
assetID: "asset-id",
isClosed: false,
comments: null,
onLoadMore: noop,
disableLoadMore: false,
hasMore: false,
};
const wrapper = shallow(<Stream {...props} />);
expect(wrapper).toMatchSnapshot();
});
describe("when there is more", () => {
const props = {
assetID: "asset-id",
+1 -5
View File
@@ -12,17 +12,13 @@ import Logo from "./Logo";
export interface StreamProps {
assetID: string;
isClosed: boolean;
comments: ReadonlyArray<{ id: string }> | null;
comments: ReadonlyArray<{ id: string }>;
onLoadMore: () => void;
hasMore: boolean;
disableLoadMore: boolean;
}
const Stream: StatelessComponent<StreamProps> = props => {
if (props.comments === null) {
// TODO: (@cvle) What's the reason for this being null?
return <div>Comments unavailable</div>;
}
return (
<div>
<Logo gutterBottom />
@@ -22,9 +22,7 @@ export class StreamContainer extends React.Component<InnerProps> {
};
public render() {
const comments = this.props.asset.comments
? this.props.asset.comments.edges.map(edge => edge.node)
: null;
const comments = this.props.asset.comments.edges.map(edge => edge.node);
return (
<Stream
assetID={this.props.asset.id}
@@ -305,7 +305,7 @@ type Asset {
first: Int = 10
orderBy: COMMENT_SORT = CREATED_AT_DESC
after: Cursor
): CommentsConnection
): CommentsConnection!
"""
author is the authors listed in the meta tags for the Asset.