Skip to content

Commit

Permalink
Add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
syntag committed Feb 6, 2024
1 parent 149a913 commit e45fa46
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
13 changes: 13 additions & 0 deletions src/components/FrameMetadata.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,17 @@ describe('FrameMetadata', () => {
).toBe('10');
expect(meta.container.querySelectorAll('meta').length).toBe(3);
});

it('renders with wrapperComponent', () => {
const meta = render(
<FrameMetadata
image="https://example.com/image.png"
wrapperComponent={({ children }) => <div id="wrapper">{children}</div>}
/>,
);

expect(meta.container.querySelector('#wrapper')).not.toBeNull();
expect(meta.container.querySelector('meta[name="fc:frame:image"]')).not.toBeNull();
expect(meta.container.querySelectorAll('meta').length).toBe(2);
});
});
4 changes: 2 additions & 2 deletions src/components/FrameMetadata.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import { Fragment } from 'react';
import type { FrameMetadataType } from '../core/types';

/**
Expand Down Expand Up @@ -42,7 +42,7 @@ export function FrameMetadata({
input,
post_url,
refresh_period,
wrapperComponent: WrapperComponent = React.Fragment,
wrapperComponent: WrapperComponent = Fragment,
}: FrameMetadataType) {
return (
<WrapperComponent>
Expand Down

0 comments on commit e45fa46

Please sign in to comment.