mirror of
https://github.com/outline/outline.git
synced 2026-11-20 21:23:06 +03:00
* chore: Move plugin-specific integration code into plugins Core no longer imports from or names the settings of individual plugins. Plugins now register mention providers, issue status icons, instance URLs, settings keys, settings and import schemas, and OAuth clients through hooks. * fix: Recompute embed instance URLs after plugins load and match legacy issue icons by URL * fix: Skip logo upload jobs queued without a settings path * chore: Choose issue status icons from the unfurl state
69 lines
2.7 KiB
TypeScript
69 lines
2.7 KiB
TypeScript
import * as errors from "./errors";
|
|
|
|
describe("errors", () => {
|
|
describe("InternalError", () => {
|
|
it("should be marked for Sentry reporting", () => {
|
|
const error = errors.InternalError();
|
|
expect(error.isReportable).toBe(true);
|
|
});
|
|
|
|
it("should have status 500", () => {
|
|
const error = errors.InternalError();
|
|
expect(error.status).toBe(500);
|
|
});
|
|
});
|
|
|
|
describe("User input errors", () => {
|
|
const userInputErrors = [
|
|
{ name: "AuthenticationError", fn: errors.AuthenticationError },
|
|
{
|
|
name: "InvalidAuthenticationError",
|
|
fn: errors.InvalidAuthenticationError,
|
|
},
|
|
{ name: "AuthorizationError", fn: errors.AuthorizationError },
|
|
{ name: "CSRFError", fn: errors.CSRFError },
|
|
{ name: "RateLimitExceededError", fn: errors.RateLimitExceededError },
|
|
{ name: "InviteRequiredError", fn: errors.InviteRequiredError },
|
|
{ name: "DomainNotAllowedError", fn: errors.DomainNotAllowedError },
|
|
{ name: "AdminRequiredError", fn: errors.AdminRequiredError },
|
|
{ name: "InvalidRequestError", fn: errors.InvalidRequestError },
|
|
{ name: "PaymentRequiredError", fn: errors.PaymentRequiredError },
|
|
{ name: "NotFoundError", fn: errors.NotFoundError },
|
|
{ name: "ParamRequiredError", fn: errors.ParamRequiredError },
|
|
{ name: "ValidationError", fn: errors.ValidationError },
|
|
{ name: "IncorrectEditionError", fn: errors.IncorrectEditionError },
|
|
{ name: "EditorUpdateError", fn: errors.EditorUpdateError },
|
|
{ name: "FileImportError", fn: errors.FileImportError },
|
|
{ name: "OAuthStateMismatchError", fn: errors.OAuthStateMismatchError },
|
|
{ name: "TeamPendingDeletionError", fn: errors.TeamPendingDeletionError },
|
|
{
|
|
name: "EmailAuthenticationRequiredError",
|
|
fn: errors.EmailAuthenticationRequiredError,
|
|
},
|
|
{ name: "TeamDomainRequiredError", fn: errors.TeamDomainRequiredError },
|
|
{
|
|
name: "AuthenticationProviderDisabledError",
|
|
fn: errors.AuthenticationProviderDisabledError,
|
|
},
|
|
{ name: "UnprocessableEntityError", fn: errors.UnprocessableEntityError },
|
|
{ name: "ClientClosedRequestError", fn: errors.ClientClosedRequestError },
|
|
];
|
|
|
|
userInputErrors.forEach(({ name, fn }) => {
|
|
it(`${name} should not be marked for Sentry reporting`, () => {
|
|
const error = fn();
|
|
expect(error.isReportable).toBe(false);
|
|
});
|
|
});
|
|
});
|
|
|
|
describe("UserSuspendedError", () => {
|
|
it("should not be marked for Sentry reporting", () => {
|
|
const error = errors.UserSuspendedError({
|
|
adminEmail: "test@example.com",
|
|
});
|
|
expect(error.isReportable).toBe(false);
|
|
});
|
|
});
|
|
});
|