import { parseFromString } from 'dom-parser' import { expect, test } from 'vitest' import { type FrameMetadata } from '../../utils/getFrameMetadata.js' import { parseButtons } from './parseButtons.js' const html = ` ` const dom = parseFromString(html) const nodes = dom.getElementsByTagName('meta') const metadata: FrameMetadata = [] for (const node of nodes) { const property = node.getAttribute( 'property', ) as FrameMetadata[number]['property'] const content = node.getAttribute('content') metadata.push({ property, content }) } test('default', () => { const buttons = parseButtons(metadata) expect(buttons).toEqual([ { title: 'foo', index: 1, type: 'post', }, { title: 'bar', index: 2, target: 'https://example.com', type: 'link', }, { title: 'baz', index: 3, target: 'https://example.com/redirect', type: 'post_redirect', }, { title: 'mint', index: 4, target: 'eip155:7777777:0x060f3edd18c47f59bd23d063bbeb9aa4a8fec6df', type: 'mint', }, ]) })