mirror of
https://github.com/wassname/talk.git
synced 2026-08-19 12:40:16 +08:00
[CORL-878] Upgrade dependencies (#2867)
* chore: upgrade fluent * chore: upgrade metascraper * chore: upgrade akismet-api * chore: upgrade apollo-server-express * chore: upgrade archiver * chore: upgrade bull * chore: upgrade express, cheerio, content-security-policy-builder * chore: upgrade convict * chore: upgrade cors, cron * chore: upgrade csv-stringify * chore: upgrade dompurify * chore: upgrade dotenv * chore: upgrade express-static-gzip * chore: upgrade fs-extra * chore: upgrade graphql-js * chore: upgrade graphql packages * chore: upgrade html-minifier * chore: upgrade html-to-text * chore: upgrade ioredis * chore: upgrade joi * chore: upgrade jsdom * chore: upgrade jsonwebtoken * chore: upgrade juice * chore: upgrade jwks-rsa ad linkifyjs * chore: upgrade lodash * chore: upgrade luxon * chore: upgrade metascraper * chore: upgrade mongodb * chore: upgrade ms * chore: upgrade node and node-fetch types * chore: upgrade nodemailer nunjucks and typescript-eslint * chore: Upgrade passport * upgrade: prom-client react-helmet source-map-support stack-utils * chore: upgrade uuid * chore: upgrade @babel packages * chore: upgrade types * chore: upgrade autoprefixer * chore: upgrade jest * chore: upgrade ts-jest * chore: remove linkify.d.ts * chore: upgrade bowser * chore: case-sensitive-paths-webpack-plugin * chore: upgrade classnames * chore: upgrade commander * chore: upgrade comment-json * chore: upgrade cross-spawn compression-webpack-plugin del * chore: upgrade build and watch related dependencies * chore: upgrade css-vars-ponyfill * chore: upgrade eslint and css-vars-ponyfill * chore: upgrade enzyme and eventemitter2 * fix: form bug * chore: upgrade farce * chore: upgrade final form * chore: upgrade react-popper * chore: upgrade flat and fork-ts-checker-webpack-plugin * chore: upgrade husky and gulp related, intersection observer * chore: upgrade lint-staged * chore: upgrade marked, loader-utils, mini-css-extract-plugin * chore: upgrade postcss-nested, proxy-polyfill, pstree.remy * chore: upgrade prettier * chore: fix prettier changes, upgrade react * chore: mute createFactory deprecated message * chore: upgrade react-copy-to-clipbard, react-axe, react-dom, react-test-renderer, react-timeago * chore: upgrade react-transistion-group, react-responsive * chore: upgrade types * chore: upgrade react-dev-utils, react-error-overlay regenerator-runtime * chore: upgrade types, sinon, sockjs-client, strip-ansi * chore: upgrade types, fonts * chore: upgrade nunjucks, ts-node, typescript-snapshot-plugin, wait-for-expect * chore: upgrade eslint packages * chore: upgrade fluent, types * chore: upgrade jsdom dep * chore: upgrade mongo * chore: upgrade deps * chore: upgrade typescript, recompose * chore: upgrade prettier * chore: remove obsolete prettier config * chore: upgrade jsdom types * chore: upgrade typescript-eslint * chore: upgrad deps * chore: upgrade deps * chore: upgrade relay related modules * chore: upgrade docz WIP * chore: upgrade docz * chore: add guard * chore: remove obsolete line * chore: comment * chore: refactors * fix: hook count change error
This commit is contained in:
@@ -456,12 +456,11 @@ exports[`shows server error 1`] = `
|
||||
>
|
||||
server error
|
||||
|
||||
GraphQL request (4:3)
|
||||
3: ) {
|
||||
4: setEmail(input: $input) {
|
||||
^
|
||||
5: user {
|
||||
|
||||
GraphQL request:4:3
|
||||
3 | ) {
|
||||
4 | setEmail(input: $input) {
|
||||
| ^
|
||||
5 | user {
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
|
||||
@@ -345,12 +345,11 @@ we require users to create a password.
|
||||
>
|
||||
server error
|
||||
|
||||
GraphQL request (4:3)
|
||||
3: ) {
|
||||
4: setPassword(input: $input) {
|
||||
^
|
||||
5: user {
|
||||
|
||||
GraphQL request:4:3
|
||||
3 | ) {
|
||||
4 | setPassword(input: $input) {
|
||||
| ^
|
||||
5 | user {
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
|
||||
@@ -269,12 +269,11 @@ exports[`shows server error 1`] = `
|
||||
>
|
||||
server error
|
||||
|
||||
GraphQL request (4:3)
|
||||
3: ) {
|
||||
4: setUsername(input: $input) {
|
||||
^
|
||||
5: user {
|
||||
|
||||
GraphQL request:4:3
|
||||
3 | ) {
|
||||
4 | setUsername(input: $input) {
|
||||
| ^
|
||||
5 | user {
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
|
||||
@@ -156,7 +156,7 @@ it("shows server error", async () => {
|
||||
muteNetworkErrors: true,
|
||||
});
|
||||
const submitButton = form.find(
|
||||
i => i.type === "button" && i.props.type === "submit"
|
||||
(i) => i.type === "button" && i.props.type === "submit"
|
||||
);
|
||||
|
||||
act(() => emailAddressField.props.onChange({ target: { value: email } }));
|
||||
@@ -207,7 +207,7 @@ it("successfully sets email", async () => {
|
||||
resolvers,
|
||||
});
|
||||
const submitButton = form.find(
|
||||
i => i.type === "button" && i.props.type === "submit"
|
||||
(i) => i.type === "button" && i.props.type === "submit"
|
||||
);
|
||||
|
||||
act(() => emailAddressField.props.onChange({ target: { value: email } }));
|
||||
@@ -253,7 +253,7 @@ it("switch to link account", async () => {
|
||||
muteNetworkErrors: true,
|
||||
});
|
||||
const submitButton = form.find(
|
||||
i => i.type === "button" && i.props.type === "submit"
|
||||
(i) => i.type === "button" && i.props.type === "submit"
|
||||
);
|
||||
|
||||
act(() => emailAddressField.props.onChange({ target: { value: email } }));
|
||||
|
||||
@@ -113,7 +113,7 @@ it("shows server error", async () => {
|
||||
muteNetworkErrors: true,
|
||||
});
|
||||
const submitButton = form.find(
|
||||
i => i.type === "button" && i.props.type === "submit"
|
||||
(i) => i.type === "button" && i.props.type === "submit"
|
||||
);
|
||||
|
||||
act(() => passwordField.props.onChange({ target: { value: password } }));
|
||||
@@ -153,7 +153,7 @@ it("successfully sets password", async () => {
|
||||
resolvers,
|
||||
});
|
||||
const submitButton = form.find(
|
||||
i => i.type === "button" && i.props.type === "submit"
|
||||
(i) => i.type === "button" && i.props.type === "submit"
|
||||
);
|
||||
|
||||
act(() => passwordField.props.onChange({ target: { value: password } }));
|
||||
|
||||
@@ -107,7 +107,7 @@ it("shows server error", async () => {
|
||||
muteNetworkErrors: true,
|
||||
});
|
||||
const submitButton = form.find(
|
||||
i => i.type === "button" && i.props.type === "submit"
|
||||
(i) => i.type === "button" && i.props.type === "submit"
|
||||
);
|
||||
|
||||
act(() => usernameField.props.onChange({ target: { value: username } }));
|
||||
@@ -148,7 +148,7 @@ it("successfully sets username", async () => {
|
||||
resolvers,
|
||||
});
|
||||
const submitButton = form.find(
|
||||
i => i.type === "button" && i.props.type === "submit"
|
||||
(i) => i.type === "button" && i.props.type === "submit"
|
||||
);
|
||||
|
||||
act(() => usernameField.props.onChange({ target: { value: username } }));
|
||||
|
||||
@@ -62,7 +62,6 @@ async function createTestRenderer(
|
||||
it("renders link account view", async () => {
|
||||
const { testRenderer } = await createTestRenderer();
|
||||
expect(testRenderer.toJSON()).toMatchSnapshot();
|
||||
expect(await within(testRenderer.root).axe()).toHaveNoViolations();
|
||||
});
|
||||
|
||||
it("checks for required password", async () => {
|
||||
|
||||
@@ -66,7 +66,7 @@ it("redirect when already logged in", async () => {
|
||||
|
||||
it("redirect to redirectPath when already logged in", async () => {
|
||||
await createTestRenderer({
|
||||
initLocalState: localRecord => {
|
||||
initLocalState: (localRecord) => {
|
||||
localRecord.setValue("/admin/moderate/pending", "redirectPath");
|
||||
},
|
||||
});
|
||||
|
||||
@@ -95,9 +95,7 @@ it("sign out when clicking on sign in as", async () => {
|
||||
.once()
|
||||
.returns({});
|
||||
|
||||
within(authBox)
|
||||
.getByText("Sign in with a different account")
|
||||
.props.onClick();
|
||||
within(authBox).getByText("Sign in with a different account").props.onClick();
|
||||
|
||||
await wait(() => {
|
||||
expect(lookup(context.relayEnvironment, LOCAL_ID)!.redirectPath).toBe(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import TestRenderer from "react-test-renderer";
|
||||
import uuid from "uuid/v1";
|
||||
import { v1 as uuid } from "uuid";
|
||||
|
||||
import { pureMerge } from "coral-common/utils";
|
||||
import {
|
||||
@@ -91,9 +91,7 @@ it("renders the invite button when clicked", async () => {
|
||||
const { container } = await createTestRenderer();
|
||||
|
||||
await act(async () =>
|
||||
within(container)
|
||||
.getByTestID("invite-users-button")
|
||||
.props.onClick()
|
||||
within(container).getByTestID("invite-users-button").props.onClick()
|
||||
);
|
||||
|
||||
expect(within(container).getByTestID("invite-users-modal")).toBeDefined();
|
||||
@@ -241,9 +239,7 @@ it("change user role", async () => {
|
||||
});
|
||||
|
||||
act(() => {
|
||||
within(userRow)
|
||||
.getByLabelText("Change role")
|
||||
.props.onClick();
|
||||
within(userRow).getByLabelText("Change role").props.onClick();
|
||||
});
|
||||
|
||||
const popup = within(userRow).getByLabelText(
|
||||
@@ -251,9 +247,7 @@ it("change user role", async () => {
|
||||
);
|
||||
|
||||
act(() => {
|
||||
within(popup)
|
||||
.getByText("Staff", { selector: "button" })
|
||||
.props.onClick();
|
||||
within(popup).getByText("Staff", { selector: "button" }).props.onClick();
|
||||
});
|
||||
|
||||
within(userRow).getByText("Staff");
|
||||
@@ -393,7 +387,7 @@ it("filter by status", async () => {
|
||||
|
||||
it("can't change staff, moderator and admin status", async () => {
|
||||
const { container } = await createTestRenderer();
|
||||
["Admin", "Moderator", "Staff"].forEach(role => {
|
||||
["Admin", "Moderator", "Staff"].forEach((role) => {
|
||||
const viewerRow = within(container).getByText(role, {
|
||||
selector: "tr",
|
||||
});
|
||||
@@ -434,9 +428,7 @@ it("suspend user", async () => {
|
||||
});
|
||||
|
||||
TestRenderer.act(() => {
|
||||
within(userRow)
|
||||
.getByLabelText("Change user status")
|
||||
.props.onClick();
|
||||
within(userRow).getByLabelText("Change user status").props.onClick();
|
||||
});
|
||||
|
||||
const popup = within(userRow).getByLabelText(
|
||||
@@ -444,9 +436,7 @@ it("suspend user", async () => {
|
||||
);
|
||||
|
||||
TestRenderer.act(() => {
|
||||
within(popup)
|
||||
.getByText("Suspend", { selector: "button" })
|
||||
.props.onClick();
|
||||
within(popup).getByText("Suspend", { selector: "button" }).props.onClick();
|
||||
});
|
||||
|
||||
const modal = within(testRenderer.root).getByLabelText("Suspend", {
|
||||
@@ -454,9 +444,7 @@ it("suspend user", async () => {
|
||||
});
|
||||
|
||||
TestRenderer.act(() => {
|
||||
within(modal)
|
||||
.getByType("form")
|
||||
.props.onSubmit();
|
||||
within(modal).getByType("form").props.onSubmit();
|
||||
});
|
||||
within(userRow).getByText("Suspended");
|
||||
expect(resolvers.Mutation!.suspendUser!.called).toBe(true);
|
||||
@@ -503,9 +491,7 @@ it("remove user suspension", async () => {
|
||||
});
|
||||
|
||||
TestRenderer.act(() => {
|
||||
within(userRow)
|
||||
.getByLabelText("Change user status")
|
||||
.props.onClick();
|
||||
within(userRow).getByLabelText("Change user status").props.onClick();
|
||||
});
|
||||
|
||||
const popup = within(userRow).getByLabelText(
|
||||
@@ -554,9 +540,7 @@ it("suspend user with custom timeout", async () => {
|
||||
});
|
||||
|
||||
TestRenderer.act(() => {
|
||||
within(userRow)
|
||||
.getByLabelText("Change user status")
|
||||
.props.onClick();
|
||||
within(userRow).getByLabelText("Change user status").props.onClick();
|
||||
});
|
||||
|
||||
const popup = within(userRow).getByLabelText(
|
||||
@@ -564,9 +548,7 @@ it("suspend user with custom timeout", async () => {
|
||||
);
|
||||
|
||||
TestRenderer.act(() => {
|
||||
within(popup)
|
||||
.getByText("Suspend", { selector: "button" })
|
||||
.props.onClick();
|
||||
within(popup).getByText("Suspend", { selector: "button" }).props.onClick();
|
||||
});
|
||||
|
||||
const modal = within(testRenderer.root).getByLabelText("Suspend", {
|
||||
@@ -580,9 +562,7 @@ it("suspend user with custom timeout", async () => {
|
||||
});
|
||||
|
||||
TestRenderer.act(() => {
|
||||
within(modal)
|
||||
.getByType("form")
|
||||
.props.onSubmit();
|
||||
within(modal).getByType("form").props.onSubmit();
|
||||
});
|
||||
within(userRow).getByText("Suspended");
|
||||
expect(resolvers.Mutation!.suspendUser!.called).toBe(true);
|
||||
@@ -620,9 +600,7 @@ it("suspend user with custom message", async () => {
|
||||
});
|
||||
|
||||
TestRenderer.act(() => {
|
||||
within(userRow)
|
||||
.getByLabelText("Change user status")
|
||||
.props.onClick();
|
||||
within(userRow).getByLabelText("Change user status").props.onClick();
|
||||
});
|
||||
|
||||
const popup = within(userRow).getByLabelText(
|
||||
@@ -630,9 +608,7 @@ it("suspend user with custom message", async () => {
|
||||
);
|
||||
|
||||
TestRenderer.act(() => {
|
||||
within(popup)
|
||||
.getByText("Suspend", { selector: "button" })
|
||||
.props.onClick();
|
||||
within(popup).getByText("Suspend", { selector: "button" }).props.onClick();
|
||||
});
|
||||
|
||||
const modal = within(testRenderer.root).getByLabelText("Suspend", {
|
||||
@@ -652,9 +628,7 @@ it("suspend user with custom message", async () => {
|
||||
});
|
||||
|
||||
TestRenderer.act(() => {
|
||||
within(modal)
|
||||
.getByType("form")
|
||||
.props.onSubmit();
|
||||
within(modal).getByType("form").props.onSubmit();
|
||||
});
|
||||
|
||||
within(userRow).getByText("Suspended");
|
||||
@@ -692,9 +666,7 @@ it("ban user", async () => {
|
||||
});
|
||||
|
||||
TestRenderer.act(() => {
|
||||
within(userRow)
|
||||
.getByLabelText("Change user status")
|
||||
.props.onClick();
|
||||
within(userRow).getByLabelText("Change user status").props.onClick();
|
||||
});
|
||||
|
||||
const popup = within(userRow).getByLabelText(
|
||||
@@ -702,9 +674,7 @@ it("ban user", async () => {
|
||||
);
|
||||
|
||||
TestRenderer.act(() => {
|
||||
within(popup)
|
||||
.getByText("Ban", { selector: "button" })
|
||||
.props.onClick();
|
||||
within(popup).getByText("Ban", { selector: "button" }).props.onClick();
|
||||
});
|
||||
|
||||
const modal = within(testRenderer.root).getByLabelText(
|
||||
@@ -715,9 +685,7 @@ it("ban user", async () => {
|
||||
);
|
||||
|
||||
TestRenderer.act(() => {
|
||||
within(modal)
|
||||
.getByType("form")
|
||||
.props.onSubmit();
|
||||
within(modal).getByType("form").props.onSubmit();
|
||||
});
|
||||
within(userRow).getByText("Banned");
|
||||
expect(resolvers.Mutation!.banUser!.called).toBe(true);
|
||||
@@ -755,9 +723,7 @@ it("ban user with custom message", async () => {
|
||||
});
|
||||
|
||||
TestRenderer.act(() => {
|
||||
within(userRow)
|
||||
.getByLabelText("Change user status")
|
||||
.props.onClick();
|
||||
within(userRow).getByLabelText("Change user status").props.onClick();
|
||||
});
|
||||
|
||||
const popup = within(userRow).getByLabelText(
|
||||
@@ -765,9 +731,7 @@ it("ban user with custom message", async () => {
|
||||
);
|
||||
|
||||
TestRenderer.act(() => {
|
||||
within(popup)
|
||||
.getByText("Ban", { selector: "button" })
|
||||
.props.onClick();
|
||||
within(popup).getByText("Ban", { selector: "button" }).props.onClick();
|
||||
});
|
||||
|
||||
const modal = within(testRenderer.root).getByLabelText(
|
||||
@@ -790,9 +754,7 @@ it("ban user with custom message", async () => {
|
||||
});
|
||||
|
||||
TestRenderer.act(() => {
|
||||
within(modal)
|
||||
.getByType("form")
|
||||
.props.onSubmit();
|
||||
within(modal).getByType("form").props.onSubmit();
|
||||
});
|
||||
within(userRow).getByText("Banned");
|
||||
expect(resolvers.Mutation!.banUser!.called).toBe(true);
|
||||
@@ -809,7 +771,7 @@ it("remove user ban", async () => {
|
||||
const userRecord = pureMerge<typeof user>(user, {
|
||||
status: {
|
||||
current: user.status.current.filter(
|
||||
s => s !== GQLUSER_STATUS.BANNED
|
||||
(s) => s !== GQLUSER_STATUS.BANNED
|
||||
),
|
||||
ban: { active: false },
|
||||
},
|
||||
@@ -841,9 +803,7 @@ it("remove user ban", async () => {
|
||||
});
|
||||
|
||||
TestRenderer.act(() => {
|
||||
within(userRow)
|
||||
.getByLabelText("Change user status")
|
||||
.props.onClick();
|
||||
within(userRow).getByLabelText("Change user status").props.onClick();
|
||||
});
|
||||
|
||||
const popup = within(userRow).getByLabelText(
|
||||
|
||||
@@ -89,9 +89,7 @@ it("change custom css", async () => {
|
||||
|
||||
// Send form
|
||||
act(() => {
|
||||
within(configureContainer)
|
||||
.getByType("form")
|
||||
.props.onSubmit();
|
||||
within(configureContainer).getByType("form").props.onSubmit();
|
||||
});
|
||||
|
||||
// Submit button and text field should be disabled.
|
||||
@@ -137,9 +135,7 @@ it("remove custom css", async () => {
|
||||
|
||||
// Send form
|
||||
act(() => {
|
||||
within(configureContainer)
|
||||
.getByType("form")
|
||||
.props.onSubmit();
|
||||
within(configureContainer).getByType("form").props.onSubmit();
|
||||
});
|
||||
|
||||
// Wait for submission to be finished
|
||||
|
||||
@@ -98,9 +98,7 @@ it("rotate sso key", async () => {
|
||||
});
|
||||
const container = within(testRenderer.root).getByTestID("configure-auth-sso");
|
||||
act(() => {
|
||||
within(container)
|
||||
.getByLabelText("Enabled")
|
||||
.props.onChange({});
|
||||
within(container).getByLabelText("Enabled").props.onChange({});
|
||||
});
|
||||
|
||||
act(() => {
|
||||
@@ -121,8 +119,8 @@ it("rotate sso key", async () => {
|
||||
// Check that we have two SSO Keys that match
|
||||
// our expected key IDs
|
||||
const keyIDs = within(container).getAllByTestID("SSO-Key-ID");
|
||||
const hasOldKey = keyIDs.some(k => k.props.value === "kid-01");
|
||||
const hasNewKey = keyIDs.some(k => k.props.value === "kid-02");
|
||||
const hasOldKey = keyIDs.some((k) => k.props.value === "kid-01");
|
||||
const hasNewKey = keyIDs.some((k) => k.props.value === "kid-02");
|
||||
expect(hasNewKey).toBe(true);
|
||||
expect(hasOldKey).toBe(true);
|
||||
|
||||
@@ -150,9 +148,7 @@ it("prevents admin lock out", async () => {
|
||||
|
||||
// Let's disable local auth.
|
||||
act(() => {
|
||||
within(container)
|
||||
.getByLabelText("Enabled")
|
||||
.props.onChange();
|
||||
within(container).getByLabelText("Enabled").props.onChange();
|
||||
});
|
||||
|
||||
// Send form
|
||||
@@ -162,7 +158,9 @@ it("prevents admin lock out", async () => {
|
||||
await waitForElement(() =>
|
||||
within(testRenderer.root).getByText(
|
||||
"Please enable at least one authentication integration",
|
||||
{ exact: false }
|
||||
{
|
||||
exact: false,
|
||||
}
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
@@ -91,9 +91,7 @@ it("change language", async () => {
|
||||
|
||||
// Send form
|
||||
await act(async () => {
|
||||
await within(configureContainer)
|
||||
.getByType("form")
|
||||
.props.onSubmit();
|
||||
await within(configureContainer).getByType("form").props.onSubmit();
|
||||
});
|
||||
|
||||
// Submit button and text field should be disabled.
|
||||
@@ -136,10 +134,9 @@ it("change site wide commenting", async () => {
|
||||
resolvers,
|
||||
});
|
||||
|
||||
const sitewideCommentingContainer = within(generalContainer).getAllByText(
|
||||
"Sitewide commenting",
|
||||
{ selector: "fieldset" }
|
||||
)[0];
|
||||
const sitewideCommentingContainer = within(
|
||||
generalContainer
|
||||
).getAllByText("Sitewide commenting", { selector: "fieldset" })[0];
|
||||
|
||||
const offField = within(sitewideCommentingContainer).getByLabelText(
|
||||
"Off - Comment streams closed for new comments"
|
||||
@@ -156,9 +153,7 @@ it("change site wide commenting", async () => {
|
||||
|
||||
// Send form
|
||||
act(() => {
|
||||
within(configureContainer)
|
||||
.getByType("form")
|
||||
.props.onSubmit();
|
||||
within(configureContainer).getByType("form").props.onSubmit();
|
||||
});
|
||||
|
||||
// Submit button and text field should be disabled.
|
||||
@@ -201,10 +196,9 @@ it("change community guidlines", async () => {
|
||||
resolvers,
|
||||
});
|
||||
|
||||
const guidelinesContainer = within(generalContainer).getAllByText(
|
||||
"Community guidelines summary",
|
||||
{ selector: "fieldset" }
|
||||
)[0];
|
||||
const guidelinesContainer = within(
|
||||
generalContainer
|
||||
).getAllByText("Community guidelines summary", { selector: "fieldset" })[0];
|
||||
|
||||
const onField = within(guidelinesContainer).getByLabelText("On");
|
||||
const contentField = within(guidelinesContainer).getByLabelText(
|
||||
@@ -221,9 +215,7 @@ it("change community guidlines", async () => {
|
||||
|
||||
// Send form
|
||||
act(() => {
|
||||
within(configureContainer)
|
||||
.getByType("form")
|
||||
.props.onSubmit();
|
||||
within(configureContainer).getByType("form").props.onSubmit();
|
||||
});
|
||||
|
||||
// Submit button and text field should be disabled.
|
||||
@@ -269,9 +261,7 @@ it("change closed stream message", async () => {
|
||||
|
||||
// Send form
|
||||
act(() => {
|
||||
within(configureContainer)
|
||||
.getByType("form")
|
||||
.props.onSubmit();
|
||||
within(configureContainer).getByType("form").props.onSubmit();
|
||||
});
|
||||
|
||||
// Submit button and text field should be disabled.
|
||||
@@ -304,10 +294,9 @@ it("change comment editing time", async () => {
|
||||
saveChangesButton,
|
||||
} = await createTestRenderer({ resolvers });
|
||||
|
||||
const durationFieldset = within(generalContainer).getByText(
|
||||
"Comment edit timeframe",
|
||||
{ selector: "fieldset" }
|
||||
);
|
||||
const durationFieldset = within(
|
||||
generalContainer
|
||||
).getByText("Comment edit timeframe", { selector: "fieldset" });
|
||||
const valueField = within(durationFieldset).getByLabelText("value");
|
||||
const unitField = within(durationFieldset).getByLabelText("unit");
|
||||
const hoursOption = within(unitField).getByText(/Hours?/);
|
||||
@@ -317,9 +306,7 @@ it("change comment editing time", async () => {
|
||||
|
||||
// Send form
|
||||
act(() => {
|
||||
within(configureContainer)
|
||||
.getByType("form")
|
||||
.props.onSubmit();
|
||||
within(configureContainer).getByType("form").props.onSubmit();
|
||||
});
|
||||
|
||||
expect(
|
||||
@@ -342,9 +329,7 @@ it("change comment editing time", async () => {
|
||||
|
||||
// Send form
|
||||
act(() => {
|
||||
within(configureContainer)
|
||||
.getByType("form")
|
||||
.props.onSubmit();
|
||||
within(configureContainer).getByType("form").props.onSubmit();
|
||||
});
|
||||
|
||||
// Submit button and text field should be disabled.
|
||||
@@ -381,10 +366,9 @@ it("change comment length limitations", async () => {
|
||||
resolvers,
|
||||
});
|
||||
|
||||
const commentLengthContainer = within(generalContainer).getByText(
|
||||
"Comment length",
|
||||
{ selector: "fieldset" }
|
||||
);
|
||||
const commentLengthContainer = within(
|
||||
generalContainer
|
||||
).getByText("Comment length", { selector: "fieldset" });
|
||||
const onField = within(commentLengthContainer).getByLabelText("On");
|
||||
const minField = within(commentLengthContainer).getByLabelText(
|
||||
"Minimum comment length"
|
||||
@@ -400,9 +384,7 @@ it("change comment length limitations", async () => {
|
||||
|
||||
// Send form
|
||||
act(() => {
|
||||
within(configureContainer)
|
||||
.getByType("form")
|
||||
.props.onSubmit();
|
||||
within(configureContainer).getByType("form").props.onSubmit();
|
||||
});
|
||||
|
||||
expect(
|
||||
@@ -433,9 +415,7 @@ it("change comment length limitations", async () => {
|
||||
|
||||
// Send form
|
||||
act(() => {
|
||||
within(configureContainer)
|
||||
.getByType("form")
|
||||
.props.onSubmit();
|
||||
within(configureContainer).getByType("form").props.onSubmit();
|
||||
});
|
||||
|
||||
// Submit button and text field should be disabled.
|
||||
@@ -473,15 +453,13 @@ it("change closing comment streams", async () => {
|
||||
saveChangesButton,
|
||||
} = await createTestRenderer({ resolvers });
|
||||
|
||||
const closingCommentStreamsContainer = within(generalContainer).getByText(
|
||||
"Closing comment streams",
|
||||
{ selector: "fieldset" }
|
||||
);
|
||||
const closingCommentStreamsContainer = within(
|
||||
generalContainer
|
||||
).getByText("Closing comment streams", { selector: "fieldset" });
|
||||
const onField = within(closingCommentStreamsContainer).getByLabelText("On");
|
||||
const durationFieldset = within(closingCommentStreamsContainer).getByText(
|
||||
"Close comments after",
|
||||
{ selector: "fieldset" }
|
||||
);
|
||||
const durationFieldset = within(
|
||||
closingCommentStreamsContainer
|
||||
).getByText("Close comments after", { selector: "fieldset" });
|
||||
const valueField = within(durationFieldset).getByLabelText("value");
|
||||
const unitField = within(durationFieldset).getByLabelText("unit");
|
||||
const daysOption = within(unitField).getByText(/Days?/);
|
||||
@@ -492,9 +470,7 @@ it("change closing comment streams", async () => {
|
||||
|
||||
// Send form
|
||||
act(() => {
|
||||
within(configureContainer)
|
||||
.getByType("form")
|
||||
.props.onSubmit();
|
||||
within(configureContainer).getByType("form").props.onSubmit();
|
||||
});
|
||||
|
||||
expect(
|
||||
@@ -511,9 +487,7 @@ it("change closing comment streams", async () => {
|
||||
|
||||
// Send form
|
||||
act(() => {
|
||||
within(configureContainer)
|
||||
.getByType("form")
|
||||
.props.onSubmit();
|
||||
within(configureContainer).getByType("form").props.onSubmit();
|
||||
});
|
||||
|
||||
// Submit button and text field should be disabled.
|
||||
@@ -554,9 +528,7 @@ it("handle server error", async () => {
|
||||
|
||||
// Send form
|
||||
act(() => {
|
||||
within(configureContainer)
|
||||
.getByType("form")
|
||||
.props.onSubmit();
|
||||
within(configureContainer).getByType("form").props.onSubmit();
|
||||
});
|
||||
|
||||
// Look for internal error being displayed.
|
||||
|
||||
@@ -82,7 +82,9 @@ it("change site wide pre-moderation", async () => {
|
||||
|
||||
const preModerationContainer = within(moderationContainer).getAllByText(
|
||||
"Pre-moderate all comments sitewide",
|
||||
{ selector: "fieldset" }
|
||||
{
|
||||
selector: "fieldset",
|
||||
}
|
||||
)[0];
|
||||
|
||||
const onField = within(preModerationContainer).getByLabelText("On");
|
||||
@@ -127,7 +129,9 @@ it("change site wide link pre-moderation", async () => {
|
||||
|
||||
const preModerationContainer = within(moderationContainer).getAllByText(
|
||||
"Pre-moderate comments containing links sitewide",
|
||||
{ selector: "fieldset" }
|
||||
{
|
||||
selector: "fieldset",
|
||||
}
|
||||
)[0];
|
||||
|
||||
const onField = within(preModerationContainer).getByLabelText("On");
|
||||
|
||||
@@ -90,9 +90,7 @@ it("change organization name", async () => {
|
||||
|
||||
// Send form
|
||||
act(() => {
|
||||
within(configureContainer)
|
||||
.getByType("form")
|
||||
.props.onSubmit();
|
||||
within(configureContainer).getByType("form").props.onSubmit();
|
||||
});
|
||||
|
||||
// Should show validation error.
|
||||
@@ -108,9 +106,7 @@ it("change organization name", async () => {
|
||||
|
||||
// Send form
|
||||
act(() => {
|
||||
within(configureContainer)
|
||||
.getByType("form")
|
||||
.props.onSubmit();
|
||||
within(configureContainer).getByType("form").props.onSubmit();
|
||||
});
|
||||
|
||||
// Submit button and text field should be disabled.
|
||||
|
||||
@@ -96,9 +96,7 @@ it("change banned and suspect words", async () => {
|
||||
|
||||
// Send form
|
||||
act(() => {
|
||||
within(configureContainer)
|
||||
.getByType("form")
|
||||
.props.onSubmit();
|
||||
within(configureContainer).getByType("form").props.onSubmit();
|
||||
});
|
||||
|
||||
// Submit button and text field should be disabled.
|
||||
|
||||
@@ -843,7 +843,7 @@ export const reportedComments = createFixtures<GQLComment>(
|
||||
baseComment
|
||||
);
|
||||
|
||||
export const rejectedComments = reportedComments.map<GQLComment>(c => ({
|
||||
export const rejectedComments = reportedComments.map<GQLComment>((c) => ({
|
||||
...c,
|
||||
status: GQLCOMMENT_STATUS.REJECTED,
|
||||
}));
|
||||
|
||||
@@ -71,7 +71,7 @@ it("live update count", async () => {
|
||||
const commentEntered = (queue: GQLMODERATION_QUEUE, comment: GQLComment) => {
|
||||
subscriptionHandler.dispatch<
|
||||
SubscriptionToCommentEnteredModerationQueueResolver
|
||||
>("commentEnteredModerationQueue", variables => {
|
||||
>("commentEnteredModerationQueue", (variables) => {
|
||||
if (variables.queue && variables.queue !== queue) {
|
||||
return;
|
||||
}
|
||||
@@ -84,7 +84,7 @@ it("live update count", async () => {
|
||||
const commentLeft = (queue: GQLMODERATION_QUEUE, comment: GQLComment) => {
|
||||
subscriptionHandler.dispatch<
|
||||
SubscriptionToCommentEnteredModerationQueueResolver
|
||||
>("commentLeftModerationQueue", variables => {
|
||||
>("commentLeftModerationQueue", (variables) => {
|
||||
if (variables.queue && variables.queue !== queue) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ it("allows viewing new when new comments come in", async () => {
|
||||
|
||||
subscriptionHandler.dispatch<
|
||||
SubscriptionToCommentEnteredModerationQueueResolver
|
||||
>("commentEnteredModerationQueue", variables => {
|
||||
>("commentEnteredModerationQueue", (variables) => {
|
||||
if (
|
||||
variables.storyID !== null ||
|
||||
variables.queue !== GQLMODERATION_QUEUE.REPORTED
|
||||
@@ -103,7 +103,7 @@ it("recognizes when same comment enters and leaves again", async () => {
|
||||
|
||||
subscriptionHandler.dispatch<
|
||||
SubscriptionToCommentEnteredModerationQueueResolver
|
||||
>("commentEnteredModerationQueue", variables => {
|
||||
>("commentEnteredModerationQueue", (variables) => {
|
||||
if (
|
||||
variables.storyID !== null ||
|
||||
variables.queue !== GQLMODERATION_QUEUE.REPORTED
|
||||
@@ -125,7 +125,7 @@ it("recognizes when same comment enters and leaves again", async () => {
|
||||
|
||||
subscriptionHandler.dispatch<
|
||||
SubscriptionToCommentLeftModerationQueueResolver
|
||||
>("commentLeftModerationQueue", variables => {
|
||||
>("commentLeftModerationQueue", (variables) => {
|
||||
if (
|
||||
variables.storyID !== null ||
|
||||
variables.queue !== GQLMODERATION_QUEUE.REPORTED
|
||||
|
||||
@@ -98,7 +98,7 @@ it("update comment status live", async () => {
|
||||
|
||||
subscriptionHandler.dispatch<
|
||||
SubscriptionToCommentLeftModerationQueueResolver
|
||||
>("commentLeftModerationQueue", variables => {
|
||||
>("commentLeftModerationQueue", (variables) => {
|
||||
if (
|
||||
variables.storyID !== null ||
|
||||
variables.queue !== GQLMODERATION_QUEUE.REPORTED
|
||||
|
||||
@@ -115,7 +115,9 @@ describe("all stories", () => {
|
||||
await wait(() =>
|
||||
within(searchBar).getByText(
|
||||
"We could not find any stories matching your criteria",
|
||||
{ exact: false }
|
||||
{
|
||||
exact: false,
|
||||
}
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
@@ -68,7 +68,7 @@ it("update comment status live", async () => {
|
||||
|
||||
subscriptionHandler.dispatch<SubscriptionToCommentStatusUpdatedResolver>(
|
||||
"commentStatusUpdated",
|
||||
variables => {
|
||||
(variables) => {
|
||||
if (variables.id !== commentData.id) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -211,9 +211,7 @@ it("change story status", async () => {
|
||||
changeStatusButton.props.onClick();
|
||||
});
|
||||
act(() => {
|
||||
within(popup)
|
||||
.getByText("Closed", { selector: "button" })
|
||||
.props.onClick();
|
||||
within(popup).getByText("Closed", { selector: "button" }).props.onClick();
|
||||
});
|
||||
|
||||
within(storyRow).getByText("Closed");
|
||||
@@ -225,9 +223,7 @@ it("change story status", async () => {
|
||||
});
|
||||
|
||||
act(() => {
|
||||
within(popup)
|
||||
.getByText("Open", { selector: "button" })
|
||||
.props.onClick();
|
||||
within(popup).getByText("Open", { selector: "button" }).props.onClick();
|
||||
});
|
||||
|
||||
within(storyRow).getByText("Open");
|
||||
|
||||
Reference in New Issue
Block a user