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

View File

@@ -35,7 +35,7 @@ const Wrapper = styled.div`
storiesOf("Popover", module) storiesOf("Popover", module)
.addDecorator(storyFn => <Wrapper>{storyFn()}</Wrapper>) .addDecorator(storyFn => <Wrapper>{storyFn()}</Wrapper>)
.add("Default", () => { .add("Default", () => React.createElement(() => {
const { triggerProps, popoverProps } = usePopover(); const { triggerProps, popoverProps } = usePopover();
return ( return (
@@ -52,8 +52,8 @@ storiesOf("Popover", module)
</button> </button>
</div> </div>
); );
}) }))
.add("Link", () => { .add("Link", () => React.createElement(() => {
const { triggerProps, popoverProps } = usePopover(); const { triggerProps, popoverProps } = usePopover();
return ( return (
@@ -70,4 +70,4 @@ storiesOf("Popover", module)
</a> </a>
</div> </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)); return JSON.parse(JSON.stringify(input));
} };
storiesOf("Changesets", module) storiesOf("Changesets", module)
.addDecorator(story => <MemoryRouter initialEntries={["/"]}>{story()}</MemoryRouter>) .addDecorator(story => <MemoryRouter initialEntries={["/"]}>{story()}</MemoryRouter>)
@@ -114,7 +114,10 @@ storiesOf("Changesets", module)
type: "gpg", type: "gpg",
status: "VERIFIED", status: "VERIFIED",
owner: "trillian", owner: "trillian",
contacts: ["Tricia Marie McMilla <trillian@hitchhiker.com>"] contacts: [{
name: "Tricia Marie McMilla",
mail: "trillian@hitchhiker.com"
}]
}]; }];
return <ChangesetRow repository={repository} changeset={changeset} />; return <ChangesetRow repository={repository} changeset={changeset} />;
}) })
@@ -125,7 +128,10 @@ storiesOf("Changesets", module)
type: "gpg", type: "gpg",
status: "INVALID", status: "INVALID",
owner: "trillian", owner: "trillian",
contacts: ["Tricia Marie McMilla <trillian@hitchhiker.com>"] contacts: [{
name: "Tricia Marie McMilla",
mail: "trillian@hitchhiker.com"
}]
}]; }];
return <ChangesetRow repository={repository} changeset={changeset} />; 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 signature._links?.rawKey ? <a href={signature._links.rawKey.href}>{signature.keyId}</a> : signature.keyId
}</div> }</div>
<div>{t("changeset.signatureStatus")}: {status}</div> <div>{t("changeset.signatureStatus")}: {status}</div>
{signature.contacts?.length > 0 && <> {signature.contacts && signature.contacts.length > 0 && <>
<div>{t("changeset.keyContacts")}:</div> <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>; </p>;
}; };

View File

@@ -46,8 +46,8 @@ export type Signature = {
keyId: string; keyId: string;
type: string; type: string;
status: "VERIFIED" | "NOT_FOUND" | "INVALID"; status: "VERIFIED" | "NOT_FOUND" | "INVALID";
owner: string; owner?: string;
contacts: Person[]; contacts?: Person[];
_links?: { _links?: {
rawKey?: Link; rawKey?: Link;
}; };