18 lines
763 B
TypeScript
18 lines
763 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { WEB_IMPORT_SOURCE_SAVE_ERROR, getSafeWebImportSourceError } from "./webImportSourcesError";
|
|
|
|
describe("getSafeWebImportSourceError", () => {
|
|
it("never returns the SQL statement or connector parameters to the client", () => {
|
|
const databaseError = new Error(
|
|
"Failed query: insert into `webImportSources` (...) values (...) params: amazon@example.fr, secret-value",
|
|
);
|
|
|
|
const safeError = getSafeWebImportSourceError(databaseError);
|
|
|
|
expect(safeError.code).toBe("INTERNAL_SERVER_ERROR");
|
|
expect(safeError.message).toBe(WEB_IMPORT_SOURCE_SAVE_ERROR);
|
|
expect(safeError.message).not.toContain("insert into");
|
|
expect(safeError.message).not.toContain("secret-value");
|
|
});
|
|
});
|