fix(editor): Restrict what binary-data types can be viewed in the UI (#14685)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2025-04-16 18:05:19 +02:00
committed by GitHub
parent 68a87619af
commit 11a36b758d
6 changed files with 93 additions and 29 deletions

View File

@@ -117,8 +117,8 @@ describe('RunData', () => {
expect(getByText('Json data 1')).toBeInTheDocument();
});
it('should render view and download buttons for PDFs', async () => {
const { getByTestId } = render({
it('should render only download buttons for PDFs', async () => {
const { getByTestId, queryByTestId } = render({
defaultRunItems: [
{
json: {},
@@ -135,6 +135,31 @@ describe('RunData', () => {
displayMode: 'binary',
});
await waitFor(() => {
expect(queryByTestId('ndv-view-binary-data')).not.toBeInTheDocument();
expect(getByTestId('ndv-download-binary-data')).toBeInTheDocument();
expect(getByTestId('ndv-binary-data_0')).toBeInTheDocument();
});
});
it('should render view and download buttons for JPEGs', async () => {
const { getByTestId } = render({
defaultRunItems: [
{
json: {},
binary: {
data: {
fileName: 'test.jpg',
fileType: 'image',
mimeType: 'image/jpeg',
data: '',
},
},
},
],
displayMode: 'binary',
});
await waitFor(() => {
expect(getByTestId('ndv-view-binary-data')).toBeInTheDocument();
expect(getByTestId('ndv-download-binary-data')).toBeInTheDocument();