Skip to content

Commit

Permalink
yo
Browse files Browse the repository at this point in the history
  • Loading branch information
Zizzamia committed Feb 7, 2024
1 parent 542bebc commit ae5b712
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 2 deletions.
69 changes: 68 additions & 1 deletion src/components/FrameMetadata.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ describe('FrameMetadata', () => {
expect(meta.container.querySelectorAll('meta').length).toBe(3);
});

it('renders with buttons', () => {
it('renders with two basic buttons', () => {
const meta = render(
<FrameMetadata
image="https://example.com/image.png"
Expand Down Expand Up @@ -57,6 +57,73 @@ describe('FrameMetadata', () => {
expect(meta.container.querySelectorAll('meta').length).toBe(5);
});

it('renders with all buttons', () => {
const meta = render(
<FrameMetadata
image="https://example.com/image.png"
buttons={[
{ label: 'button1' },
{ label: 'button2', action: 'post_redirect' },
{ label: 'button3', action: 'mint', target: 'https://zizzamia.xyz/api/frame/mint' },
{ label: 'button4', action: 'link', target: 'https://zizzamia.xyz/api/frame/link' },
]}
/>,
);
// Button 1
expect(meta.container.querySelector('meta[name="fc:frame:button:1"]')).not.toBeNull();
expect(
meta.container.querySelector('meta[name="fc:frame:button:1"]')?.getAttribute('content'),
).toBe('button1');
expect(meta.container.querySelector('meta[name="fc:frame:button:1:action"]')).toBeNull();
// Button 2
expect(meta.container.querySelector('meta[name="fc:frame:button:2"]')).not.toBeNull();
expect(
meta.container.querySelector('meta[name="fc:frame:button:2"]')?.getAttribute('content'),
).toBe('button2');
expect(meta.container.querySelector('meta[name="fc:frame:button:2:action"]')).not.toBeNull();
expect(
meta.container
.querySelector('meta[name="fc:frame:button:2:action"]')
?.getAttribute('content'),
).toBe('post_redirect');
// Button 3
expect(meta.container.querySelector('meta[name="fc:frame:button:3"]')).not.toBeNull();
expect(
meta.container.querySelector('meta[name="fc:frame:button:3"]')?.getAttribute('content'),
).toBe('button3');
expect(meta.container.querySelector('meta[name="fc:frame:button:3:action"]')).not.toBeNull();
expect(
meta.container
.querySelector('meta[name="fc:frame:button:3:action"]')
?.getAttribute('content'),
).toBe('mint');
expect(meta.container.querySelector('meta[name="fc:frame:button:3:target"]')).not.toBeNull();
expect(
meta.container
.querySelector('meta[name="fc:frame:button:3:target"]')
?.getAttribute('content'),
).toBe('https://zizzamia.xyz/api/frame/mint');
// Button 4
expect(meta.container.querySelector('meta[name="fc:frame:button:4"]')).not.toBeNull();
expect(
meta.container.querySelector('meta[name="fc:frame:button:4"]')?.getAttribute('content'),
).toBe('button4');
expect(meta.container.querySelector('meta[name="fc:frame:button:4:action"]')).not.toBeNull();
expect(
meta.container
.querySelector('meta[name="fc:frame:button:4:action"]')
?.getAttribute('content'),
).toBe('link');
expect(meta.container.querySelector('meta[name="fc:frame:button:4:target"]')).not.toBeNull();
expect(
meta.container
.querySelector('meta[name="fc:frame:button:4:target"]')
?.getAttribute('content'),
).toBe('https://zizzamia.xyz/api/frame/link');
// Length
expect(meta.container.querySelectorAll('meta').length).toBe(11);
});

it('renders with post_url', () => {
const meta = render(
<FrameMetadata image="https://example.com/image.png" post_url="https://example.com" />,
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const version = '0.5.1';
export const version = '0.5.2';

0 comments on commit ae5b712

Please sign in to comment.