Skip to content

Commit

Permalink
fix: added more tests (#147)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zizzamia authored Feb 19, 2024
1 parent 561906a commit 483a2d5
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/core/getFrameHtmlResponse.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,28 @@ describe('getFrameHtmlResponse', () => {
expect(html).not.toContain('fc:frame:button:4:action');
expect(html).not.toContain('fc:frame:button:4:target');
});

it('should set a target when action is post', () => {
const html = getFrameHtmlResponse({
buttons: [{ label: 'button1', action: 'post', target: 'https://example.com/api/frame7' }],
image: 'image',
});

expect(html).toContain('<meta property="fc:frame:button:1" content="button1" />');
expect(html).toContain('<meta property="fc:frame:button:1:action" content="post" />');
expect(html).toContain(
'<meta property="fc:frame:button:1:target" content="https://example.com/api/frame7" />',
);
expect(html).not.toContain('fc:frame:button:2');
expect(html).not.toContain('fc:frame:button:2:action');
expect(html).not.toContain('fc:frame:button:2:target');
expect(html).not.toContain('fc:frame:button:3');
expect(html).not.toContain('fc:frame:button:3:action');
expect(html).not.toContain('fc:frame:button:3:target');
expect(html).not.toContain('fc:frame:button:4');
expect(html).not.toContain('fc:frame:button:4:action');
expect(html).not.toContain('fc:frame:button:4:target');
});
});

export { getFrameHtmlResponse };

0 comments on commit 483a2d5

Please sign in to comment.