Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
geoperez committed Nov 8, 2023
1 parent ad9c01e commit c234e37
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"typescript": "^5.2.2"
},
"jest": {
"testEnvironment": "jsdom",
"coverageReporters": [
"lcov",
"text"
Expand Down
4 changes: 0 additions & 4 deletions src/AwaitableMetric/AwaitableMetric.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/**
* @jest-environment jsdom
*/

import React from 'react';
import { render } from '@testing-library/react';
import { AwaitableMetric } from './index';
Expand Down
15 changes: 15 additions & 0 deletions src/NoData/NoData.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import { NoData } from './index';

describe('NoData component', () => {
it('renders "No record found" when no children are provided', () => {
render(<NoData />);
expect(screen.getByText('No record found')).toBeInTheDocument();
});

it('renders children when provided', () => {
render(<NoData>Test Child</NoData>);
expect(screen.getByText('Test Child')).toBeInTheDocument();
});
});
2 changes: 1 addition & 1 deletion src/NoData/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import { Bold, Flex } from '@tremor/react';
export const NoData = ({ children }: PropsWithChildren) => (
<Flex className='mt-5 p-4' justifyContent='center' alignItems='center' flexDirection='col'>
<CloudDismiss48Regular primaryFill='#505050' />
{children || <Bold className='mt-3'>No record found</Bold>}
{children ?? <Bold className='mt-3'>No record found</Bold>}
</Flex>
);

0 comments on commit c234e37

Please sign in to comment.