From 76b561414c02c70a0750db41096d07ed880221dd Mon Sep 17 00:00:00 2001
From: Konstantin Schaper
Date: Fri, 7 Aug 2020 14:17:54 +0200
Subject: [PATCH] fix tests
---
.../src/__snapshots__/storyshots.test.ts.snap | 65 +++++++++++++------
.../src/popover/Popover.stories.tsx | 8 +--
.../repos/changesets/Changesets.stories.tsx | 14 ++--
.../src/repos/changesets/SignatureIcon.tsx | 4 +-
scm-ui/ui-types/src/Changesets.ts | 4 +-
5 files changed, 62 insertions(+), 33 deletions(-)
diff --git a/scm-ui/ui-components/src/__snapshots__/storyshots.test.ts.snap b/scm-ui/ui-components/src/__snapshots__/storyshots.test.ts.snap
index 7f25b58652..f23f781046 100644
--- a/scm-ui/ui-components/src/__snapshots__/storyshots.test.ts.snap
+++ b/scm-ui/ui-components/src/__snapshots__/storyshots.test.ts.snap
@@ -2737,18 +2737,14 @@ exports[`Storyshots Changesets With invalid signature 1`] = `
SCM Administrator
-
-
+
@@ -2996,15 +2992,14 @@ exports[`Storyshots Changesets With unknown signature 1`] = `
SCM Administrator
-
-
+
@@ -3122,18 +3117,14 @@ exports[`Storyshots Changesets With valid signature 1`] = `
SCM Administrator
-
-
+
@@ -42286,6 +42277,38 @@ imaginative generator sweep.
`;
+exports[`Storyshots Popover Default 1`] = `
+
+`;
+
+exports[`Storyshots Popover Link 1`] = `
+
+`;
+
exports[`Storyshots RepositoryEntry Avatar EP 1`] = `
{storyFn()})
- .add("Default", () => {
+ .add("Default", () => React.createElement(() => {
const { triggerProps, popoverProps } = usePopover();
return (
@@ -52,8 +52,8 @@ storiesOf("Popover", module)
);
- })
- .add("Link", () => {
+ }))
+ .add("Link", () => React.createElement(() => {
const { triggerProps, popoverProps } = usePopover();
return (
@@ -70,4 +70,4 @@ storiesOf("Popover", module)
);
- });
+ }));
diff --git a/scm-ui/ui-components/src/repos/changesets/Changesets.stories.tsx b/scm-ui/ui-components/src/repos/changesets/Changesets.stories.tsx
index df5960ee52..b93422ac35 100644
--- a/scm-ui/ui-components/src/repos/changesets/Changesets.stories.tsx
+++ b/scm-ui/ui-components/src/repos/changesets/Changesets.stories.tsx
@@ -67,9 +67,9 @@ const withReplacements = (
);
};
-const copy = (input: Object) => {
+function copy(input: T): T {
return JSON.parse(JSON.stringify(input));
-}
+};
storiesOf("Changesets", module)
.addDecorator(story => {story()})
@@ -114,7 +114,10 @@ storiesOf("Changesets", module)
type: "gpg",
status: "VERIFIED",
owner: "trillian",
- contacts: ["Tricia Marie McMilla "]
+ contacts: [{
+ name: "Tricia Marie McMilla",
+ mail: "trillian@hitchhiker.com"
+ }]
}];
return ;
})
@@ -125,7 +128,10 @@ storiesOf("Changesets", module)
type: "gpg",
status: "INVALID",
owner: "trillian",
- contacts: ["Tricia Marie McMilla "]
+ contacts: [{
+ name: "Tricia Marie McMilla",
+ mail: "trillian@hitchhiker.com"
+ }]
}];
return ;
});
diff --git a/scm-ui/ui-components/src/repos/changesets/SignatureIcon.tsx b/scm-ui/ui-components/src/repos/changesets/SignatureIcon.tsx
index 637247d0b2..48cf2a3b11 100644
--- a/scm-ui/ui-components/src/repos/changesets/SignatureIcon.tsx
+++ b/scm-ui/ui-components/src/repos/changesets/SignatureIcon.tsx
@@ -79,9 +79,9 @@ const SignatureIcon: FC = ({signatures, className}) => {
signature._links?.rawKey ? {signature.keyId} : signature.keyId
}
{t("changeset.signatureStatus")}: {status}
- {signature.contacts?.length > 0 && <>
+ {signature.contacts && signature.contacts.length > 0 && <>
{t("changeset.keyContacts")}:
- {signature.contacts.map(contact => - {contact.name}{contact.mail && ` <${contact.mail}>`}
)}
+ {signature.contacts && signature.contacts.map(contact => - {contact.name}{contact.mail && ` <${contact.mail}>`}
)}
>}
;
};
diff --git a/scm-ui/ui-types/src/Changesets.ts b/scm-ui/ui-types/src/Changesets.ts
index 60f1bddea7..81acd09c92 100644
--- a/scm-ui/ui-types/src/Changesets.ts
+++ b/scm-ui/ui-types/src/Changesets.ts
@@ -46,8 +46,8 @@ export type Signature = {
keyId: string;
type: string;
status: "VERIFIED" | "NOT_FOUND" | "INVALID";
- owner: string;
- contacts: Person[];
+ owner?: string;
+ contacts?: Person[];
_links?: {
rawKey?: Link;
};