Fixed tests

This commit is contained in:
Alejandro Celaya 2021-12-07 20:41:07 +01:00
parent 527d4acf17
commit 4986dbcb91
2 changed files with 7 additions and 6 deletions

View file

@ -48,13 +48,13 @@ export const DomainRow: FC<DomainRowProps> = ({ domain, editDomainRedirects, def
{redirects?.invalidShortUrlRedirect ?? <Nr fallback={defaultRedirects?.invalidShortUrlRedirect} />} {redirects?.invalidShortUrlRedirect ?? <Nr fallback={defaultRedirects?.invalidShortUrlRedirect} />}
</td> </td>
<td className="responsive-table__cell text-right"> <td className="responsive-table__cell text-right">
<span id={isDefault ? 'defaultDomaiBtn' : undefined}> <span id={isDefault ? 'defaultDomainBtn' : undefined}>
<Button outline size="sm" disabled={isDefault} onClick={isDefault ? undefined : toggle}> <Button outline size="sm" disabled={isDefault} onClick={isDefault ? undefined : toggle}>
<FontAwesomeIcon fixedWidth icon={isDefault ? forbiddenIcon : editIcon} /> <FontAwesomeIcon fixedWidth icon={isDefault ? forbiddenIcon : editIcon} />
</Button> </Button>
</span> </span>
{isDefault && ( {isDefault && (
<UncontrolledTooltip target="defaultDomaiBtn" placement="left"> <UncontrolledTooltip target="defaultDomainBtn" placement="left">
Redirects for default domain cannot be edited here. Redirects for default domain cannot be edited here.
<br /> <br />
Use config options or env vars directly on the server. Use config options or env vars directly on the server.

View file

@ -17,10 +17,11 @@ describe('<DomainRow />', () => {
afterEach(() => wrapper?.unmount()); afterEach(() => wrapper?.unmount());
it.each([ it.each([
[ Mock.of<ShlinkDomain>({ domain: '', isDefault: true }), 1, 'domainEdit' ], [ Mock.of<ShlinkDomain>({ domain: '', isDefault: true }), 1, 'defaultDomainBtn' ],
[ Mock.of<ShlinkDomain>({ domain: '', isDefault: false }), 0, '' ], [ Mock.of<ShlinkDomain>({ domain: '', isDefault: false }), 0, undefined ],
[ Mock.of<ShlinkDomain>({ domain: 'foo.com', isDefault: true }), 1, 'domainEditfoocom' ], [ Mock.of<ShlinkDomain>({ domain: 'foo.com', isDefault: true }), 1, 'defaultDomainBtn' ],
[ Mock.of<ShlinkDomain>({ domain: 'foo.bar.com', isDefault: true }), 1, 'domainEditfoobarcom' ], [ Mock.of<ShlinkDomain>({ domain: 'foo.bar.com', isDefault: true }), 1, 'defaultDomainBtn' ],
[ Mock.of<ShlinkDomain>({ domain: 'foo.baz', isDefault: false }), 0, undefined ],
])('shows proper components based on the fact that provided domain is default or not', ( ])('shows proper components based on the fact that provided domain is default or not', (
domain, domain,
expectedComps, expectedComps,