Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CORL-2882] Fix flaky and slow CommentContainer tests #4317

Merged
merged 2 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
import {
commenters,
settings,
singleCommentStory,
stories,
storyWithDeletedComments,
storyWithReplies,
Expand Down Expand Up @@ -51,9 +52,16 @@ async function createTestRenderer(
afterEach(jest.clearAllMocks);

it("renders username and body", async () => {
const { container } = await createTestRenderer();
const { container } = await createTestRenderer({
resolvers: {
Query: {
story: () => singleCommentStory,
stream: () => singleCommentStory,
},
},
});

const firstComment = stories[0].comments.edges[0].node;
const firstComment = singleCommentStory.comments.edges[0].node;
const commentElement = await within(container).findByTestId(
`comment-${firstComment.id}`
);
Expand Down
13 changes: 13 additions & 0 deletions src/core/client/stream/test/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,19 @@ export const commentsFromStaff = denormalizeComments(
)
);

export const singleCommentStory = denormalizeStory(
createFixture<GQLStory>(
{
id: "story-1",
url: "http://localhost/stories/story-1",
comments: {
edges: [{ node: comments[0], cursor: comments[0].createdAt }],
},
},
baseStory
)
);

export const stories = denormalizeStories(
createFixtures<GQLStory>(
[
Expand Down
Loading