mirror of
https://github.com/outline/outline.git
synced 2026-06-13 11:25:03 +03:00
1f097b0fdd
* chore: resolve no-explicit-any lint warnings in plugins Replaces uses of `any` in the plugins directory with concrete types, `unknown`, or structured type assertions, addressing the remaining typescript-eslint(no-explicit-any) warnings flagged by oxlint. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> * chore: address review feedback in GitLabIssueProvider Drop trailing semicolon from log string and add early return in `destroyNamespace` when neither `user_id` nor `full_path` is present to avoid an unnecessary full-scan transaction. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
78 lines
2.9 KiB
TypeScript
78 lines
2.9 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: "MicrosoftGraphError", fn: errors.MicrosoftGraphError },
|
|
{ name: "TeamDomainRequiredError", fn: errors.TeamDomainRequiredError },
|
|
{
|
|
name: "GmailAccountCreationError",
|
|
fn: errors.GmailAccountCreationError,
|
|
},
|
|
{
|
|
name: "OIDCMalformedUserInfoError",
|
|
fn: errors.OIDCMalformedUserInfoError,
|
|
},
|
|
{
|
|
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);
|
|
});
|
|
});
|
|
});
|