fix(editor): Show correct schema for output with falsy keys (#9556)

This commit is contained in:
Tomi Turtiainen
2024-05-31 11:33:52 +03:00
committed by GitHub
parent 93fb9b5393
commit 020bd36354
2 changed files with 33 additions and 4 deletions

View File

@@ -84,4 +84,27 @@ describe('RunDataJsonSchema.vue', () => {
});
expect(container).toMatchSnapshot();
});
it('renders no data to show for data empty objects', () => {
const renderResult = renderComponent({
props: {
data: [{}, {}],
},
});
expect(renderResult.getByText(/No data to show/)).toBeInTheDocument();
});
test.each([[[{ tx: false }, { tx: false }]], [[{ tx: '' }, { tx: '' }]], [[{ tx: [] }]]])(
'renders schema instead of showing no data for %o',
(data) => {
const renderResult = renderComponent({
props: {
data,
},
});
expect(renderResult.queryByText(/No data to show/)).not.toBeInTheDocument();
},
);
});