chore: start adding tests

Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
blam
2022-03-08 14:12:47 +01:00
parent 2624e676dc
commit 8e63805991
2 changed files with 19 additions and 0 deletions
@@ -46,4 +46,22 @@ describe('CardHeader', () => {
expect(mockTheme.getPageTheme).toHaveBeenCalledWith({ themeId: 'service' });
});
it('should render the type', () => {
const { getByText } = render(
<CardHeader
template={{
apiVersion: 'scaffolder.backstage.io/v1beta3',
kind: 'Template',
metadata: { name: 'bob' },
spec: {
steps: [],
type: 'service',
},
}}
/>,
);
expect(getByText('Service')).toBeInTheDocument();
});
});
@@ -52,6 +52,7 @@ export const CardHeader = (props: CardHeaderProps) => {
} = props;
const { getPageTheme } = useTheme<BackstageTheme>();
const themeForType = getPageTheme({ themeId: type });
const styles = useStyles({
cardBackgroundImage: themeForType.backgroundImage,
});