Skip to content

Commit

Permalink
Revert "restore reverted test"
Browse files Browse the repository at this point in the history
This reverts commit 0060ebb.
  • Loading branch information
marcushaddon committed Sep 12, 2023
1 parent 0060ebb commit d9b6015
Showing 1 changed file with 0 additions and 124 deletions.
124 changes: 0 additions & 124 deletions client/src/core/client/admin/test/moderate/regularQueue.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1007,127 +1007,3 @@ it("doesnt show comments from banned users whose commens have been rejected", as
).toBeNull();
});
});

it("filters comments in queue by site", async () => {
const commentsResoverStub =
createQueryResolverStub<ModerationQueueToCommentsResolver>(
({ variables, callCount }) => {
switch (callCount) {
case 0:
expectAndFail(variables).toEqual({
first: 5,
orderBy: "CREATED_AT_DESC",
});
return {
edges: [
{
node: reportedComments[0],
cursor: reportedComments[0].createdAt,
},
{
node: reportedComments[1],
cursor: reportedComments[1].createdAt,
},
],
pageInfo: {
endCursor: reportedComments[1].createdAt,
hasNextPage: true,
},
};
default:
expectAndFail(variables).toEqual({
first: 10,
query: "second",
orderBy: "CREATED_AT_DESC",
});
return {
pageInfo: {
endCursor: reportedComments[2].createdAt,
hasNextPage: false,
},
};
}
}
) as any;
const moderationQueuesStub = pureMerge(emptyModerationQueues, {
reported: {
count: 2,
comments: commentsResoverStub,
},
});

const sitesResolverStub = createQueryResolverStub<QueryToSitesResolver>(
({ variables, callCount }) => {
switch (callCount) {
case 0:
return siteConnection;
default:
expectAndFail(variables).toEqual({
first: 10,
after: null,
query: "third",
});

return {
edges: [
{
cursor: "1",
node: {
...sites[0],
id: "site-3",
name: "Third Site",
},
},
],
pageInfo: {
hasNextPage: false,
},
};
}
}
);

await act(async () => {
await createTestRenderer({
resolvers: createResolversStub<GQLResolver>({
Query: {
moderationQueues: () => moderationQueuesStub,
sites: sitesResolverStub,
settings: () => settingsWithMultisite,
},
}),
});
});

const searchBarContainer = await screen.findByTestId(
"moderate-searchBar-container"
);

const siteSelector = await within(searchBarContainer).findByLabelText(
"Select site",
{ exact: false }
);
expect(siteSelector).toBeInTheDocument();

userEvent.click(siteSelector);

expect(
await within(siteSelector).findByLabelText("Filter results")
).toBeVisible();

const dropDown = screen.getByRole("dialog");
expect(dropDown).toBeVisible();

const textInput = await within(siteSelector).findByLabelText(
"Filter results"
);
expect(textInput).toHaveFocus();

await act(async () => {
userEvent.type(textInput, "third");
await new Promise((res) => setTimeout(res, 3000));
});

expect(within(dropDown).queryByText("Test Site")).toBeNull();
expect(within(dropDown).queryByText("Third Site")).toBeInTheDocument();
});

0 comments on commit d9b6015

Please sign in to comment.