From 6295513bb73dd0058b332744077cb9c2f68e07e1 Mon Sep 17 00:00:00 2001 From: znaim Date: Tue, 22 Oct 2024 16:06:13 -0400 Subject: [PATCH] fixed build --- .../localization/en/protocol_generator.json | 2 +- .../UploadInput/UploadInput.stories.tsx | 74 --------------- .../__tests__/UploadInput.test.tsx | 89 ------------------- 3 files changed, 1 insertion(+), 164 deletions(-) delete mode 100644 opentrons-ai-client/src/molecules/UploadInput/UploadInput.stories.tsx delete mode 100644 opentrons-ai-client/src/molecules/UploadInput/__tests__/UploadInput.test.tsx diff --git a/opentrons-ai-client/src/assets/localization/en/protocol_generator.json b/opentrons-ai-client/src/assets/localization/en/protocol_generator.json index ad07ea04413..65fa6653667 100644 --- a/opentrons-ai-client/src/assets/localization/en/protocol_generator.json +++ b/opentrons-ai-client/src/assets/localization/en/protocol_generator.json @@ -36,7 +36,7 @@ "simulate_description": "Once OpentronsAI has written your protocol, type `simulate` in the prompt box to try it out.", "submit_prompt": "Submit prompt", "try_example_prompts": "Stuck? Try these example prompts to get started.", - "type_of_update" : "Type of update", + "type_of_update": "Type of update", "type_your_prompt": "Type your prompt...", "update_existing_protocol": "Update an existing protocol", "well_allocations": "Well allocations: Describe where liquids should go in labware.", diff --git a/opentrons-ai-client/src/molecules/UploadInput/UploadInput.stories.tsx b/opentrons-ai-client/src/molecules/UploadInput/UploadInput.stories.tsx deleted file mode 100644 index 461e23fd01a..00000000000 --- a/opentrons-ai-client/src/molecules/UploadInput/UploadInput.stories.tsx +++ /dev/null @@ -1,74 +0,0 @@ -import { - ALIGN_CENTER, - COLORS, - DIRECTION_ROW, - DIRECTION_COLUMN, - Flex, - Icon, - Link, - SPACING, - LegacyStyledText, -} from '@opentrons/components' -import { UploadInput as UploadInputComponent } from './index' -import type { Meta, StoryObj } from '@storybook/react' - -const meta: Meta = { - title: 'App/Molecules/UploadInput', - component: UploadInputComponent, - decorators: [ - Story => { - return ( - - - - ) - }, - ], -} - -export default meta - -type Story = StoryObj - -const uploadText = ( - - {'CSV file'} - - -) - -const dragAndDropText = ( - - {'Drag and drop or '} - - browse - {' '} - {' your files'} - -) - -export const CSVFile: Story = { - args: { - onUpload: () => {}, - uploadText, - uploadButtonText: 'Choose file', - dragAndDropText, - }, -} - -export const ProtocolFile: Story = { - args: { - onUpload: () => {}, - uploadText: - 'Valid file types: Python files (.py) or Protocol Designer files (.json)', - dragAndDropText, - }, -} diff --git a/opentrons-ai-client/src/molecules/UploadInput/__tests__/UploadInput.test.tsx b/opentrons-ai-client/src/molecules/UploadInput/__tests__/UploadInput.test.tsx deleted file mode 100644 index 7ba6d6033f5..00000000000 --- a/opentrons-ai-client/src/molecules/UploadInput/__tests__/UploadInput.test.tsx +++ /dev/null @@ -1,89 +0,0 @@ -import { describe, it, expect, vi, beforeEach } from 'vitest' -import '@testing-library/jest-dom/vitest' -import { fireEvent, screen } from '@testing-library/react' -import { BrowserRouter } from 'react-router-dom' -import { - DIRECTION_ROW, - Flex, - Icon, - SPACING, - LegacyStyledText, -} from '@opentrons/components' -import { UploadInput } from '..' -import { renderWithProviders } from '../../../__testing-utils__' -import { i18n } from '../../../i18n' - -describe('UploadInput', () => { - let onUpload: any - - beforeEach(() => { - onUpload = vi.fn() - }) - it('renders correct contents for empty state', () => { - renderWithProviders( - - - , - { - i18nInstance: i18n, - } - ) - - expect(screen.getByRole('button', { name: 'Upload' })).toBeTruthy() - }) - - it('renders text when passing them as props', () => { - const mockUploadText = ( - - {'CSV file'} - - - ) - - renderWithProviders( - - - , - { - i18nInstance: i18n, - } - ) - - screen.getByText('CSV file') - screen.getByTestId('mockIcon') - screen.getByText('Choose file') - }) - - it('opens file select on button click', () => { - renderWithProviders( - - - , - { - i18nInstance: i18n, - } - ) - const button = screen.getByRole('button', { name: 'Upload' }) - const input = screen.getByTestId('file_input') - input.click = vi.fn() - fireEvent.click(button) - expect(input.click).toHaveBeenCalled() - }) - it('calls create session on choose file', () => { - renderWithProviders( - - - , - { - i18nInstance: i18n, - } - ) - const input = screen.getByTestId('file_input') - fireEvent.change(input, { target: { files: ['dummyFile'] } }) - expect(onUpload).toHaveBeenCalledWith('dummyFile') - }) -})