fix tests

This commit is contained in:
Konstantin Schaper
2020-08-07 14:17:54 +02:00
parent a99fdcef8e
commit 76b561414c
5 changed files with 62 additions and 33 deletions

View File

@@ -2737,18 +2737,14 @@ exports[`Storyshots Changesets With invalid signature 1`] = `
SCM Administrator
</a>
</p>
<span
className="tooltip has-tooltip-top"
data-tooltip="changeset.keyOwner: trillian
changeset.keyId: 0x247E908C6FD35473
changeset.signatureStatus: changeset.signatureInvalid
changeset.keyContacts:
- undefined <undefined>"
<div
onMouseLeave={[Function]}
onMouseOver={[Function]}
>
<i
className="fas fa-key has-text-danger SignatureIcon__StyledIcon-sc-1mwf1m5-0 cgFYhq mx-2 pt-1"
/>
</span>
</div>
</div>
</div>
</div>
@@ -2996,15 +2992,14 @@ exports[`Storyshots Changesets With unknown signature 1`] = `
SCM Administrator
</a>
</p>
<span
className="tooltip has-tooltip-top"
data-tooltip="changeset.signatureStatus: changeset.signatureNotVerified
changeset.keyId: 0x247E908C6FD35473"
<div
onMouseLeave={[Function]}
onMouseOver={[Function]}
>
<i
className="fas fa-key has-text-grey-light SignatureIcon__StyledIcon-sc-1mwf1m5-0 cgFYhq mx-2 pt-1"
/>
</span>
</div>
</div>
</div>
</div>
@@ -3122,18 +3117,14 @@ exports[`Storyshots Changesets With valid signature 1`] = `
SCM Administrator
</a>
</p>
<span
className="tooltip has-tooltip-top"
data-tooltip="changeset.keyOwner: trillian
changeset.keyId: 0x247E908C6FD35473
changeset.signatureStatus: changeset.signatureVerified
changeset.keyContacts:
- undefined <undefined>"
<div
onMouseLeave={[Function]}
onMouseOver={[Function]}
>
<i
className="fas fa-key has-text-success SignatureIcon__StyledIcon-sc-1mwf1m5-0 cgFYhq mx-2 pt-1"
/>
</span>
</div>
</div>
</div>
</div>
@@ -42286,6 +42277,38 @@ imaginative generator sweep.
</div>
`;
exports[`Storyshots Popover Default 1`] = `
<div
className="Popoverstories__Wrapper-sc-2pld2j-0 ifASIH"
>
<div>
<button
className="button"
onMouseLeave={[Function]}
onMouseOver={[Function]}
>
Trigger
</button>
</div>
</div>
`;
exports[`Storyshots Popover Link 1`] = `
<div
className="Popoverstories__Wrapper-sc-2pld2j-0 ifASIH"
>
<div>
<a
href="#"
onMouseLeave={[Function]}
onMouseOver={[Function]}
>
Trigger
</a>
</div>
</div>
`;
exports[`Storyshots RepositoryEntry Avatar EP 1`] = `
<div
className="RepositoryEntrystories__Spacing-toppdg-0 dLLytC box box-link-shadow"

View File

@@ -35,7 +35,7 @@ const Wrapper = styled.div`
storiesOf("Popover", module)
.addDecorator(storyFn => <Wrapper>{storyFn()}</Wrapper>)
.add("Default", () => {
.add("Default", () => React.createElement(() => {
const { triggerProps, popoverProps } = usePopover();
return (
@@ -52,8 +52,8 @@ storiesOf("Popover", module)
</button>
</div>
);
})
.add("Link", () => {
}))
.add("Link", () => React.createElement(() => {
const { triggerProps, popoverProps } = usePopover();
return (
@@ -70,4 +70,4 @@ storiesOf("Popover", module)
</a>
</div>
);
});
}));

View File

@@ -67,9 +67,9 @@ const withReplacements = (
);
};
const copy = (input: Object) => {
function copy<T>(input: T): T {
return JSON.parse(JSON.stringify(input));
}
};
storiesOf("Changesets", module)
.addDecorator(story => <MemoryRouter initialEntries={["/"]}>{story()}</MemoryRouter>)
@@ -114,7 +114,10 @@ storiesOf("Changesets", module)
type: "gpg",
status: "VERIFIED",
owner: "trillian",
contacts: ["Tricia Marie McMilla <trillian@hitchhiker.com>"]
contacts: [{
name: "Tricia Marie McMilla",
mail: "trillian@hitchhiker.com"
}]
}];
return <ChangesetRow repository={repository} changeset={changeset} />;
})
@@ -125,7 +128,10 @@ storiesOf("Changesets", module)
type: "gpg",
status: "INVALID",
owner: "trillian",
contacts: ["Tricia Marie McMilla <trillian@hitchhiker.com>"]
contacts: [{
name: "Tricia Marie McMilla",
mail: "trillian@hitchhiker.com"
}]
}];
return <ChangesetRow repository={repository} changeset={changeset} />;
});

View File

@@ -79,9 +79,9 @@ const SignatureIcon: FC<Props> = ({signatures, className}) => {
signature._links?.rawKey ? <a href={signature._links.rawKey.href}>{signature.keyId}</a> : signature.keyId
}</div>
<div>{t("changeset.signatureStatus")}: {status}</div>
{signature.contacts?.length > 0 && <>
{signature.contacts && signature.contacts.length > 0 && <>
<div>{t("changeset.keyContacts")}:</div>
{signature.contacts.map(contact => <div>- {contact.name}{contact.mail && ` <${contact.mail}>`}</div>)}
{signature.contacts && signature.contacts.map(contact => <div>- {contact.name}{contact.mail && ` <${contact.mail}>`}</div>)}
</>}
</p>;
};

View File

@@ -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;
};