import type { Meta, StoryObj } from "@storybook/vue3-vite"; import { expect, within } from "storybook/test"; import MetadataInspector from "./MetadataInspector.vue"; const meta: Meta = { title: "Flow/MetadataInspector", component: MetadataInspector, tags: ["autodocs"], }; export default meta; type Story = StoryObj; export const Span: Story = { args: { label: "Span · action.completed", data: { kind: "action.completed", durationMs: 12.4, envelope: { messageId: "m-1a2b", correlationId: "c-9f8e", causationId: "m-1a2b", tenant: "acme", userId: "u-42", }, input: { authorId: "demo", body: "hello world", flagged: false }, }, }, play: async ({ canvasElement }) => { const c = within(canvasElement); await expect(c.getAllByTestId("meta-row").length).toBeGreaterThan(3); await expect(c.getByText("envelope.correlationId")).toBeInTheDocument(); }, }; export const Failure: Story = { args: { label: "Span · action.failed", data: { kind: "action.failed", error: { name: "PaymentDeclined", message: "card declined", code: 402 }, envelope: { messageId: "m-7", correlationId: "c-9f8e", causationId: "m-1a2b" }, }, }, }; export const Empty: Story = { args: { label: "Span", data: {} }, play: async ({ canvasElement }) => { await expect(within(canvasElement).getByTestId("meta-empty")).toBeInTheDocument(); }, };