Skip to content

Commit

Permalink
fix: properly display values in QueryBuilderTag
Browse files Browse the repository at this point in the history
  • Loading branch information
simPod committed Feb 4, 2023
1 parent e2ed098 commit 45f3d1f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/Component/QueryBuilderTag.jest.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import {render, screen} from '@testing-library/react'
import '@testing-library/jest-dom'
import { QueryBuilderTag } from "./QueryBuilderTag";
import React from "react";

test.each([
['key="text"', 'text'],
['key=true', true],
['key=1', 1],
['key=null', null],
['key="{"some":"object"}"', {some: 'object'}],
])('displays key-value as %s for %s', async (expectedContent, value) => {
render(<QueryBuilderTag name="key" value={value} onRemove={()=>{}} />)

const element: HTMLSpanElement = screen.getByText(/key/);

expect(element).toBeInTheDocument();
expect(element).toHaveTextContent(expectedContent);
});

0 comments on commit 45f3d1f

Please sign in to comment.