diff --git a/src/components/common/RedactableValue.test.tsx b/src/components/common/RedactableValue.test.tsx index 3e38cce..1d55b87 100644 --- a/src/components/common/RedactableValue.test.tsx +++ b/src/components/common/RedactableValue.test.tsx @@ -91,4 +91,16 @@ describe("redactablevalue component", () => { render(); expect(screen.queryByTestId("redactable-value")).not.toBeInTheDocument(); }); + + it("should show redact handler when value exists", () => { + const callback = jest.fn(); + render(); + expect(screen.queryByTitle("Redact handler")).toBeInTheDocument(); + }); + + it("should not show redact handler when value does not exists (obfuscated)", () => { + const callback = jest.fn(); + render(); + expect(screen.queryByTitle("Redact handler")).not.toBeInTheDocument(); + }); }); diff --git a/src/components/common/RedactableValue.tsx b/src/components/common/RedactableValue.tsx index eabc7b9..07dbc57 100644 --- a/src/components/common/RedactableValue.tsx +++ b/src/components/common/RedactableValue.tsx @@ -69,7 +69,7 @@ export const RedactableValue: FunctionComponent = ({ {getMessage()} )} - {editable && ( + {editable && value && (