diff --git a/.eslintrc.js b/.eslintrc.js index aee75238df0..ec5e3e3536c 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -180,6 +180,8 @@ module.exports = { files: ['./protocol-designer/src/**/*.@(ts|tsx)'], rules: { 'opentrons/no-imports-up-the-tree-of-life': 'warn', + 'opentrons/no-margins-in-css': 'warn', + 'opentrons/no-margins-inline': 'warn', }, }, // apply application structure import requirements to app @@ -187,6 +189,23 @@ module.exports = { files: ['./app/src/**/*.@(ts|tsx)'], rules: { 'opentrons/no-imports-across-applications': 'error', + 'opentrons/no-margins-in-css': 'warn', + 'opentrons/no-margins-inline': 'warn', + }, + }, + { + files: ['./opentrons-ai-client/src/**/*.@(ts|tsx)'], + rules: { + 'opentrons/no-imports-up-the-tree-of-life': 'warn', + 'opentrons/no-margins-in-css': 'warn', + 'opentrons/no-margins-inline': 'warn', + }, + }, + { + files: ['./components/src/**/*.@(ts|tsx)'], + rules: { + 'opentrons/no-margins-in-css': 'warn', + 'opentrons/no-margins-inline': 'warn', }, }, ], diff --git a/abr-testing/abr_testing/tools/module_control.py b/abr-testing/abr_testing/tools/module_control.py new file mode 100644 index 00000000000..5bc1f5cfb1d --- /dev/null +++ b/abr-testing/abr_testing/tools/module_control.py @@ -0,0 +1,138 @@ +"""Interface with opentrons modules!""" +from serial import Serial # type: ignore[import-untyped] +import asyncio +import subprocess +from typing import Any + +# Generic +_READ_ALL = "readall" +_READ_LINE = "read" +_DONE = "done" + +# TC commands +_MOVE_SEAL = "ms" +_MOVE_LID = "ml" +tc_gcode_shortcuts = { + "status": "M119", + _MOVE_SEAL: "M241.D", # move seal motor + _MOVE_LID: "M240.D", # move lid stepper motor + "ol": "M126", # open lid + "cl": "M127", # close lid + "sw": "M901.D", # status of all switches + "lt": "M141.D", # get lid temperature + "pt": "M105.D", # get plate temperature +} + +# HS Commands +hs_gcode_shortcuts = { + "srpm": "M3 S{rpm}", # Set RPM + "grpm": "M123", # Get RPM + "home": "G28", # Home + "deactivate": "M106", # Deactivate +} + +gcode_shortcuts = tc_gcode_shortcuts | hs_gcode_shortcuts + + +async def message_read(dev: Serial) -> Any: + """Read message.""" + response = dev.readline().decode() + while not response: + await asyncio.sleep(1) + response = dev.readline().decode() + return response + + +async def message_return(dev: Serial) -> Any: + """Wait until message becomes available.""" + try: + response = await asyncio.wait_for(message_read(dev), timeout=30) + return response + except asyncio.exceptions.TimeoutError: + print("response timed out.") + return "" + + +async def handle_module_gcode_shortcut( + dev: Serial, command: str, in_commands: bool, output: str = "" +) -> None: + """Handle debugging commands that require followup.""" + if in_commands: + if command == _MOVE_SEAL: + distance = input("enter distance in steps => ") + dev.write( + f"{gcode_shortcuts[command]} {distance}\n".encode() + ) # (+) -> retract, (-) -> engage + # print(await message_return(dev)) + elif command == _MOVE_LID: + distance = input( + "enter angular distance in degrees => " + ) # (+) -> open, (-) -> close + dev.write(f"{gcode_shortcuts[command]} {distance}\n".encode()) + # print(await message_return(dev)) + # everything else + else: + dev.write(f"{gcode_shortcuts[command]}\n".encode()) + else: + dev.write(f"{command}\n".encode()) + try: + mr = await message_return(dev) + print(mr) + except TypeError: + print("Invalid input") + return + + if output: + try: + with open(output, "a") as result_file: + if "OK" in mr: + status = command + ": SUCCESS" + else: + status = command + ": FAILURE" + result_file.write(status) + result_file.write(f" {mr}") + result_file.close() + except FileNotFoundError: + print(f"cannot open file: {output}") + + +async def comms_loop(dev: Serial, commands: list, output: str = "") -> bool: + """Loop for commands.""" + _exit = False + try: + command = commands.pop(0) + except IndexError: + command = input("\n>>> ") + if command == _READ_ALL: + print(dev.readlines()) + elif command == _READ_LINE: + print(dev.readline()) + elif command == _DONE: + _exit = True + elif command in gcode_shortcuts: + await handle_module_gcode_shortcut(dev, command, True, output) + else: + await handle_module_gcode_shortcut(dev, command, False, output) + return _exit + + +async def _main(module: str, commands: list = [], output: str = "") -> bool: + """Main process.""" + module_name = ( + subprocess.check_output(["find", "/dev/", "-name", f"*{module}*"]) + .decode() + .strip() + ) + if not module_name: + print(f"{module} not found. Exiting.") + return False + dev = Serial(f"{module_name}", 9600, timeout=2) + _exit = False + while not _exit: + _exit = await comms_loop(dev, commands, output) + dev.close() + return True + + +if __name__ == "__main__": + asyncio.run(_main("heatershaker")) diff --git a/abr-testing/abr_testing/tools/test_modules.py b/abr-testing/abr_testing/tools/test_modules.py new file mode 100644 index 00000000000..8c372fbff53 --- /dev/null +++ b/abr-testing/abr_testing/tools/test_modules.py @@ -0,0 +1,155 @@ +"""Modules Tests Script!""" +import asyncio +import time +from datetime import datetime +import os +import module_control # type: ignore +from typing import Any, Tuple, Dict +import traceback + +# To run: +# SSH into robot +# cd /opt/opentrons-robot-server/abr-testing/tools +# python3 test_modules.py + + +async def tc_test_1(module: str, path_to_file: str) -> None: + """Thermocycler Test 1 Open and Close Lid.""" + duration = int(input("How long to run this test for? (in seconds): ")) + start = time.time() + while time.time() - start < duration: + try: + await (tc_open_lid(module, path_to_file)) + except asyncio.TimeoutError: + return + time.sleep(5) + try: + await (tc_close_lid(module, path_to_file)) + except asyncio.TimeoutError: + return + time.sleep(5) + + +async def hs_test_1(module: str, path_to_file: str) -> None: + """Heater Shaker Test 1. (Home and Shake).""" + duration = int(input("How long to run this test for? (in seconds): ")) + rpm = input("Target RPM (200-3000): ") + start = time.time() + while time.time() - start < duration: + try: + await (hs_test_home(module, path_to_file)) + except asyncio.TimeoutError: + return + time.sleep(5) + try: + await (hs_test_set_shake(module, rpm, path_to_file)) + except asyncio.TimeoutError: + return + time.sleep(10) + try: + await (hs_test_set_shake(module, "0", path_to_file)) + except asyncio.TimeoutError: + return + time.sleep(10) + + +async def input_codes(module: str, path_to_file: str) -> None: + """Opens serial for manual code input.""" + await module_control._main(module, output=path_to_file) + + +hs_tests: Dict[str, Tuple[Any, str]] = { + "Test 1": (hs_test_1, "Repeatedly home heater shaker then set shake speed"), + "Input GCodes": (input_codes, "Input g codes"), +} + +tc_tests: Dict[str, Tuple[Any, str]] = { + "Test 1": (tc_test_1, "Repeatedly open and close TC lid"), + "Input GCodes": (input_codes, "Input g codes"), +} + +global modules + +modules = { + "heatershaker": hs_tests, + "thermocycler": tc_tests, +} + + +async def main(module: str) -> None: + """Select test to be run.""" + # Select test to run + # Set directory for tests + BASE_DIRECTORY = "/userfs/data/testing_data/" + if not os.path.exists(BASE_DIRECTORY): + os.makedirs(BASE_DIRECTORY) + tests = modules[module] + for i, test in enumerate(tests.keys()): + function, description = tests[test] + print(f"{i}) {test} : {description}") + selected_test = int(input("Please select a test: ")) + try: + function, description = tests[list(tests.keys())[selected_test]] + test_dir = BASE_DIRECTORY + f"{module}/test/{list(tests.keys())[selected_test]}" + print(f"{i}, {description}") + print(f"TEST DIR: {test_dir}") + date = datetime.now() + filename = f"results_{datetime.strftime(date, '%Y-%m-%d_%H:%M:%S')}.txt" + output_file = os.path.join(test_dir, filename) + try: + if not os.path.exists(test_dir): + os.makedirs(test_dir) + open(output_file, "a").close() + except Exception: + traceback.print_exc() + print(f"PATH: {output_file} ") + await (function(module, output_file)) + except Exception: + print("Failed to run test") + traceback.print_exc() + + +# HS Test Functions +async def hs_test_home(module: str, path_to_file: str) -> None: + """Home heater shaker.""" + hs_gcodes = module_control.hs_gcode_shortcuts + home_gcode = hs_gcodes["home"] + await (module_control._main(module, [home_gcode, "done"], path_to_file)) + + +async def hs_test_set_shake(module: str, rpm: str, path_to_file: str) -> None: + """Shake heater shaker at specified speed.""" + hs_gcodes = module_control.hs_gcode_shortcuts + set_shake_gcode = hs_gcodes["srpm"].format(rpm=rpm) + await (module_control._main(module, [set_shake_gcode, "done"], path_to_file)) + + +async def hs_deactivate(module: str, path_to_file: str) -> None: + """Deactivate Heater Shaker.""" + hs_gcodes = module_control.hs_gcode_shortcuts + deactivate_gcode = hs_gcodes["deactivate"] + await (module_control._main(module, [deactivate_gcode, "done"], path_to_file)) + + +# TC Test Functions +async def tc_open_lid(module: str, path_to_file: str) -> None: + """Open thermocycler lid.""" + tc_gcodes = module_control.tc_gcode_shortcuts + open_lid_gcode = tc_gcodes["ol"] + await (module_control._main(module, [open_lid_gcode, "done"], path_to_file)) + + +async def tc_close_lid(module: str, path_to_file: str) -> None: + """Open thermocycler lid.""" + tc_gcodes = module_control.tc_gcode_shortcuts + close_lid_gcode = tc_gcodes["cl"] + await (module_control._main(module, [close_lid_gcode, "done"], path_to_file)) + + +if __name__ == "__main__": + print("Modules:") + for i, module in enumerate(modules): + print(f"{i}) {module}") + module_int = int(input("Please select a module: ")) + module = list(modules.keys())[module_int] + asyncio.run(main(module)) diff --git a/api/src/opentrons/drivers/asyncio/communication/serial_connection.py b/api/src/opentrons/drivers/asyncio/communication/serial_connection.py index 294e5779a7b..f925cfe8680 100644 --- a/api/src/opentrons/drivers/asyncio/communication/serial_connection.py +++ b/api/src/opentrons/drivers/asyncio/communication/serial_connection.py @@ -298,6 +298,7 @@ async def create( alarm_keyword: Optional[str] = None, reset_buffer_before_write: bool = False, async_error_ack: Optional[str] = None, + number_of_retries: int = 0, ) -> AsyncResponseSerialConnection: """ Create a connection. @@ -340,6 +341,7 @@ async def create( error_keyword=error_keyword or "err", alarm_keyword=alarm_keyword or "alarm", async_error_ack=async_error_ack or "async", + number_of_retries=number_of_retries, ) def __init__( @@ -352,6 +354,7 @@ def __init__( error_keyword: str, alarm_keyword: str, async_error_ack: str, + number_of_retries: int = 0, ) -> None: """ Constructor @@ -383,6 +386,7 @@ def __init__( self._name = name self._ack = ack.encode() self._retry_wait_time_seconds = retry_wait_time_seconds + self._number_of_retries = number_of_retries self._error_keyword = error_keyword.lower() self._alarm_keyword = alarm_keyword.lower() self._async_error_ack = async_error_ack.lower() @@ -403,7 +407,9 @@ async def send_command( Raises: SerialException """ return await self.send_data( - data=command.build(), retries=retries, timeout=timeout + data=command.build(), + retries=retries or self._number_of_retries, + timeout=timeout, ) async def send_data( @@ -424,7 +430,9 @@ async def send_data( async with super().send_data_lock, self._serial.timeout_override( "timeout", timeout ): - return await self._send_data(data=data, retries=retries) + return await self._send_data( + data=data, retries=retries or self._number_of_retries + ) async def _send_data(self, data: str, retries: int = 0) -> str: """ @@ -439,6 +447,7 @@ async def _send_data(self, data: str, retries: int = 0) -> str: Raises: SerialException """ data_encode = data.encode() + retries = retries or self._number_of_retries for retry in range(retries + 1): log.debug(f"{self._name}: Write -> {data_encode!r}") diff --git a/api/src/opentrons/drivers/command_builder.py b/api/src/opentrons/drivers/command_builder.py index 99ac5c7890c..ea90a12b946 100644 --- a/api/src/opentrons/drivers/command_builder.py +++ b/api/src/opentrons/drivers/command_builder.py @@ -6,7 +6,7 @@ class CommandBuilder: """Class used to build GCODE commands.""" - def __init__(self, terminator: str) -> None: + def __init__(self, terminator: str = "\n") -> None: """ Construct a command builder. @@ -17,7 +17,7 @@ def __init__(self, terminator: str) -> None: self._elements: List[str] = [] def add_float( - self, prefix: str, value: float, precision: Optional[int] + self, prefix: str, value: float, precision: Optional[int] = None ) -> CommandBuilder: """ Add a float value. diff --git a/api/src/opentrons/drivers/flex_stacker/__init__.py b/api/src/opentrons/drivers/flex_stacker/__init__.py new file mode 100644 index 00000000000..cd4866c179a --- /dev/null +++ b/api/src/opentrons/drivers/flex_stacker/__init__.py @@ -0,0 +1,9 @@ +from .abstract import AbstractStackerDriver +from .driver import FlexStackerDriver +from .simulator import SimulatingDriver + +__all__ = [ + "AbstractStackerDriver", + "FlexStackerDriver", + "SimulatingDriver", +] diff --git a/api/src/opentrons/drivers/flex_stacker/abstract.py b/api/src/opentrons/drivers/flex_stacker/abstract.py new file mode 100644 index 00000000000..5ba3cdcb026 --- /dev/null +++ b/api/src/opentrons/drivers/flex_stacker/abstract.py @@ -0,0 +1,89 @@ +from typing import Protocol + +from .types import ( + StackerAxis, + PlatformStatus, + Direction, + MoveParams, + StackerInfo, + LEDColor, +) + + +class AbstractStackerDriver(Protocol): + """Protocol for the Stacker driver.""" + + async def connect(self) -> None: + """Connect to stacker.""" + ... + + async def disconnect(self) -> None: + """Disconnect from stacker.""" + ... + + async def is_connected(self) -> bool: + """Check connection to stacker.""" + ... + + async def update_firmware(self, firmware_file_path: str) -> None: + """Updates the firmware on the device.""" + ... + + async def get_device_info(self) -> StackerInfo: + """Get Device Info.""" + ... + + async def set_serial_number(self, sn: str) -> bool: + """Set Serial Number.""" + ... + + async def stop_motors(self) -> bool: + """Stop all motor movement.""" + ... + + async def get_limit_switch(self, axis: StackerAxis, direction: Direction) -> bool: + """Get limit switch status. + + :return: True if limit switch is triggered, False otherwise + """ + ... + + async def get_platform_sensor(self, direction: Direction) -> bool: + """Get platform sensor status. + + :return: True if platform is present, False otherwise + """ + ... + + async def get_platform_status(self) -> PlatformStatus: + """Get platform status.""" + ... + + async def get_hopper_door_closed(self) -> bool: + """Get whether or not door is closed. + + :return: True if door is closed, False otherwise + """ + ... + + async def move_in_mm( + self, axis: StackerAxis, distance: float, params: MoveParams | None = None + ) -> bool: + """Move axis.""" + ... + + async def move_to_limit_switch( + self, axis: StackerAxis, direction: Direction, params: MoveParams | None = None + ) -> bool: + """Move until limit switch is triggered.""" + ... + + async def home_axis(self, axis: StackerAxis, direction: Direction) -> bool: + """Home axis.""" + ... + + async def set_led( + self, power: float, color: LEDColor | None = None, external: bool | None = None + ) -> bool: + """Set LED color of status bar.""" + ... diff --git a/api/src/opentrons/drivers/flex_stacker/driver.py b/api/src/opentrons/drivers/flex_stacker/driver.py new file mode 100644 index 00000000000..83671023772 --- /dev/null +++ b/api/src/opentrons/drivers/flex_stacker/driver.py @@ -0,0 +1,260 @@ +import asyncio +import re +from typing import Optional + +from opentrons.drivers.command_builder import CommandBuilder +from opentrons.drivers.asyncio.communication import AsyncResponseSerialConnection + +from .abstract import AbstractStackerDriver +from .types import ( + GCODE, + StackerAxis, + PlatformStatus, + Direction, + StackerInfo, + HardwareRevision, + MoveParams, + LimitSwitchStatus, + LEDColor, +) + + +FS_BAUDRATE = 115200 +DEFAULT_FS_TIMEOUT = 40 +FS_ACK = "OK\n" +FS_ERROR_KEYWORD = "err" +FS_ASYNC_ERROR_ACK = "async" +DEFAULT_COMMAND_RETRIES = 0 +GCODE_ROUNDING_PRECISION = 2 + + +class FlexStackerDriver(AbstractStackerDriver): + """FLEX Stacker driver.""" + + @classmethod + def parse_device_info(cls, response: str) -> StackerInfo: + """Parse stacker info.""" + # TODO: Validate serial number format once established + _RE = re.compile( + f"^{GCODE.DEVICE_INFO} FW:(?P\\S+) HW:Opentrons-flex-stacker-(?P\\S+) SerialNo:(?P\\S+)$" + ) + m = _RE.match(response) + if not m: + raise ValueError(f"Incorrect Response for device info: {response}") + return StackerInfo( + m.group("fw"), HardwareRevision(m.group("hw")), m.group("sn") + ) + + @classmethod + def parse_limit_switch_status(cls, response: str) -> LimitSwitchStatus: + """Parse limit switch statuses.""" + field_names = LimitSwitchStatus.get_fields() + pattern = r"\s".join([rf"{name}:(?P<{name}>\d)" for name in field_names]) + _RE = re.compile(f"^{GCODE.GET_LIMIT_SWITCH} {pattern}$") + m = _RE.match(response) + if not m: + raise ValueError(f"Incorrect Response for limit switch status: {response}") + return LimitSwitchStatus(*(bool(int(m.group(name))) for name in field_names)) + + @classmethod + def parse_platform_sensor_status(cls, response: str) -> PlatformStatus: + """Parse platform statuses.""" + field_names = PlatformStatus.get_fields() + pattern = r"\s".join([rf"{name}:(?P<{name}>\d)" for name in field_names]) + _RE = re.compile(f"^{GCODE.GET_PLATFORM_SENSOR} {pattern}$") + m = _RE.match(response) + if not m: + raise ValueError(f"Incorrect Response for platform status: {response}") + return PlatformStatus(*(bool(int(m.group(name))) for name in field_names)) + + @classmethod + def parse_door_closed(cls, response: str) -> bool: + """Parse door closed.""" + _RE = re.compile(r"^M122 D:(\d)$") + match = _RE.match(response) + if not match: + raise ValueError(f"Incorrect Response for door closed: {response}") + return bool(int(match.group(1))) + + @classmethod + def append_move_params( + cls, command: CommandBuilder, params: MoveParams | None + ) -> CommandBuilder: + """Append move params.""" + if params is not None: + if params.max_speed is not None: + command.add_float("V", params.max_speed, GCODE_ROUNDING_PRECISION) + if params.acceleration is not None: + command.add_float("A", params.acceleration, GCODE_ROUNDING_PRECISION) + if params.max_speed_discont is not None: + command.add_float( + "D", params.max_speed_discont, GCODE_ROUNDING_PRECISION + ) + return command + + @classmethod + async def create( + cls, port: str, loop: Optional[asyncio.AbstractEventLoop] + ) -> "FlexStackerDriver": + """Create a FLEX Stacker driver.""" + connection = await AsyncResponseSerialConnection.create( + port=port, + baud_rate=FS_BAUDRATE, + timeout=DEFAULT_FS_TIMEOUT, + number_of_retries=DEFAULT_COMMAND_RETRIES, + ack=FS_ACK, + loop=loop, + error_keyword=FS_ERROR_KEYWORD, + async_error_ack=FS_ASYNC_ERROR_ACK, + ) + return cls(connection) + + def __init__(self, connection: AsyncResponseSerialConnection) -> None: + """ + Constructor + + Args: + connection: Connection to the FLEX Stacker + """ + self._connection = connection + + async def connect(self) -> None: + """Connect to stacker.""" + await self._connection.open() + + async def disconnect(self) -> None: + """Disconnect from stacker.""" + await self._connection.close() + + async def is_connected(self) -> bool: + """Check connection to stacker.""" + return await self._connection.is_open() + + async def get_device_info(self) -> StackerInfo: + """Get Device Info.""" + response = await self._connection.send_command( + GCODE.DEVICE_INFO.build_command() + ) + await self._connection.send_command(GCODE.GET_RESET_REASON.build_command()) + return self.parse_device_info(response) + + async def set_serial_number(self, sn: str) -> bool: + """Set Serial Number.""" + # TODO: validate the serial number format + resp = await self._connection.send_command( + GCODE.SET_SERIAL_NUMBER.build_command().add_element(sn) + ) + if not re.match(rf"^{GCODE.SET_SERIAL_NUMBER}$", resp): + raise ValueError(f"Incorrect Response for set serial number: {resp}") + return True + + async def stop_motors(self) -> bool: + """Stop all motor movement.""" + resp = await self._connection.send_command(GCODE.STOP_MOTORS.build_command()) + if not re.match(rf"^{GCODE.STOP_MOTORS}$", resp): + raise ValueError(f"Incorrect Response for stop motors: {resp}") + return True + + async def get_limit_switch(self, axis: StackerAxis, direction: Direction) -> bool: + """Get limit switch status. + + :return: True if limit switch is triggered, False otherwise + """ + response = await self.get_limit_switches_status() + return response.get(axis, direction) + + async def get_limit_switches_status(self) -> LimitSwitchStatus: + """Get limit switch statuses for all axes.""" + response = await self._connection.send_command( + GCODE.GET_LIMIT_SWITCH.build_command() + ) + return self.parse_limit_switch_status(response) + + async def get_platform_sensor(self, direction: Direction) -> bool: + """Get platform sensor at one direction.""" + response = await self.get_platform_status() + return response.get(direction) + + async def get_platform_status(self) -> PlatformStatus: + """Get platform sensor status. + + :return: True if platform is detected, False otherwise + """ + response = await self._connection.send_command( + GCODE.GET_PLATFORM_SENSOR.build_command() + ) + return self.parse_platform_sensor_status(response) + + async def get_hopper_door_closed(self) -> bool: + """Get whether or not door is closed. + + :return: True if door is closed, False otherwise + """ + response = await self._connection.send_command( + GCODE.GET_DOOR_SWITCH.build_command() + ) + return self.parse_door_closed(response) + + async def move_in_mm( + self, axis: StackerAxis, distance: float, params: MoveParams | None = None + ) -> bool: + """Move axis.""" + command = self.append_move_params( + GCODE.MOVE_TO.build_command().add_float( + axis.name, distance, GCODE_ROUNDING_PRECISION + ), + params, + ) + resp = await self._connection.send_command(command) + if not re.match(rf"^{GCODE.MOVE_TO}$", resp): + raise ValueError(f"Incorrect Response for move to: {resp}") + return True + + async def move_to_limit_switch( + self, axis: StackerAxis, direction: Direction, params: MoveParams | None = None + ) -> bool: + """Move until limit switch is triggered.""" + command = self.append_move_params( + GCODE.MOVE_TO_SWITCH.build_command().add_int(axis.name, direction.value), + params, + ) + resp = await self._connection.send_command(command) + if not re.match(rf"^{GCODE.MOVE_TO_SWITCH}$", resp): + raise ValueError(f"Incorrect Response for move to switch: {resp}") + return True + + async def home_axis(self, axis: StackerAxis, direction: Direction) -> bool: + """Home axis.""" + resp = await self._connection.send_command( + GCODE.HOME_AXIS.build_command().add_int(axis.name, direction.value) + ) + if not re.match(rf"^{GCODE.HOME_AXIS}$", resp): + raise ValueError(f"Incorrect Response for home axis: {resp}") + return True + + async def set_led( + self, power: float, color: LEDColor | None = None, external: bool | None = None + ) -> bool: + """Set LED color. + + :param power: Power of the LED (0-1.0), 0 is off, 1 is full power + :param color: Color of the LED + :param external: True if external LED, False if internal LED + """ + power = max(0, min(power, 1.0)) + command = GCODE.SET_LED.build_command().add_float( + "P", power, GCODE_ROUNDING_PRECISION + ) + if color is not None: + command.add_int("C", color.value) + if external is not None: + command.add_int("E", external) + resp = await self._connection.send_command(command) + if not re.match(rf"^{GCODE.SET_LED}$", resp): + raise ValueError(f"Incorrect Response for set led: {resp}") + return True + + async def update_firmware(self, firmware_file_path: str) -> None: + """Updates the firmware on the device.""" + # TODO: Implement firmware update + pass diff --git a/api/src/opentrons/drivers/flex_stacker/simulator.py b/api/src/opentrons/drivers/flex_stacker/simulator.py new file mode 100644 index 00000000000..1e0b59b19de --- /dev/null +++ b/api/src/opentrons/drivers/flex_stacker/simulator.py @@ -0,0 +1,109 @@ +from typing import Optional + +from opentrons.util.async_helpers import ensure_yield + +from .abstract import AbstractStackerDriver +from .types import ( + StackerAxis, + PlatformStatus, + Direction, + StackerInfo, + HardwareRevision, + MoveParams, + LimitSwitchStatus, +) + + +class SimulatingDriver(AbstractStackerDriver): + """FLEX Stacker driver simulator.""" + + def __init__(self, serial_number: Optional[str] = None) -> None: + self._sn = serial_number or "dummySerialFS" + self._limit_switch_status = LimitSwitchStatus(False, False, False, False, False) + self._platform_sensor_status = PlatformStatus(False, False) + self._door_closed = True + + def set_limit_switch(self, status: LimitSwitchStatus) -> bool: + self._limit_switch_status = status + return True + + def set_platform_sensor(self, status: PlatformStatus) -> bool: + self._platform_sensor_status = status + return True + + def set_door_closed(self, door_closed: bool) -> bool: + self._door_closed = door_closed + return True + + @ensure_yield + async def connect(self) -> None: + """Connect to stacker.""" + pass + + @ensure_yield + async def disconnect(self) -> None: + """Disconnect from stacker.""" + pass + + @ensure_yield + async def is_connected(self) -> bool: + """Check connection to stacker.""" + return True + + @ensure_yield + async def get_device_info(self) -> StackerInfo: + """Get Device Info.""" + return StackerInfo(fw="stacker-fw", hw=HardwareRevision.EVT, sn=self._sn) + + @ensure_yield + async def set_serial_number(self, sn: str) -> bool: + """Set Serial Number.""" + return True + + @ensure_yield + async def stop_motor(self) -> bool: + """Stop motor movement.""" + return True + + @ensure_yield + async def get_limit_switch(self, axis: StackerAxis, direction: Direction) -> bool: + """Get limit switch status. + + :return: True if limit switch is triggered, False otherwise + """ + return self._limit_switch_status.get(axis, direction) + + @ensure_yield + async def get_limit_switches_status(self) -> LimitSwitchStatus: + """Get limit switch statuses for all axes.""" + return self._limit_switch_status + + @ensure_yield + async def get_platform_sensor_status(self) -> PlatformStatus: + """Get platform sensor status. + + :return: True if platform is detected, False otherwise + """ + return self._platform_sensor_status + + @ensure_yield + async def get_hopper_door_closed(self) -> bool: + """Get whether or not door is closed. + + :return: True if door is closed, False otherwise + """ + return self._door_closed + + @ensure_yield + async def move_in_mm( + self, axis: StackerAxis, distance: float, params: MoveParams | None = None + ) -> bool: + """Move axis.""" + return True + + @ensure_yield + async def move_to_limit_switch( + self, axis: StackerAxis, direction: Direction, params: MoveParams | None = None + ) -> bool: + """Move until limit switch is triggered.""" + return True diff --git a/api/src/opentrons/drivers/flex_stacker/types.py b/api/src/opentrons/drivers/flex_stacker/types.py new file mode 100644 index 00000000000..4035aaaa755 --- /dev/null +++ b/api/src/opentrons/drivers/flex_stacker/types.py @@ -0,0 +1,138 @@ +from enum import Enum +from dataclasses import dataclass, fields +from typing import List + +from opentrons.drivers.command_builder import CommandBuilder + + +class GCODE(str, Enum): + + MOVE_TO = "G0" + MOVE_TO_SWITCH = "G5" + HOME_AXIS = "G28" + STOP_MOTORS = "M0" + GET_RESET_REASON = "M114" + DEVICE_INFO = "M115" + GET_LIMIT_SWITCH = "M119" + SET_LED = "M200" + GET_PLATFORM_SENSOR = "M121" + GET_DOOR_SWITCH = "M122" + SET_SERIAL_NUMBER = "M996" + ENTER_BOOTLOADER = "dfu" + + def build_command(self) -> CommandBuilder: + """Build command.""" + return CommandBuilder().add_gcode(self) + + +STACKER_VID = 0x483 +STACKER_PID = 0xEF24 +STACKER_FREQ = 115200 + + +class HardwareRevision(Enum): + """Hardware Revision.""" + + NFF = "nff" + EVT = "a1" + + +@dataclass +class StackerInfo: + """Stacker Info.""" + + fw: str + hw: HardwareRevision + sn: str + + +class StackerAxis(Enum): + """Stacker Axis.""" + + X = "X" + Z = "Z" + L = "L" + + def __str__(self) -> str: + """Name.""" + return self.name + + +class LEDColor(Enum): + """Stacker LED Color.""" + + WHITE = 0 + RED = 1 + GREEN = 2 + BLUE = 3 + + +class Direction(Enum): + """Direction.""" + + RETRACT = 0 # negative + EXTENT = 1 # positive + + def __str__(self) -> str: + """Convert to tag for clear logging.""" + return "negative" if self == Direction.RETRACT else "positive" + + def opposite(self) -> "Direction": + """Get opposite direction.""" + return Direction.EXTENT if self == Direction.RETRACT else Direction.RETRACT + + def distance(self, distance: float) -> float: + """Get signed distance, where retract direction is negative.""" + return distance * -1 if self == Direction.RETRACT else distance + + +@dataclass +class LimitSwitchStatus: + """Stacker Limit Switch Statuses.""" + + XE: bool + XR: bool + ZE: bool + ZR: bool + LR: bool + + @classmethod + def get_fields(cls) -> List[str]: + """Get fields.""" + return [f.name for f in fields(cls)] + + def get(self, axis: StackerAxis, direction: Direction) -> bool: + """Get limit switch status.""" + if axis == StackerAxis.X: + return self.XE if direction == Direction.EXTENT else self.XR + if axis == StackerAxis.Z: + return self.ZE if direction == Direction.EXTENT else self.ZR + if direction == Direction.EXTENT: + raise ValueError("Latch does not have extent limit switch") + return self.LR + + +@dataclass +class PlatformStatus: + """Stacker Platform Statuses.""" + + E: bool + R: bool + + @classmethod + def get_fields(cls) -> List[str]: + """Get fields.""" + return [f.name for f in fields(cls)] + + def get(self, direction: Direction) -> bool: + """Get platform status.""" + return self.E if direction == Direction.EXTENT else self.R + + +@dataclass +class MoveParams: + """Move Parameters.""" + + max_speed: float | None = None + acceleration: float | None = None + max_speed_discont: float | None = None diff --git a/api/src/opentrons/hardware_control/backends/ot3controller.py b/api/src/opentrons/hardware_control/backends/ot3controller.py index cdbd8818111..84ffbffd8da 100644 --- a/api/src/opentrons/hardware_control/backends/ot3controller.py +++ b/api/src/opentrons/hardware_control/backends/ot3controller.py @@ -1072,6 +1072,7 @@ def _build_attached_pip( converted_name.pipette_type, converted_name.pipette_channels, converted_name.pipette_version, + converted_name.oem_type, ), "id": OT3Controller._combine_serial_number(attached), } diff --git a/api/src/opentrons/hardware_control/backends/ot3simulator.py b/api/src/opentrons/hardware_control/backends/ot3simulator.py index 10f4ebcfe2a..b7466386be6 100644 --- a/api/src/opentrons/hardware_control/backends/ot3simulator.py +++ b/api/src/opentrons/hardware_control/backends/ot3simulator.py @@ -511,6 +511,7 @@ def _attached_pipette_to_mount( converted_name.pipette_type, converted_name.pipette_channels, converted_name.pipette_version, + converted_name.oem_type, ), "id": None, } @@ -533,6 +534,7 @@ def _attached_pipette_to_mount( converted_name.pipette_type, converted_name.pipette_channels, converted_name.pipette_version, + converted_name.oem_type, ), "id": init_instr["id"], } @@ -544,6 +546,7 @@ def _attached_pipette_to_mount( converted_name.pipette_type, converted_name.pipette_channels, converted_name.pipette_version, + converted_name.oem_type, ), "id": None, } diff --git a/api/src/opentrons/hardware_control/instruments/ot2/pipette.py b/api/src/opentrons/hardware_control/instruments/ot2/pipette.py index 0881999d435..2205da161f1 100644 --- a/api/src/opentrons/hardware_control/instruments/ot2/pipette.py +++ b/api/src/opentrons/hardware_control/instruments/ot2/pipette.py @@ -56,6 +56,7 @@ UlPerMmAction, PipetteName, PipetteModel, + PipetteOEMType, ) from opentrons.hardware_control.dev_types import InstrumentHardwareConfigs @@ -112,17 +113,20 @@ def __init__( pipette_type=config.pipette_type, pipette_channels=config.channels, pipette_generation=config.display_category, + oem_type=PipetteOEMType.OT, ) self._acting_as = self._pipette_name self._pipette_model = PipetteModelVersionType( pipette_type=config.pipette_type, pipette_channels=config.channels, pipette_version=config.version, + oem_type=PipetteOEMType.OT, ) self._valid_nozzle_maps = load_pipette_data.load_valid_nozzle_maps( self._pipette_model.pipette_type, self._pipette_model.pipette_channels, self._pipette_model.pipette_version, + PipetteOEMType.OT, ) self._nozzle_offset = self._config.nozzle_offset self._nozzle_manager = ( @@ -189,7 +193,7 @@ def act_as(self, name: PipetteNameType) -> None: ], f"{self.name} is not back-compatible with {name}" liquid_model = load_pipette_data.load_liquid_model( - name.pipette_type, name.pipette_channels, name.get_version() + name.pipette_type, name.pipette_channels, name.get_version(), name.oem_type ) # TODO need to grab name config here to deal with act as test self._liquid_class.max_volume = liquid_model["default"].max_volume @@ -280,6 +284,7 @@ def reload_configurations(self) -> None: self._pipette_model.pipette_type, self._pipette_model.pipette_channels, self._pipette_model.pipette_version, + self._pipette_model.oem_type, ) self._config_as_dict = self._config.model_dump() diff --git a/api/src/opentrons/hardware_control/instruments/ot3/pipette.py b/api/src/opentrons/hardware_control/instruments/ot3/pipette.py index 6098b88b964..bd7671d745d 100644 --- a/api/src/opentrons/hardware_control/instruments/ot3/pipette.py +++ b/api/src/opentrons/hardware_control/instruments/ot3/pipette.py @@ -42,6 +42,7 @@ PipetteName, PipetteModel, Quirks, + PipetteOEMType, ) from opentrons_shared_data.pipette import ( load_data as load_pipette_data, @@ -93,22 +94,26 @@ def __init__( self._liquid_class_name = pip_types.LiquidClasses.default self._liquid_class = self._config.liquid_properties[self._liquid_class_name] + oem = PipetteOEMType.get_oem_from_quirks(config.quirks) # TODO (lc 12-05-2022) figure out how we can safely deprecate "name" and "model" self._pipette_name = PipetteNameType( pipette_type=config.pipette_type, pipette_channels=config.channels, pipette_generation=config.display_category, + oem_type=oem, ) self._acting_as = self._pipette_name self._pipette_model = PipetteModelVersionType( pipette_type=config.pipette_type, pipette_channels=config.channels, pipette_version=config.version, + oem_type=oem, ) self._valid_nozzle_maps = load_pipette_data.load_valid_nozzle_maps( self._pipette_model.pipette_type, self._pipette_model.pipette_channels, self._pipette_model.pipette_version, + self._pipette_model.oem_type, ) self._nozzle_offset = self._config.nozzle_offset self._nozzle_manager = ( @@ -250,6 +255,7 @@ def reload_configurations(self) -> None: self._pipette_model.pipette_type, self._pipette_model.pipette_channels, self._pipette_model.pipette_version, + self._pipette_model.oem_type, ) self._config_as_dict = self._config.model_dump() diff --git a/api/src/opentrons/hardware_control/instruments/ot3/pipette_handler.py b/api/src/opentrons/hardware_control/instruments/ot3/pipette_handler.py index 8e4975b3b5b..ef081b95a62 100644 --- a/api/src/opentrons/hardware_control/instruments/ot3/pipette_handler.py +++ b/api/src/opentrons/hardware_control/instruments/ot3/pipette_handler.py @@ -237,6 +237,7 @@ def get_attached_instrument(self, mount: OT3Mount) -> PipetteDict: "back_compat_names", "supported_tips", "lld_settings", + "available_sensors", ] instr_dict = instr.as_dict() @@ -289,6 +290,7 @@ def get_attached_instrument(self, mount: OT3Mount) -> PipetteDict: "drop_tip": instr.plunger_positions.drop_tip, } result["shaft_ul_per_mm"] = instr.config.shaft_ul_per_mm + result["available_sensors"] = instr.config.available_sensors return cast(PipetteDict, result) @property diff --git a/api/src/opentrons/protocol_api/validation.py b/api/src/opentrons/protocol_api/validation.py index f0db8a71e5e..cd1e5112718 100644 --- a/api/src/opentrons/protocol_api/validation.py +++ b/api/src/opentrons/protocol_api/validation.py @@ -72,6 +72,7 @@ "flex_8channel_50": PipetteNameType.P50_MULTI_FLEX, "flex_1channel_1000": PipetteNameType.P1000_SINGLE_FLEX, "flex_8channel_1000": PipetteNameType.P1000_MULTI_FLEX, + "flex_8channel_1000_em": PipetteNameType.P1000_MULTI_EM, "flex_96channel_1000": PipetteNameType.P1000_96, "flex_96channel_200": PipetteNameType.P200_96, } diff --git a/api/src/opentrons/protocol_engine/resources/pipette_data_provider.py b/api/src/opentrons/protocol_engine/resources/pipette_data_provider.py index 4df6b0d4d77..ee721c88f2c 100644 --- a/api/src/opentrons/protocol_engine/resources/pipette_data_provider.py +++ b/api/src/opentrons/protocol_engine/resources/pipette_data_provider.py @@ -98,6 +98,7 @@ def configure_virtual_pipette_nozzle_layout( config.pipette_type, config.channels, config.version, + pip_types.PipetteOEMType.OT, ) new_nozzle_manager = NozzleConfigurationManager.build_from_config( config, valid_nozzle_maps @@ -130,6 +131,7 @@ def configure_virtual_pipette_for_volume( pipette_model.pipette_type, pipette_model.pipette_channels, pipette_model.pipette_version, + pipette_model.oem_type, ) liquid_class = pipette_definition.liquid_class_for_volume_between_default_and_defaultlowvolume( @@ -163,6 +165,7 @@ def _get_virtual_pipette_full_config_by_model_string( pipette_model.pipette_type, pipette_model.pipette_channels, pipette_model.pipette_version, + pipette_model.oem_type, ) def _get_virtual_pipette_static_config_by_model( # noqa: C901 @@ -179,6 +182,7 @@ def _get_virtual_pipette_static_config_by_model( # noqa: C901 pipette_model.pipette_type, pipette_model.pipette_channels, pipette_model.pipette_version, + pipette_model.oem_type, ) try: tip_type = pip_types.PipetteTipType( @@ -195,6 +199,7 @@ def _get_virtual_pipette_static_config_by_model( # noqa: C901 pipette_model.pipette_type, pipette_model.pipette_channels, pipette_model.pipette_version, + pipette_model.oem_type, ) if pipette_id not in self._nozzle_manager_layout_by_id: nozzle_manager = NozzleConfigurationManager.build_from_config( diff --git a/api/tests/opentrons/drivers/flex_stacker/__init__.py b/api/tests/opentrons/drivers/flex_stacker/__init__.py new file mode 100644 index 00000000000..e69de29bb2d diff --git a/api/tests/opentrons/drivers/flex_stacker/test_driver.py b/api/tests/opentrons/drivers/flex_stacker/test_driver.py new file mode 100644 index 00000000000..aea2492cf9e --- /dev/null +++ b/api/tests/opentrons/drivers/flex_stacker/test_driver.py @@ -0,0 +1,257 @@ +import pytest +from mock import AsyncMock +from opentrons.drivers.asyncio.communication.serial_connection import ( + AsyncResponseSerialConnection, +) +from opentrons.drivers.flex_stacker.driver import FlexStackerDriver +from opentrons.drivers.flex_stacker import types + + +@pytest.fixture +def connection() -> AsyncMock: + return AsyncMock(spec=AsyncResponseSerialConnection) + + +@pytest.fixture +def subject(connection: AsyncMock) -> FlexStackerDriver: + connection.send_command.return_value = "" + return FlexStackerDriver(connection) + + +async def test_get_device_info( + subject: FlexStackerDriver, connection: AsyncMock +) -> None: + """It should send a get device info command""" + connection.send_command.return_value = ( + "M115 FW:0.0.1 HW:Opentrons-flex-stacker-a1 SerialNo:STCA120230605001" + ) + response = await subject.get_device_info() + assert response == types.StackerInfo( + fw="0.0.1", + hw=types.HardwareRevision.EVT, + sn="STCA120230605001", + ) + + device_info = types.GCODE.DEVICE_INFO.build_command() + reset_reason = types.GCODE.GET_RESET_REASON.build_command() + connection.send_command.assert_any_call(device_info) + connection.send_command.assert_called_with(reset_reason) + connection.reset_mock() + + # Test invalid response + connection.send_command.return_value = "M115 FW:0.0.1 SerialNo:STCA120230605001" + + # This should raise ValueError + with pytest.raises(ValueError): + response = await subject.get_device_info() + + device_info = types.GCODE.DEVICE_INFO.build_command() + reset_reason = types.GCODE.GET_RESET_REASON.build_command() + connection.send_command.assert_any_call(device_info) + connection.send_command.assert_called_with(reset_reason) + + +async def test_stop_motors(subject: FlexStackerDriver, connection: AsyncMock) -> None: + """It should send a stop motors command""" + connection.send_command.return_value = "M0" + response = await subject.stop_motors() + assert response + + stop_motors = types.GCODE.STOP_MOTORS.build_command() + connection.send_command.assert_any_call(stop_motors) + connection.reset_mock() + + # This should raise ValueError + with pytest.raises(ValueError): + await subject.get_device_info() + + +async def test_set_serial_number( + subject: FlexStackerDriver, connection: AsyncMock +) -> None: + """It should send a set serial number command""" + connection.send_command.return_value = "M996" + + serial_number = "Something" + response = await subject.set_serial_number(serial_number) + assert response + + set_serial_number = types.GCODE.SET_SERIAL_NUMBER.build_command().add_element( + serial_number + ) + connection.send_command.assert_any_call(set_serial_number) + connection.reset_mock() + + # Test invalid response + connection.send_command.return_value = "M9nn" + with pytest.raises(ValueError): + response = await subject.set_serial_number(serial_number) + + set_serial_number = types.GCODE.SET_SERIAL_NUMBER.build_command().add_element( + serial_number + ) + connection.send_command.assert_any_call(set_serial_number) + connection.reset_mock() + + +async def test_get_limit_switch( + subject: FlexStackerDriver, connection: AsyncMock +) -> None: + """It should send a get limit switch command and return the boolean of one.""" + connection.send_command.return_value = "M119 XE:1 XR:0 ZE:0 ZR:1 LR:1" + response = await subject.get_limit_switch( + types.StackerAxis.X, types.Direction.EXTENT + ) + assert response + + limit_switch_status = types.GCODE.GET_LIMIT_SWITCH.build_command() + connection.send_command.assert_any_call(limit_switch_status) + connection.reset_mock() + + +async def test_get_limit_switches_status( + subject: FlexStackerDriver, connection: AsyncMock +) -> None: + """It should send a get limit switch status and return LimitSwitchStatus.""" + connection.send_command.return_value = "M119 XE:1 XR:0 ZE:0 ZR:1 LR:1" + response = await subject.get_limit_switches_status() + assert response == types.LimitSwitchStatus( + XE=True, + XR=False, + ZE=False, + ZR=True, + LR=True, + ) + + limit_switch_status = types.GCODE.GET_LIMIT_SWITCH.build_command() + connection.send_command.assert_any_call(limit_switch_status) + connection.reset_mock() + + # Test invalid response + connection.send_command.return_value = "M119 XE:b XR:0 ZE:a ZR:1 LR:n" + with pytest.raises(ValueError): + response = await subject.get_limit_switches_status() + + limit_switch_status = types.GCODE.GET_LIMIT_SWITCH.build_command() + connection.send_command.assert_any_call(limit_switch_status) + + +async def test_get_platform_sensor( + subject: FlexStackerDriver, connection: AsyncMock +) -> None: + """It should send a get platform sensor command return status of specified sensor.""" + connection.send_command.return_value = "M121 E:1 R:1" + response = await subject.get_platform_sensor(types.Direction.EXTENT) + assert response + + platform_sensor = types.GCODE.GET_PLATFORM_SENSOR.build_command() + connection.send_command.assert_any_call(platform_sensor) + connection.reset_mock() + + +async def test_get_platform_status( + subject: FlexStackerDriver, connection: AsyncMock +) -> None: + """it should send a get platform sensors status.""" + connection.send_command.return_value = "M121 E:0 R:1" + response = await subject.get_platform_status() + assert response == types.PlatformStatus( + E=False, + R=True, + ) + + platform_status = types.GCODE.GET_PLATFORM_SENSOR.build_command() + connection.send_command.assert_any_call(platform_status) + connection.reset_mock() + + # Test invalid response + connection.send_command.return_value = "M121 E:0 R:1 something" + with pytest.raises(ValueError): + response = await subject.get_platform_status() + + platform_status = types.GCODE.GET_PLATFORM_SENSOR.build_command() + connection.send_command.assert_any_call(platform_status) + + +async def test_get_hopper_door_closed( + subject: FlexStackerDriver, connection: AsyncMock +) -> None: + """It should send a get door closed command.""" + connection.send_command.return_value = "M122 D:1" + response = await subject.get_hopper_door_closed() + assert response + + door_closed = types.GCODE.GET_DOOR_SWITCH.build_command() + connection.send_command.assert_any_call(door_closed) + connection.reset_mock() + + # Test door open + connection.send_command.return_value = "M122 D:0" + response = await subject.get_hopper_door_closed() + assert not response + + door_closed = types.GCODE.GET_DOOR_SWITCH.build_command() + connection.send_command.assert_any_call(door_closed) + connection.reset_mock() + + # Test invalid response + connection.send_command.return_value = "M122 78gybhjk" + + with pytest.raises(ValueError): + response = await subject.get_hopper_door_closed() + + door_closed = types.GCODE.GET_DOOR_SWITCH.build_command() + connection.send_command.assert_any_call(door_closed) + connection.reset_mock() + + +async def test_move_in_mm(subject: FlexStackerDriver, connection: AsyncMock) -> None: + """It should send a move to command""" + connection.send_command.return_value = "G0" + response = await subject.move_in_mm(types.StackerAxis.X, 10) + assert response + + move_to = types.GCODE.MOVE_TO.build_command().add_float("X", 10) + connection.send_command.assert_any_call(move_to) + connection.reset_mock() + + +async def test_move_to_switch( + subject: FlexStackerDriver, connection: AsyncMock +) -> None: + """It should send a move to switch command""" + connection.send_command.return_value = "G5" + axis = types.StackerAxis.X + direction = types.Direction.EXTENT + response = await subject.move_to_limit_switch(axis, direction) + assert response + + move_to = types.GCODE.MOVE_TO_SWITCH.build_command().add_int( + axis.name, direction.value + ) + connection.send_command.assert_any_call(move_to) + connection.reset_mock() + + +async def test_home_axis(subject: FlexStackerDriver, connection: AsyncMock) -> None: + """It should send a home axis command""" + connection.send_command.return_value = "G28" + axis = types.StackerAxis.X + direction = types.Direction.EXTENT + response = await subject.home_axis(axis, direction) + assert response + + move_to = types.GCODE.HOME_AXIS.build_command().add_int(axis.name, direction.value) + connection.send_command.assert_any_call(move_to) + connection.reset_mock() + + +async def test_set_led(subject: FlexStackerDriver, connection: AsyncMock) -> None: + """It should send a set led command""" + connection.send_command.return_value = "M200" + response = await subject.set_led(1, types.LEDColor.RED) + assert response + + set_led = types.GCODE.SET_LED.build_command().add_float("P", 1).add_int("C", 1) + connection.send_command.assert_any_call(set_led) + connection.reset_mock() diff --git a/api/tests/opentrons/hardware_control/instruments/test_nozzle_manager.py b/api/tests/opentrons/hardware_control/instruments/test_nozzle_manager.py index ba1f10aaaef..066cdbc3caf 100644 --- a/api/tests/opentrons/hardware_control/instruments/test_nozzle_manager.py +++ b/api/tests/opentrons/hardware_control/instruments/test_nozzle_manager.py @@ -10,6 +10,7 @@ PipetteModelType, PipetteChannelType, PipetteVersionType, + PipetteOEMType, ) from opentrons_shared_data.pipette.pipette_definition import ( PipetteConfigurations, @@ -261,7 +262,10 @@ def test_single_pipettes_always_full( pipette_details: Tuple[PipetteModelType, PipetteVersionType], ) -> None: config = load_definition( - pipette_details[0], PipetteChannelType.SINGLE_CHANNEL, pipette_details[1] + pipette_details[0], + PipetteChannelType.SINGLE_CHANNEL, + pipette_details[1], + PipetteOEMType.OT, ) subject = nozzle_manager.NozzleConfigurationManager.build_from_config( config, ValidNozzleMaps(maps=A1) @@ -289,7 +293,10 @@ def test_single_pipette_map_entries( pipette_details: Tuple[PipetteModelType, PipetteVersionType], ) -> None: config = load_definition( - pipette_details[0], PipetteChannelType.SINGLE_CHANNEL, pipette_details[1] + pipette_details[0], + PipetteChannelType.SINGLE_CHANNEL, + pipette_details[1], + PipetteOEMType.OT, ) subject = nozzle_manager.NozzleConfigurationManager.build_from_config( config, ValidNozzleMaps(maps=A1) @@ -326,7 +333,10 @@ def test_single_pipette_map_geometry( pipette_details: Tuple[PipetteModelType, PipetteVersionType], ) -> None: config = load_definition( - pipette_details[0], PipetteChannelType.SINGLE_CHANNEL, pipette_details[1] + pipette_details[0], + PipetteChannelType.SINGLE_CHANNEL, + pipette_details[1], + PipetteOEMType.OT, ) subject = nozzle_manager.NozzleConfigurationManager.build_from_config( config, ValidNozzleMaps(maps=A1) @@ -359,7 +369,10 @@ def test_multi_config_identification( pipette_details: Tuple[PipetteModelType, PipetteVersionType], ) -> None: config = load_definition( - pipette_details[0], PipetteChannelType.EIGHT_CHANNEL, pipette_details[1] + pipette_details[0], + PipetteChannelType.EIGHT_CHANNEL, + pipette_details[1], + PipetteOEMType.OT, ) subject = nozzle_manager.NozzleConfigurationManager.build_from_config( config, @@ -419,7 +432,10 @@ def test_multi_config_map_entries( pipette_details: Tuple[PipetteModelType, PipetteVersionType], ) -> None: config = load_definition( - pipette_details[0], PipetteChannelType.EIGHT_CHANNEL, pipette_details[1] + pipette_details[0], + PipetteChannelType.EIGHT_CHANNEL, + pipette_details[1], + PipetteOEMType.OT, ) subject = nozzle_manager.NozzleConfigurationManager.build_from_config( config, @@ -485,7 +501,10 @@ def test_multi_config_geometry( pipette_details: Tuple[PipetteModelType, PipetteVersionType], ) -> None: config = load_definition( - pipette_details[0], PipetteChannelType.EIGHT_CHANNEL, pipette_details[1] + pipette_details[0], + PipetteChannelType.EIGHT_CHANNEL, + pipette_details[1], + PipetteOEMType.OT, ) subject = nozzle_manager.NozzleConfigurationManager.build_from_config( config, @@ -536,7 +555,10 @@ def test_96_config_identification( pipette_details: Tuple[PipetteModelType, PipetteVersionType], ) -> None: config = load_definition( - pipette_details[0], PipetteChannelType.NINETY_SIX_CHANNEL, pipette_details[1] + pipette_details[0], + PipetteChannelType.NINETY_SIX_CHANNEL, + pipette_details[1], + PipetteOEMType.OT, ) subject = nozzle_manager.NozzleConfigurationManager.build_from_config( config, @@ -651,7 +673,10 @@ def test_96_config_map_entries( pipette_details: Tuple[PipetteModelType, PipetteVersionType], ) -> None: config = load_definition( - pipette_details[0], PipetteChannelType.NINETY_SIX_CHANNEL, pipette_details[1] + pipette_details[0], + PipetteChannelType.NINETY_SIX_CHANNEL, + pipette_details[1], + PipetteOEMType.OT, ) subject = nozzle_manager.NozzleConfigurationManager.build_from_config( config, @@ -988,7 +1013,10 @@ def test_96_config_geometry( pipette_details: Tuple[PipetteModelType, PipetteVersionType], ) -> None: config = load_definition( - pipette_details[0], PipetteChannelType.NINETY_SIX_CHANNEL, pipette_details[1] + pipette_details[0], + PipetteChannelType.NINETY_SIX_CHANNEL, + pipette_details[1], + PipetteOEMType.OT, ) subject = nozzle_manager.NozzleConfigurationManager.build_from_config( config, diff --git a/api/tests/opentrons/hardware_control/test_ot3_api.py b/api/tests/opentrons/hardware_control/test_ot3_api.py index a0775d48e19..200549108db 100644 --- a/api/tests/opentrons/hardware_control/test_ot3_api.py +++ b/api/tests/opentrons/hardware_control/test_ot3_api.py @@ -82,6 +82,7 @@ PipetteChannelType, PipetteVersionType, LiquidClasses, + PipetteOEMType, ) from opentrons_shared_data.pipette import ( load_data as load_pipette_data, @@ -381,6 +382,7 @@ class PipetteLoadConfig(TypedDict): channels: Literal[1, 8, 96] version: Tuple[Literal[1, 2, 3], Literal[0, 1, 2, 3, 4, 5, 6]] model: PipetteModel + oem_type: PipetteOEMType class GripperLoadConfig(TypedDict): @@ -402,8 +404,24 @@ class GripperLoadConfig(TypedDict): ( ( [ - (OT3Mount.RIGHT, {"channels": 8, "version": (3, 3), "model": "p50"}), - (OT3Mount.LEFT, {"channels": 1, "version": (3, 3), "model": "p1000"}), + ( + OT3Mount.RIGHT, + { + "channels": 8, + "version": (3, 3), + "model": "p50", + "oem_type": PipetteOEMType.OT, + }, + ), + ( + OT3Mount.LEFT, + { + "channels": 1, + "version": (3, 3), + "model": "p1000", + "oem_type": PipetteOEMType.OT, + }, + ), ], GantryLoad.LOW_THROUGHPUT, ), @@ -413,34 +431,88 @@ class GripperLoadConfig(TypedDict): GantryLoad.LOW_THROUGHPUT, ), ( - [(OT3Mount.LEFT, {"channels": 8, "version": (3, 3), "model": "p1000"})], + [ + ( + OT3Mount.LEFT, + { + "channels": 8, + "version": (3, 3), + "model": "p1000", + "oem_type": "ot", + }, + ) + ], GantryLoad.LOW_THROUGHPUT, ), ( - [(OT3Mount.RIGHT, {"channels": 8, "version": (3, 3), "model": "p1000"})], + [ + ( + OT3Mount.RIGHT, + { + "channels": 8, + "version": (3, 3), + "model": "p1000", + "oem_type": "ot", + }, + ) + ], GantryLoad.LOW_THROUGHPUT, ), ( - [(OT3Mount.LEFT, {"channels": 96, "model": "p1000", "version": (3, 3)})], + [ + ( + OT3Mount.LEFT, + { + "channels": 96, + "model": "p1000", + "version": (3, 3), + "oem_type": "ot", + }, + ) + ], GantryLoad.HIGH_THROUGHPUT, ), ( [ - (OT3Mount.LEFT, {"channels": 1, "version": (3, 3), "model": "p1000"}), + ( + OT3Mount.LEFT, + { + "channels": 1, + "version": (3, 3), + "model": "p1000", + "oem_type": "ot", + }, + ), (OT3Mount.GRIPPER, {"model": GripperModel.v1, "id": "g12345"}), ], GantryLoad.LOW_THROUGHPUT, ), ( [ - (OT3Mount.RIGHT, {"channels": 8, "version": (3, 3), "model": "p1000"}), + ( + OT3Mount.RIGHT, + { + "channels": 8, + "version": (3, 3), + "model": "p1000", + "oem_type": "ot", + }, + ), (OT3Mount.GRIPPER, {"model": GripperModel.v1, "id": "g12345"}), ], GantryLoad.LOW_THROUGHPUT, ), ( [ - (OT3Mount.LEFT, {"channels": 96, "model": "p1000", "version": (3, 3)}), + ( + OT3Mount.LEFT, + { + "channels": 96, + "model": "p1000", + "version": (3, 3), + "oem_type": "ot", + }, + ), (OT3Mount.GRIPPER, {"model": GripperModel.v1, "id": "g12345"}), ], GantryLoad.HIGH_THROUGHPUT, @@ -463,6 +535,7 @@ async def test_gantry_load_transform( PipetteModelType(pair[1]["model"]), PipetteChannelType(pair[1]["channels"]), PipetteVersionType(*pair[1]["version"]), + PipetteOEMType(pair[1]["oem_type"]), ) instr_data = AttachedPipette(config=pipette_config, id="fakepip") await ot3_hardware.cache_pipette(pair[0], instr_data, None) @@ -557,9 +630,30 @@ def mock_verify_tip_presence( load_pipette_configs = [ - {OT3Mount.LEFT: {"channels": 1, "version": (3, 3), "model": "p1000"}}, - {OT3Mount.RIGHT: {"channels": 8, "version": (3, 3), "model": "p50"}}, - {OT3Mount.LEFT: {"channels": 96, "model": "p1000", "version": (3, 3)}}, + { + OT3Mount.LEFT: { + "channels": 1, + "version": (3, 3), + "model": "p1000", + "oem_type": PipetteOEMType.OT, + } + }, + { + OT3Mount.RIGHT: { + "channels": 8, + "version": (3, 3), + "model": "p50", + "oem_type": PipetteOEMType.OT, + } + }, + { + OT3Mount.LEFT: { + "channels": 96, + "model": "p1000", + "version": (3, 3), + "oem_type": PipetteOEMType.OT, + } + }, ] @@ -573,6 +667,7 @@ async def prepare_for_mock_blowout( PipetteModelType(configs["model"]), PipetteChannelType(configs["channels"]), PipetteVersionType(*configs["version"]), + PipetteOEMType(configs["oem_type"]), ) instr_data = AttachedPipette(config=pipette_config, id="fakepip") await ot3_hardware.cache_pipette(mount, instr_data, None) @@ -804,7 +899,10 @@ async def test_liquid_probe( ) -> None: instr_data = AttachedPipette( config=load_pipette_data.load_definition( - PipetteModelType("p1000"), PipetteChannelType(1), PipetteVersionType(3, 4) + PipetteModelType("p1000"), + PipetteChannelType(1), + PipetteVersionType(3, 4), + PipetteOEMType.OT, ), id="fakepip", ) @@ -895,7 +993,10 @@ async def test_liquid_probe_plunger_moves( # when approaching its max z distance instr_data = AttachedPipette( config=load_pipette_data.load_definition( - PipetteModelType("p1000"), PipetteChannelType(1), PipetteVersionType(3, 4) + PipetteModelType("p1000"), + PipetteChannelType(1), + PipetteVersionType(3, 4), + PipetteOEMType.OT, ), id="fakepip", ) @@ -1002,7 +1103,10 @@ async def test_liquid_probe_mount_moves( """Verify move targets for one singular liquid pass probe.""" instr_data = AttachedPipette( config=load_pipette_data.load_definition( - PipetteModelType("p1000"), PipetteChannelType(1), PipetteVersionType(3, 4) + PipetteModelType("p1000"), + PipetteChannelType(1), + PipetteVersionType(3, 4), + PipetteOEMType.OT, ), id="fakepip", ) @@ -1064,7 +1168,10 @@ async def test_multi_liquid_probe( ) -> None: instr_data = AttachedPipette( config=load_pipette_data.load_definition( - PipetteModelType("p1000"), PipetteChannelType(1), PipetteVersionType(3, 4) + PipetteModelType("p1000"), + PipetteChannelType(1), + PipetteVersionType(3, 4), + PipetteOEMType.OT, ), id="fakepip", ) @@ -1131,7 +1238,10 @@ async def test_liquid_not_found( ) -> None: instr_data = AttachedPipette( config=load_pipette_data.load_definition( - PipetteModelType("p1000"), PipetteChannelType(1), PipetteVersionType(3, 4) + PipetteModelType("p1000"), + PipetteChannelType(1), + PipetteVersionType(3, 4), + PipetteOEMType.OT, ), id="fakepip", ) @@ -1599,7 +1709,10 @@ async def test_home_plunger( mount = OT3Mount.LEFT instr_data = AttachedPipette( config=load_pipette_data.load_definition( - PipetteModelType("p1000"), PipetteChannelType(1), PipetteVersionType(3, 4) + PipetteModelType("p1000"), + PipetteChannelType(1), + PipetteVersionType(3, 4), + PipetteOEMType.OT, ), id="fakepip", ) @@ -1621,6 +1734,7 @@ async def test_prepare_for_aspirate( PipetteModelType("p1000"), PipetteChannelType(1), PipetteVersionType(3, 4), + PipetteOEMType.OT, ), id="fakepip", ) @@ -1655,6 +1769,7 @@ async def test_plunger_ready_to_aspirate_after_dispense( PipetteModelType("p1000"), PipetteChannelType(1), PipetteVersionType(3, 4), + PipetteOEMType.OT, ), id="fakepip", ) @@ -1680,7 +1795,10 @@ async def test_move_to_plunger_bottom( mount = OT3Mount.LEFT instr_data = AttachedPipette( config=load_pipette_data.load_definition( - PipetteModelType("p1000"), PipetteChannelType(1), PipetteVersionType(3, 4) + PipetteModelType("p1000"), + PipetteChannelType(1), + PipetteVersionType(3, 4), + PipetteOEMType.OT, ), id="fakepip", ) @@ -2130,6 +2248,7 @@ async def test_home_axis( PipetteModelType("p1000"), PipetteChannelType(1), PipetteVersionType(3, 3), + PipetteOEMType.OT, ) instr_data = AttachedPipette(config=pipette_config, id="fakepip") await ot3_hardware.cache_pipette(Axis.to_ot3_mount(axis), instr_data, None) diff --git a/api/tests/opentrons/hardware_control/test_pipette.py b/api/tests/opentrons/hardware_control/test_pipette.py index 25ac7b0298a..610fcc2a022 100644 --- a/api/tests/opentrons/hardware_control/test_pipette.py +++ b/api/tests/opentrons/hardware_control/test_pipette.py @@ -73,7 +73,10 @@ def _create_pipette( ) -> ot3_pipette.Pipette: return ot3_pipette.Pipette( load_pipette_data.load_definition( - model.pipette_type, model.pipette_channels, model.pipette_version + model.pipette_type, + model.pipette_channels, + model.pipette_version, + model.oem_type, ), calibration, id, diff --git a/api/tests/opentrons/test_execute.py b/api/tests/opentrons/test_execute.py index b9f791f4253..1e72a3757bf 100644 --- a/api/tests/opentrons/test_execute.py +++ b/api/tests/opentrons/test_execute.py @@ -131,6 +131,7 @@ def test_execute_function_apiv2( converted_model_v15.pipette_type, converted_model_v15.pipette_channels, converted_model_v15.pipette_version, + converted_model_v15.oem_type, ), "id": "testid", } @@ -139,6 +140,7 @@ def test_execute_function_apiv2( converted_model_v1.pipette_type, converted_model_v1.pipette_channels, converted_model_v1.pipette_version, + converted_model_v1.oem_type, ), "id": "testid2", } @@ -177,6 +179,7 @@ def emit_runlog(entry: Any) -> None: converted_model_v15.pipette_type, converted_model_v15.pipette_channels, converted_model_v15.pipette_version, + converted_model_v15.oem_type, ), "id": "testid", } @@ -215,6 +218,7 @@ def emit_runlog(entry: Any) -> None: converted_model_v15.pipette_type, converted_model_v15.pipette_channels, converted_model_v15.pipette_version, + converted_model_v15.oem_type, ), "id": "testid", } @@ -253,6 +257,7 @@ def emit_runlog(entry: Any) -> None: converted_model_v15.pipette_type, converted_model_v15.pipette_channels, converted_model_v15.pipette_version, + converted_model_v15.oem_type, ), "id": "testid", } @@ -292,6 +297,7 @@ def emit_runlog(entry: Any) -> None: converted_model_v15.pipette_type, converted_model_v15.pipette_channels, converted_model_v15.pipette_version, + converted_model_v15.oem_type, ), "id": "testid", } diff --git a/app/src/App/Navbar.tsx b/app/src/App/Navbar.tsx index 1d7711563ae..90e62b608ae 100644 --- a/app/src/App/Navbar.tsx +++ b/app/src/App/Navbar.tsx @@ -25,6 +25,7 @@ import logoSvgThree from '/app/assets/images/logo_nav_three.svg' import { NAV_BAR_WIDTH } from './constants' +import type { MouseEvent } from 'react' import type { RouteProps } from './types' const SALESFORCE_HELP_LINK = 'https://support.opentrons.com/s/' @@ -161,7 +162,7 @@ export function Navbar({ routes }: { routes: RouteProps[] }): JSX.Element { ) => { + onClick={(e: MouseEvent) => { e.preventDefault() debouncedNavigate('/app-settings') }} diff --git a/app/src/App/__mocks__/portal.tsx b/app/src/App/__mocks__/portal.tsx index f80b1deb44e..498f3220f65 100644 --- a/app/src/App/__mocks__/portal.tsx +++ b/app/src/App/__mocks__/portal.tsx @@ -1,8 +1,8 @@ // mock portal for enzyme tests -import type * as React from 'react' +import type { ReactNode } from 'react' interface Props { - children: React.ReactNode + children: ReactNode } // replace Portal with a pass-through React.Fragment diff --git a/app/src/App/__tests__/hooks.test.tsx b/app/src/App/__tests__/hooks.test.tsx index 5b3f315049b..2423414c748 100644 --- a/app/src/App/__tests__/hooks.test.tsx +++ b/app/src/App/__tests__/hooks.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, describe, beforeEach, afterEach, expect, it } from 'vitest' import { renderHook } from '@testing-library/react' import { createStore } from 'redux' @@ -9,11 +8,12 @@ import { i18n } from '/app/i18n' import { checkShellUpdate } from '/app/redux/shell' import { useSoftwareUpdatePoll } from '../hooks' +import type { FunctionComponent, ReactNode } from 'react' import type { Store } from 'redux' import type { State } from '/app/redux/types' describe('useSoftwareUpdatePoll', () => { - let wrapper: React.FunctionComponent<{ children: React.ReactNode }> + let wrapper: FunctionComponent<{ children: ReactNode }> let store: Store beforeEach(() => { vi.useFakeTimers() diff --git a/app/src/App/index.tsx b/app/src/App/index.tsx index f0ba1de0304..0ffcf0dd751 100644 --- a/app/src/App/index.tsx +++ b/app/src/App/index.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useSelector } from 'react-redux' import { Flex, POSITION_FIXED, DIRECTION_ROW } from '@opentrons/components' @@ -9,7 +8,9 @@ import { DesktopApp } from './DesktopApp' import { OnDeviceDisplayApp } from './OnDeviceDisplayApp' import { TopPortalRoot } from './portal' -const stopEvent = (event: React.MouseEvent): void => { +import type { MouseEvent } from 'react' + +const stopEvent = (event: MouseEvent): void => { event.preventDefault() } diff --git a/app/src/App/types.ts b/app/src/App/types.ts index 87d8f77d4a1..c6a0822260d 100644 --- a/app/src/App/types.ts +++ b/app/src/App/types.ts @@ -1,11 +1,11 @@ -import type * as React from 'react' +import type { FC } from 'react' export interface RouteProps { /** * the component rendered by a route match * drop developed components into slots held by placeholder div components */ - Component: React.FC + Component: FC /** * a route/page name to render in the nav bar */ diff --git a/app/src/LocalizationProvider.tsx b/app/src/LocalizationProvider.tsx index df2bbc8bc40..3c8fcf9feab 100644 --- a/app/src/LocalizationProvider.tsx +++ b/app/src/LocalizationProvider.tsx @@ -7,10 +7,10 @@ import { i18n, i18nCb, i18nConfig } from '/app/i18n' import { getAppLanguage } from '/app/redux/config' import { useIsOEMMode } from '/app/resources/robot-settings/hooks' -import type * as React from 'react' +import type { ReactNode } from 'react' export interface LocalizationProviderProps { - children?: React.ReactNode + children?: ReactNode } export const BRANDED_RESOURCE = 'branded' diff --git a/app/src/__testing-utils__/renderWithProviders.tsx b/app/src/__testing-utils__/renderWithProviders.tsx index 11e3ba16d9b..4c3115281f5 100644 --- a/app/src/__testing-utils__/renderWithProviders.tsx +++ b/app/src/__testing-utils__/renderWithProviders.tsx @@ -1,6 +1,5 @@ // render using targetted component using @testing-library/react // with wrapping providers for i18next and redux -import type * as React from 'react' import { QueryClient, QueryClientProvider } from 'react-query' import { I18nextProvider } from 'react-i18next' import { Provider } from 'react-redux' @@ -8,16 +7,22 @@ import { vi } from 'vitest' import { render } from '@testing-library/react' import { createStore } from 'redux' +import type { + ComponentProps, + ComponentType, + PropsWithChildren, + ReactElement, +} from 'react' import type { PreloadedState, Store } from 'redux' import type { RenderOptions, RenderResult } from '@testing-library/react' export interface RenderWithProvidersOptions extends RenderOptions { initialState?: State - i18nInstance: React.ComponentProps['i18n'] + i18nInstance: ComponentProps['i18n'] } export function renderWithProviders( - Component: React.ReactElement, + Component: ReactElement, options?: RenderWithProvidersOptions ): [RenderResult, Store] { // eslint-disable-next-line @typescript-eslint/consistent-type-assertions @@ -32,7 +37,7 @@ export function renderWithProviders( const queryClient = new QueryClient() - const ProviderWrapper: React.ComponentType> = ({ + const ProviderWrapper: ComponentType> = ({ children, }) => { const BaseWrapper = ( diff --git a/app/src/atoms/InlineNotification/__tests__/InlineNotification.test.tsx b/app/src/atoms/InlineNotification/__tests__/InlineNotification.test.tsx index 0e91433e7b2..bb5ba0669b9 100644 --- a/app/src/atoms/InlineNotification/__tests__/InlineNotification.test.tsx +++ b/app/src/atoms/InlineNotification/__tests__/InlineNotification.test.tsx @@ -1,18 +1,19 @@ -import type * as React from 'react' import { describe, it, vi, beforeEach, expect } from 'vitest' import { screen, fireEvent } from '@testing-library/react' import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { InlineNotification } from '..' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('InlineNotification', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/atoms/InlineNotification/index.tsx b/app/src/atoms/InlineNotification/index.tsx index 5b5bf21aafa..cf413b652cc 100644 --- a/app/src/atoms/InlineNotification/index.tsx +++ b/app/src/atoms/InlineNotification/index.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { css } from 'styled-components' import { ALIGN_CENTER, @@ -19,6 +18,7 @@ import { Link, } from '@opentrons/components' +import type { MouseEventHandler } from 'react' import type { IconProps, StyleProps } from '@opentrons/components' type InlineNotificationType = 'alert' | 'error' | 'neutral' | 'success' @@ -32,9 +32,9 @@ export interface InlineNotificationProps extends StyleProps { /** Optional dynamic width based on contents */ hug?: boolean /** optional handler to show close button/clear alert */ - onCloseClick?: (() => void) | React.MouseEventHandler + onCloseClick?: (() => void) | MouseEventHandler linkText?: string - onLinkClick?: (() => void) | React.MouseEventHandler + onLinkClick?: (() => void) | MouseEventHandler } const INLINE_NOTIFICATION_PROPS_BY_TYPE: Record< diff --git a/app/src/atoms/InstrumentContainer/__tests__/InstrumentContainer.test.tsx b/app/src/atoms/InstrumentContainer/__tests__/InstrumentContainer.test.tsx index e5fa872ab54..318175558fe 100644 --- a/app/src/atoms/InstrumentContainer/__tests__/InstrumentContainer.test.tsx +++ b/app/src/atoms/InstrumentContainer/__tests__/InstrumentContainer.test.tsx @@ -1,15 +1,16 @@ -import type * as React from 'react' import { describe, it } from 'vitest' import { screen } from '@testing-library/react' import { renderWithProviders } from '/app/__testing-utils__' import { InstrumentContainer } from '..' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders()[0] } describe('InstrumentContainer', () => { - let props: React.ComponentProps + let props: ComponentProps it('renders an instrument display name', () => { props = { diff --git a/app/src/atoms/Link/__tests__/ExternalLink.test.tsx b/app/src/atoms/Link/__tests__/ExternalLink.test.tsx index f58ad595169..863a10e886e 100644 --- a/app/src/atoms/Link/__tests__/ExternalLink.test.tsx +++ b/app/src/atoms/Link/__tests__/ExternalLink.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, expect, beforeEach } from 'vitest' import { screen } from '@testing-library/react' import '@testing-library/jest-dom/vitest' @@ -6,14 +5,16 @@ import { COLORS } from '@opentrons/components' import { renderWithProviders } from '/app/__testing-utils__' import { ExternalLink } from '../ExternalLink' +import type { ComponentProps } from 'react' + const TEST_URL = 'https://opentrons.com' -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders()[0] } describe('ExternalLink', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/atoms/ProgressBar/__tests__/ProgressBar.test.tsx b/app/src/atoms/ProgressBar/__tests__/ProgressBar.test.tsx index 6d5b3d3fa40..557a234e969 100644 --- a/app/src/atoms/ProgressBar/__tests__/ProgressBar.test.tsx +++ b/app/src/atoms/ProgressBar/__tests__/ProgressBar.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, expect, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' import { screen } from '@testing-library/react' @@ -7,12 +6,14 @@ import { COLORS } from '@opentrons/components' import { renderWithProviders } from '/app/__testing-utils__' import { ProgressBar } from '..' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders() } describe('ProgressBar', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/atoms/ProgressBar/index.tsx b/app/src/atoms/ProgressBar/index.tsx index 5852dadf2b5..bd598c0105b 100644 --- a/app/src/atoms/ProgressBar/index.tsx +++ b/app/src/atoms/ProgressBar/index.tsx @@ -1,7 +1,7 @@ -import type * as React from 'react' import { css } from 'styled-components' import { COLORS, Box } from '@opentrons/components' +import type { ReactNode } from 'react' import type { FlattenSimpleInterpolation } from 'styled-components' interface ProgressBarProps { @@ -12,7 +12,7 @@ interface ProgressBarProps { /** extra styles to be filled progress element */ innerStyles?: FlattenSimpleInterpolation /** extra elements to be rendered within container */ - children?: React.ReactNode + children?: ReactNode } export function ProgressBar({ diff --git a/app/src/atoms/SelectField/index.tsx b/app/src/atoms/SelectField/index.tsx index 50deed28266..a51ed7a9ecd 100644 --- a/app/src/atoms/SelectField/index.tsx +++ b/app/src/atoms/SelectField/index.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import find from 'lodash/find' import { Select } from './Select' import { @@ -11,6 +10,7 @@ import { } from '@opentrons/components' import { css } from 'styled-components' +import type { ReactNode } from 'react' import type { SelectProps, SelectOption } from './Select' import type { ActionMeta, MultiValue, SingleValue } from 'react-select' @@ -32,9 +32,9 @@ export interface SelectFieldProps { /** render function for the option label passed to react-select */ formatOptionLabel?: SelectProps['formatOptionLabel'] /** optional title */ - title?: React.ReactNode + title?: ReactNode /** optional caption. hidden when `error` is given */ - caption?: React.ReactNode + caption?: ReactNode /** if included, use error style and display error instead of caption */ error?: string | null /** change handler called with (name, value, actionMeta) */ diff --git a/app/src/atoms/Skeleton/__tests__/Skeleton.test.tsx b/app/src/atoms/Skeleton/__tests__/Skeleton.test.tsx index b03bd72e98d..471506eb864 100644 --- a/app/src/atoms/Skeleton/__tests__/Skeleton.test.tsx +++ b/app/src/atoms/Skeleton/__tests__/Skeleton.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, expect } from 'vitest' import '@testing-library/jest-dom/vitest' import { screen } from '@testing-library/react' @@ -6,7 +5,9 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { Skeleton } from '..' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] diff --git a/app/src/atoms/Slideout/__tests__/Slideout.test.tsx b/app/src/atoms/Slideout/__tests__/Slideout.test.tsx index 8e3301ad374..cca0cb02929 100644 --- a/app/src/atoms/Slideout/__tests__/Slideout.test.tsx +++ b/app/src/atoms/Slideout/__tests__/Slideout.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, expect, vi, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' import { screen, fireEvent } from '@testing-library/react' @@ -6,14 +5,16 @@ import { i18n } from '/app/i18n' import { renderWithProviders } from '/app/__testing-utils__' import { Slideout } from '..' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('Slideout', () => { - let props: React.ComponentProps + let props: ComponentProps const mockOnClick = vi.fn() beforeEach(() => { props = { diff --git a/app/src/atoms/Slideout/index.tsx b/app/src/atoms/Slideout/index.tsx index 53a6888efa0..7260da7c342 100644 --- a/app/src/atoms/Slideout/index.tsx +++ b/app/src/atoms/Slideout/index.tsx @@ -22,17 +22,19 @@ import { import { Divider } from '../structure' +import type { ReactElement, ReactNode } from 'react' + export interface MultiSlideoutSpecs { currentStep: number maxSteps: number } export interface SlideoutProps { - title: string | React.ReactElement - children: React.ReactNode + title: string | ReactElement + children: ReactNode onCloseClick: () => void // isExpanded is for collapse and expand animation isExpanded?: boolean - footer?: React.ReactNode + footer?: ReactNode multiSlideoutSpecs?: MultiSlideoutSpecs } diff --git a/app/src/atoms/SoftwareKeyboard/AlphanumericKeyboard/index.tsx b/app/src/atoms/SoftwareKeyboard/AlphanumericKeyboard/index.tsx index 3b3bb3ab48c..d536b18b30c 100644 --- a/app/src/atoms/SoftwareKeyboard/AlphanumericKeyboard/index.tsx +++ b/app/src/atoms/SoftwareKeyboard/AlphanumericKeyboard/index.tsx @@ -7,6 +7,8 @@ import { layoutCandidates, customDisplay, } from '../constants' + +import type { MutableRefObject } from 'react' import type { KeyboardReactInterface } from 'react-simple-keyboard' import '../index.css' @@ -15,7 +17,7 @@ import './index.css' // TODO (kk:04/05/2024) add debug to make debugging easy interface AlphanumericKeyboardProps { onChange: (input: string) => void - keyboardRef: React.MutableRefObject + keyboardRef: MutableRefObject debug?: boolean } diff --git a/app/src/atoms/SoftwareKeyboard/IndividualKey/index.tsx b/app/src/atoms/SoftwareKeyboard/IndividualKey/index.tsx index 1cc2668d788..23ed71f9851 100644 --- a/app/src/atoms/SoftwareKeyboard/IndividualKey/index.tsx +++ b/app/src/atoms/SoftwareKeyboard/IndividualKey/index.tsx @@ -1,6 +1,8 @@ -import type * as React from 'react' import { KeyboardReact as Keyboard } from 'react-simple-keyboard' + +import type { MutableRefObject } from 'react' import type { KeyboardReactInterface } from 'react-simple-keyboard' + import '../index.css' import './index.css' @@ -11,7 +13,7 @@ const customDisplay = { // TODO (kk:04/05/2024) add debug to make debugging easy interface IndividualKeyProps { onChange: (input: string) => void - keyboardRef: React.MutableRefObject + keyboardRef: MutableRefObject keyText: string debug?: boolean } diff --git a/app/src/atoms/SoftwareKeyboard/NumericalKeyboard/index.tsx b/app/src/atoms/SoftwareKeyboard/NumericalKeyboard/index.tsx index 4d3959eb9c3..16180ecbbdb 100644 --- a/app/src/atoms/SoftwareKeyboard/NumericalKeyboard/index.tsx +++ b/app/src/atoms/SoftwareKeyboard/NumericalKeyboard/index.tsx @@ -1,15 +1,16 @@ -import type * as React from 'react' import { KeyboardReact as Keyboard } from 'react-simple-keyboard' import { numericalKeyboardLayout, numericalCustom } from '../constants' +import type { MutableRefObject } from 'react' import type { KeyboardReactInterface } from 'react-simple-keyboard' + import '../index.css' import './index.css' // Note (kk:04/05/2024) add debug to make debugging easy interface NumericalKeyboardProps { onChange: (input: string) => void - keyboardRef: React.MutableRefObject + keyboardRef: MutableRefObject isDecimal?: boolean hasHyphen?: boolean debug?: boolean diff --git a/app/src/atoms/StatusLabel/__tests__/StatusLabel.test.tsx b/app/src/atoms/StatusLabel/__tests__/StatusLabel.test.tsx index 568326f0065..48a7753cab5 100644 --- a/app/src/atoms/StatusLabel/__tests__/StatusLabel.test.tsx +++ b/app/src/atoms/StatusLabel/__tests__/StatusLabel.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, expect } from 'vitest' import '@testing-library/jest-dom/vitest' import { screen } from '@testing-library/react' @@ -6,12 +5,14 @@ import { C_SKY_BLUE, COLORS } from '@opentrons/components' import { StatusLabel } from '..' import { renderWithProviders } from '/app/__testing-utils__' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders()[0] } describe('StatusLabel', () => { - let props: React.ComponentProps + let props: ComponentProps it('renders an engaged status label with a blue background and text', () => { props = { diff --git a/app/src/atoms/StepMeter/__tests__/StepMeter.test.tsx b/app/src/atoms/StepMeter/__tests__/StepMeter.test.tsx index 90f027b0f7a..dcd98b06159 100644 --- a/app/src/atoms/StepMeter/__tests__/StepMeter.test.tsx +++ b/app/src/atoms/StepMeter/__tests__/StepMeter.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, expect, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' import { screen } from '@testing-library/react' @@ -6,14 +5,16 @@ import { i18n } from '/app/i18n' import { renderWithProviders } from '/app/__testing-utils__' import { StepMeter } from '..' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('StepMeter', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/atoms/buttons/BackButton.tsx b/app/src/atoms/buttons/BackButton.tsx index 29657e1f1b2..2819c0eb48e 100644 --- a/app/src/atoms/buttons/BackButton.tsx +++ b/app/src/atoms/buttons/BackButton.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useTranslation } from 'react-i18next' import { useNavigate } from 'react-router-dom' @@ -11,11 +10,13 @@ import { TYPOGRAPHY, } from '@opentrons/components' +import type { HTMLProps } from 'react' + // TODO(bh, 2022-12-7): finish styling when designs finalized export function BackButton({ onClick, children, -}: React.HTMLProps): JSX.Element { +}: HTMLProps): JSX.Element { const navigate = useNavigate() const { t } = useTranslation('shared') diff --git a/app/src/atoms/buttons/FloatingActionButton.tsx b/app/src/atoms/buttons/FloatingActionButton.tsx index b7e870eab16..6088a5675b4 100644 --- a/app/src/atoms/buttons/FloatingActionButton.tsx +++ b/app/src/atoms/buttons/FloatingActionButton.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { css } from 'styled-components' import { @@ -15,9 +14,10 @@ import { StyledText, } from '@opentrons/components' +import type { ComponentProps } from 'react' import type { IconName } from '@opentrons/components' -interface FloatingActionButtonProps extends React.ComponentProps { +interface FloatingActionButtonProps extends ComponentProps { buttonText: string disabled?: boolean iconName?: IconName diff --git a/app/src/atoms/buttons/IconButton.tsx b/app/src/atoms/buttons/IconButton.tsx index ee754472ff1..43c935d462f 100644 --- a/app/src/atoms/buttons/IconButton.tsx +++ b/app/src/atoms/buttons/IconButton.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { css } from 'styled-components' import { BORDERS, @@ -10,8 +9,10 @@ import { } from '@opentrons/components' import { ODD_FOCUS_VISIBLE } from './constants' -interface IconButtonProps extends React.ComponentProps { - iconName: React.ComponentProps['name'] +import type { ComponentProps } from 'react' + +interface IconButtonProps extends ComponentProps { + iconName: ComponentProps['name'] hasBackground?: boolean } diff --git a/app/src/atoms/buttons/MediumButton.tsx b/app/src/atoms/buttons/MediumButton.tsx index d784029696a..7439cb39a46 100644 --- a/app/src/atoms/buttons/MediumButton.tsx +++ b/app/src/atoms/buttons/MediumButton.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { css } from 'styled-components' import { ALIGN_CENTER, @@ -16,6 +15,7 @@ import { } from '@opentrons/components' import { ODD_FOCUS_VISIBLE } from './constants' +import type { MouseEventHandler, ReactNode } from 'react' import type { IconName, StyleProps } from '@opentrons/components' import type { ButtonCategory } from './SmallButton' @@ -28,12 +28,12 @@ type MediumButtonTypes = | 'tertiaryLowLight' interface MediumButtonProps extends StyleProps { - buttonText: React.ReactNode + buttonText: ReactNode buttonType?: MediumButtonTypes disabled?: boolean iconName?: IconName buttonCategory?: ButtonCategory - onClick: React.MouseEventHandler + onClick: MouseEventHandler } export function MediumButton(props: MediumButtonProps): JSX.Element { diff --git a/app/src/atoms/buttons/SmallButton.tsx b/app/src/atoms/buttons/SmallButton.tsx index e659d52fd58..7ad8c3d1a99 100644 --- a/app/src/atoms/buttons/SmallButton.tsx +++ b/app/src/atoms/buttons/SmallButton.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { css } from 'styled-components' import { ALIGN_CENTER, @@ -15,6 +14,8 @@ import { TYPOGRAPHY, } from '@opentrons/components' import { ODD_FOCUS_VISIBLE } from './constants' + +import type { MouseEventHandler, ReactNode } from 'react' import type { IconName, StyleProps } from '@opentrons/components' export type SmallButtonTypes = @@ -28,9 +29,9 @@ export type ButtonCategory = 'default' | 'rounded' export type IconPlacement = 'startIcon' | 'endIcon' interface SmallButtonProps extends StyleProps { - onClick: React.MouseEventHandler + onClick: MouseEventHandler buttonType?: SmallButtonTypes - buttonText: React.ReactNode + buttonText: ReactNode iconPlacement?: IconPlacement | null iconName?: IconName | null buttonCategory?: ButtonCategory // if not specified, it will be 'default' diff --git a/app/src/atoms/buttons/SubmitPrimaryButton.tsx b/app/src/atoms/buttons/SubmitPrimaryButton.tsx index cdbf3442a65..cc53717bab0 100644 --- a/app/src/atoms/buttons/SubmitPrimaryButton.tsx +++ b/app/src/atoms/buttons/SubmitPrimaryButton.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { css } from 'styled-components' import { SPACING, @@ -8,10 +7,12 @@ import { styleProps, } from '@opentrons/components' +import type { MouseEvent } from 'react' + interface SubmitPrimaryButtonProps { form: string value: string - onClick?: (event: React.MouseEvent) => unknown + onClick?: (event: MouseEvent) => unknown disabled?: boolean } export const SubmitPrimaryButton = ( diff --git a/app/src/atoms/buttons/TextOnlyButton.tsx b/app/src/atoms/buttons/TextOnlyButton.tsx index de3bbc969ab..0acdaf058ed 100644 --- a/app/src/atoms/buttons/TextOnlyButton.tsx +++ b/app/src/atoms/buttons/TextOnlyButton.tsx @@ -1,7 +1,8 @@ -import type * as React from 'react' +import { css } from 'styled-components' import { Btn, StyledText, COLORS, RESPONSIVENESS } from '@opentrons/components' + +import type { ReactNode } from 'react' import type { StyleProps } from '@opentrons/components' -import { css } from 'styled-components' const GO_BACK_BUTTON_STYLE = css` color: ${COLORS.grey50}; @@ -26,7 +27,7 @@ const GO_BACK_BUTTON_DISABLED_STYLE = css` interface TextOnlyButtonProps extends StyleProps { onClick: () => void - buttonText: React.ReactNode + buttonText: ReactNode disabled?: boolean } diff --git a/app/src/atoms/buttons/ToggleButton.tsx b/app/src/atoms/buttons/ToggleButton.tsx index b814f45da1d..42efbde32fb 100644 --- a/app/src/atoms/buttons/ToggleButton.tsx +++ b/app/src/atoms/buttons/ToggleButton.tsx @@ -1,8 +1,8 @@ -import type * as React from 'react' import { css } from 'styled-components' -import { Btn, Icon, COLORS, SIZE_1, SIZE_2 } from '@opentrons/components' +import { Btn, COLORS, Icon } from '@opentrons/components' +import type { MouseEvent } from 'react' import type { StyleProps } from '@opentrons/components' const TOGGLE_DISABLED_STYLES = css` @@ -42,7 +42,7 @@ interface ToggleButtonProps extends StyleProps { toggledOn: boolean disabled?: boolean | null id?: string - onClick?: (e: React.MouseEvent) => unknown + onClick?: (e: MouseEvent) => unknown } export const ToggleButton = (props: ToggleButtonProps): JSX.Element => { @@ -55,12 +55,12 @@ export const ToggleButton = (props: ToggleButtonProps): JSX.Element => { role="switch" aria-label={label} aria-checked={toggledOn} - size={size ?? SIZE_2} + size={size ?? '2rem'} css={props.toggledOn ? TOGGLE_ENABLED_STYLES : TOGGLE_DISABLED_STYLES} {...buttonProps} > {/* TODO(bh, 2022-10-05): implement small and large sizes from design system */} - + ) } diff --git a/app/src/atoms/buttons/__tests__/BackButton.test.tsx b/app/src/atoms/buttons/__tests__/BackButton.test.tsx index 510abd0ee7d..67a65d107da 100644 --- a/app/src/atoms/buttons/__tests__/BackButton.test.tsx +++ b/app/src/atoms/buttons/__tests__/BackButton.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, vi } from 'vitest' import '@testing-library/jest-dom/vitest' @@ -9,7 +8,9 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { BackButton } from '..' -const render = (props?: React.HTMLProps) => { +import type { HTMLProps } from 'react' + +const render = (props?: HTMLProps) => { return renderWithProviders( ) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('FloatingActionButton', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/atoms/buttons/__tests__/MediumButton.test.tsx b/app/src/atoms/buttons/__tests__/MediumButton.test.tsx index 988248413d9..1ce59db9217 100644 --- a/app/src/atoms/buttons/__tests__/MediumButton.test.tsx +++ b/app/src/atoms/buttons/__tests__/MediumButton.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import '@testing-library/jest-dom/vitest' import { describe, it, expect, vi, beforeEach } from 'vitest' import { fireEvent, screen } from '@testing-library/react' @@ -7,12 +6,14 @@ import { renderWithProviders } from '/app/__testing-utils__' import { MediumButton } from '../MediumButton' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders()[0] } describe('MediumButton', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { onClick: vi.fn(), diff --git a/app/src/atoms/buttons/__tests__/QuaternaryButton.test.tsx b/app/src/atoms/buttons/__tests__/QuaternaryButton.test.tsx index 4e10831c73c..7fd27eb874c 100644 --- a/app/src/atoms/buttons/__tests__/QuaternaryButton.test.tsx +++ b/app/src/atoms/buttons/__tests__/QuaternaryButton.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import '@testing-library/jest-dom/vitest' import { describe, it, expect, beforeEach, vi } from 'vitest' import { screen } from '@testing-library/react' @@ -7,6 +6,8 @@ import { renderWithProviders } from '/app/__testing-utils__' import { QuaternaryButton } from '..' +import type { ComponentProps } from 'react' + vi.mock('styled-components', async () => { const actual = await vi.importActual( 'styled-components/dist/styled-components.browser.esm.js' @@ -14,12 +15,12 @@ vi.mock('styled-components', async () => { return actual }) -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders()[0] } describe('QuaternaryButton', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/atoms/buttons/__tests__/SmallButton.test.tsx b/app/src/atoms/buttons/__tests__/SmallButton.test.tsx index 283f21daf4e..84341d3b39b 100644 --- a/app/src/atoms/buttons/__tests__/SmallButton.test.tsx +++ b/app/src/atoms/buttons/__tests__/SmallButton.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, expect, vi, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' import { fireEvent, screen } from '@testing-library/react' @@ -7,12 +6,14 @@ import { COLORS, BORDERS } from '@opentrons/components' import { SmallButton } from '../SmallButton' import { renderWithProviders } from '/app/__testing-utils__' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders()[0] } describe('SmallButton', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/atoms/buttons/__tests__/SubmitPrimaryButton.test.tsx b/app/src/atoms/buttons/__tests__/SubmitPrimaryButton.test.tsx index a62ba9c4a95..6af258d9d3f 100644 --- a/app/src/atoms/buttons/__tests__/SubmitPrimaryButton.test.tsx +++ b/app/src/atoms/buttons/__tests__/SubmitPrimaryButton.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, expect, vi, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' import { fireEvent, screen } from '@testing-library/react' @@ -6,15 +5,16 @@ import { COLORS, SPACING, TYPOGRAPHY, BORDERS } from '@opentrons/components' import { renderWithProviders } from '/app/__testing-utils__' import { SubmitPrimaryButton } from '..' +import type { ComponentProps } from 'react' const mockOnClick = vi.fn() -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders()[0] } describe('SubmitPrimaryButton', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/atoms/buttons/__tests__/TertiaryButton.test.tsx b/app/src/atoms/buttons/__tests__/TertiaryButton.test.tsx index 4a3f95369c8..30b15c5bea2 100644 --- a/app/src/atoms/buttons/__tests__/TertiaryButton.test.tsx +++ b/app/src/atoms/buttons/__tests__/TertiaryButton.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, expect, beforeEach } from 'vitest' import { screen } from '@testing-library/react' import { renderWithProviders } from '/app/__testing-utils__' @@ -7,12 +6,14 @@ import { COLORS, SPACING, TYPOGRAPHY, BORDERS } from '@opentrons/components' import { TertiaryButton } from '..' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders()[0] } describe('TertiaryButton', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/atoms/buttons/__tests__/ToggleButton.test.tsx b/app/src/atoms/buttons/__tests__/ToggleButton.test.tsx index 3f61d43c5d0..29991d4ae0f 100644 --- a/app/src/atoms/buttons/__tests__/ToggleButton.test.tsx +++ b/app/src/atoms/buttons/__tests__/ToggleButton.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, expect, vi, beforeEach } from 'vitest' import { screen, fireEvent } from '@testing-library/react' import { COLORS, SIZE_2 } from '@opentrons/components' @@ -6,14 +5,16 @@ import { renderWithProviders } from '/app/__testing-utils__' import { ToggleButton } from '..' +import type { ComponentProps } from 'react' + const mockOnClick = vi.fn() -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders()[0] } describe('ToggleButton', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/atoms/structure/Divider.tsx b/app/src/atoms/structure/Divider.tsx index db55ad84f44..a253f27dce4 100644 --- a/app/src/atoms/structure/Divider.tsx +++ b/app/src/atoms/structure/Divider.tsx @@ -1,7 +1,7 @@ -import type * as React from 'react' import { Box, COLORS, SPACING } from '@opentrons/components' +import type { ComponentProps } from 'react' -type Props = React.ComponentProps +type Props = ComponentProps export function Divider(props: Props): JSX.Element { const { marginY } = props diff --git a/app/src/atoms/structure/Line.tsx b/app/src/atoms/structure/Line.tsx index ecbbecc24cd..8eb456233f6 100644 --- a/app/src/atoms/structure/Line.tsx +++ b/app/src/atoms/structure/Line.tsx @@ -1,7 +1,7 @@ -import type * as React from 'react' import { Box, BORDERS } from '@opentrons/components' +import type { ComponentProps } from 'react' -type Props = React.ComponentProps +type Props = ComponentProps export function Line(props: Props): JSX.Element { return diff --git a/app/src/atoms/structure/__tests__/Divider.test.tsx b/app/src/atoms/structure/__tests__/Divider.test.tsx index 27460be938d..0aa40edb9d4 100644 --- a/app/src/atoms/structure/__tests__/Divider.test.tsx +++ b/app/src/atoms/structure/__tests__/Divider.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, expect, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' import { screen } from '@testing-library/react' @@ -6,12 +5,14 @@ import { SPACING, COLORS } from '@opentrons/components' import { renderWithProviders } from '/app/__testing-utils__' import { Divider } from '../index' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders()[0] } describe('Divider', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/atoms/structure/__tests__/Line.test.tsx b/app/src/atoms/structure/__tests__/Line.test.tsx index d9a9caefba2..c4e3e267565 100644 --- a/app/src/atoms/structure/__tests__/Line.test.tsx +++ b/app/src/atoms/structure/__tests__/Line.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, expect, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' import { screen } from '@testing-library/react' @@ -6,12 +5,14 @@ import { SPACING, COLORS } from '@opentrons/components' import { Line } from '../index' import { renderWithProviders } from '/app/__testing-utils__' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders()[0] } describe('Line', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/molecules/BackgroundOverlay/__tests__/BackgroundOverlay.test.tsx b/app/src/molecules/BackgroundOverlay/__tests__/BackgroundOverlay.test.tsx index e09b3c11765..882c4a644b4 100644 --- a/app/src/molecules/BackgroundOverlay/__tests__/BackgroundOverlay.test.tsx +++ b/app/src/molecules/BackgroundOverlay/__tests__/BackgroundOverlay.test.tsx @@ -1,15 +1,16 @@ -import type * as React from 'react' import { describe, it, expect, vi } from 'vitest' import { fireEvent, screen } from '@testing-library/react' import { renderWithProviders } from '/app/__testing-utils__' import { BackgroundOverlay } from '..' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders()[0] } describe('BackgroundOverlay', () => { - let props: React.ComponentProps + let props: ComponentProps it('renders background overlay', () => { props = { onClick: vi.fn() } render(props) diff --git a/app/src/molecules/BackgroundOverlay/index.tsx b/app/src/molecules/BackgroundOverlay/index.tsx index 3d6c6d976c6..c0a711ffa91 100644 --- a/app/src/molecules/BackgroundOverlay/index.tsx +++ b/app/src/molecules/BackgroundOverlay/index.tsx @@ -1,8 +1,9 @@ -import type * as React from 'react' import { css } from 'styled-components' import { COLORS, Flex, POSITION_FIXED } from '@opentrons/components' +import type { ComponentProps, MouseEventHandler } from 'react' + const BACKGROUND_OVERLAY_STYLE = css` position: ${POSITION_FIXED}; inset: 0; @@ -10,10 +11,9 @@ const BACKGROUND_OVERLAY_STYLE = css` background-color: ${COLORS.black90}${COLORS.opacity60HexCode}; ` -export interface BackgroundOverlayProps - extends React.ComponentProps { +export interface BackgroundOverlayProps extends ComponentProps { // onClick handler so when you click anywhere in the overlay, the modal/menu closes - onClick: React.MouseEventHandler + onClick: MouseEventHandler } export function BackgroundOverlay(props: BackgroundOverlayProps): JSX.Element { diff --git a/app/src/molecules/CardButton/__tests__/CardButton.test.tsx b/app/src/molecules/CardButton/__tests__/CardButton.test.tsx index 820dfbdc4e9..177d61dfd2d 100644 --- a/app/src/molecules/CardButton/__tests__/CardButton.test.tsx +++ b/app/src/molecules/CardButton/__tests__/CardButton.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import '@testing-library/jest-dom/vitest' import { describe, it, expect, vi, beforeEach } from 'vitest' @@ -7,6 +6,8 @@ import { COLORS } from '@opentrons/components' import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { CardButton } from '..' + +import type { ComponentProps } from 'react' import type { NavigateFunction } from 'react-router-dom' const mockNavigate = vi.fn() @@ -19,7 +20,7 @@ vi.mock('react-router-dom', async importOriginal => { } }) -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders( @@ -31,7 +32,7 @@ const render = (props: React.ComponentProps) => { } describe('CardButton', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/molecules/Command/CommandText.tsx b/app/src/molecules/Command/CommandText.tsx index e690115a88b..a2d872af5a8 100644 --- a/app/src/molecules/Command/CommandText.tsx +++ b/app/src/molecules/Command/CommandText.tsx @@ -1,5 +1,5 @@ -import type * as React from 'react' import { pick } from 'lodash' +import { css } from 'styled-components' import { ALIGN_CENTER, @@ -13,6 +13,7 @@ import { import { useCommandTextString } from '/app/local-resources/commands' +import type { ComponentProps } from 'react' import type { LabwareDefinition2, RobotType, @@ -26,13 +27,13 @@ import type { } from '/app/local-resources/commands' interface LegacySTProps { - as?: React.ComponentProps['as'] + as?: ComponentProps['as'] modernStyledTextDefaults?: false } interface ModernSTProps { - desktopStyle?: React.ComponentProps['desktopStyle'] - oddStyle?: React.ComponentProps['oddStyle'] + desktopStyle?: ComponentProps['desktopStyle'] + oddStyle?: ComponentProps['oddStyle'] modernStyledTextDefaults: true } @@ -174,21 +175,10 @@ function ThermocyclerRunProfile( >
    {shouldPropagateTextLimit(propagateTextLimit, isOnDevice) ? ( -
  • - {stepTexts[0]} -
  • +
  • {stepTexts[0]}
  • ) : ( stepTexts.map((step: string, index: number) => ( -
  • +
  • {' '} {step}
  • @@ -252,11 +242,7 @@ function ThermocyclerRunExtendedProfile( >
      {shouldPropagateTextLimit(propagateTextLimit, isOnDevice) ? ( -
    • +
    • {profileElementTexts[0].kind === 'step' ? profileElementTexts[0].stepText : profileElementTexts[0].cycleText} @@ -264,30 +250,18 @@ function ThermocyclerRunExtendedProfile( ) : ( profileElementTexts.map((element, index: number) => element.kind === 'step' ? ( -
    • +
    • {' '} {element.stepText}
    • ) : ( -
    • +
    • {element.cycleText}
        {element.stepTexts.map( ({ stepText }, stepIndex: number) => (
      • {' '} @@ -305,3 +279,7 @@ function ThermocyclerRunExtendedProfile( ) } + +const LIST_STYLE = css` + margin-left: ${SPACING.spacing4}; +` diff --git a/app/src/molecules/FileUpload/__tests__/FileUpload.test.tsx b/app/src/molecules/FileUpload/__tests__/FileUpload.test.tsx index cd5b5adfd82..9f3c22db269 100644 --- a/app/src/molecules/FileUpload/__tests__/FileUpload.test.tsx +++ b/app/src/molecules/FileUpload/__tests__/FileUpload.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { beforeEach, describe, expect, it, vi } from 'vitest' import { screen } from '@testing-library/react' @@ -7,7 +6,9 @@ import { i18n } from '/app/i18n' import { FileUpload } from '..' import testFile from './test-file.png' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] @@ -16,7 +17,7 @@ const render = (props: React.ComponentProps) => { const handleClick = vi.fn() describe('FileUpload', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { const file = new File([testFile], 'a-file-to-test.png') diff --git a/app/src/molecules/GenericWizardTile/__tests__/GenericWizardTile.test.tsx b/app/src/molecules/GenericWizardTile/__tests__/GenericWizardTile.test.tsx index 1f53800ff6d..ee1d680d4d2 100644 --- a/app/src/molecules/GenericWizardTile/__tests__/GenericWizardTile.test.tsx +++ b/app/src/molecules/GenericWizardTile/__tests__/GenericWizardTile.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import '@testing-library/jest-dom/vitest' import { describe, it, expect, vi, beforeEach } from 'vitest' import { fireEvent, screen } from '@testing-library/react' @@ -7,16 +6,18 @@ import { renderWithProviders } from '/app/__testing-utils__' import { getIsOnDevice } from '/app/redux/config' import { GenericWizardTile } from '..' +import type { ComponentProps } from 'react' + vi.mock('/app/redux/config') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('GenericWizardTile', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/molecules/GenericWizardTile/index.tsx b/app/src/molecules/GenericWizardTile/index.tsx index 24883a6ffea..3948daa292a 100644 --- a/app/src/molecules/GenericWizardTile/index.tsx +++ b/app/src/molecules/GenericWizardTile/index.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useSelector } from 'react-redux' import styled, { css } from 'styled-components' import { useTranslation } from 'react-i18next' @@ -26,6 +25,8 @@ import { getIsOnDevice } from '/app/redux/config' import { NeedHelpLink } from '/app/molecules/OT2CalibrationNeedHelpLink' import { SmallButton, TextOnlyButton } from '/app/atoms/buttons' +import type { ReactNode } from 'react' + const ALIGN_BUTTONS = css` align-items: ${ALIGN_FLEX_END}; @@ -59,13 +60,13 @@ const TILE_CONTAINER_STYLE = css` } ` export interface GenericWizardTileProps { - rightHandBody: React.ReactNode - bodyText: React.ReactNode - header: string | React.ReactNode + rightHandBody: ReactNode + bodyText: ReactNode + header: string | ReactNode getHelp?: string back?: () => void proceed?: () => void - proceedButtonText?: React.ReactNode + proceedButtonText?: ReactNode proceedIsDisabled?: boolean proceedButton?: JSX.Element backIsDisabled?: boolean diff --git a/app/src/molecules/InProgressModal/InProgressModal.tsx b/app/src/molecules/InProgressModal/InProgressModal.tsx index c6fefe761a2..82693b34429 100644 --- a/app/src/molecules/InProgressModal/InProgressModal.tsx +++ b/app/src/molecules/InProgressModal/InProgressModal.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { css } from 'styled-components' import { ALIGN_CENTER, @@ -13,9 +12,11 @@ import { TYPOGRAPHY, } from '@opentrons/components' +import type { ReactNode } from 'react' + interface Props { // optional override of the spinner - alternativeSpinner?: React.ReactNode + alternativeSpinner?: ReactNode description?: string body?: string children?: JSX.Element diff --git a/app/src/molecules/InProgressModal/__tests__/InProgressModal.test.tsx b/app/src/molecules/InProgressModal/__tests__/InProgressModal.test.tsx index f670fa221c3..db7ac2294cf 100644 --- a/app/src/molecules/InProgressModal/__tests__/InProgressModal.test.tsx +++ b/app/src/molecules/InProgressModal/__tests__/InProgressModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { screen } from '@testing-library/react' import { describe, it, beforeEach, vi } from 'vitest' import { i18n } from '/app/i18n' @@ -6,15 +5,17 @@ import { getIsOnDevice } from '/app/redux/config' import { renderWithProviders } from '/app/__testing-utils__' import { InProgressModal } from '../InProgressModal' +import type { ComponentProps } from 'react' + vi.mock('/app/redux/config') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('InProgressModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { vi.mocked(getIsOnDevice).mockReturnValue(false) }) diff --git a/app/src/molecules/InfoMessage/__tests__/InfoMessage.test.tsx b/app/src/molecules/InfoMessage/__tests__/InfoMessage.test.tsx index 5ff6948976f..378e1eff503 100644 --- a/app/src/molecules/InfoMessage/__tests__/InfoMessage.test.tsx +++ b/app/src/molecules/InfoMessage/__tests__/InfoMessage.test.tsx @@ -1,18 +1,19 @@ -import type * as React from 'react' import { describe, it, beforeEach } from 'vitest' import { renderWithProviders } from '/app/__testing-utils__' import { screen } from '@testing-library/react' import { i18n } from '/app/i18n' import { InfoMessage } from '..' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('InfoMessage', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/molecules/InstrumentCard/index.tsx b/app/src/molecules/InstrumentCard/index.tsx index edcee546c32..2cd838a08bd 100644 --- a/app/src/molecules/InstrumentCard/index.tsx +++ b/app/src/molecules/InstrumentCard/index.tsx @@ -1,5 +1,3 @@ -import type * as React from 'react' - import { ALIGN_CENTER, ALIGN_FLEX_START, @@ -22,6 +20,7 @@ import flexGripper from '/app/assets/images/flex_gripper.png' import { MenuOverlay } from './MenuOverlay' +import type { ReactNode } from 'react' import type { InstrumentDiagramProps, StyleProps } from '@opentrons/components' import type { MenuOverlayItemProps } from './MenuOverlay' @@ -33,7 +32,7 @@ interface InstrumentCardProps extends StyleProps { instrumentDiagramProps?: InstrumentDiagramProps // special casing the gripper at least for now isGripperAttached?: boolean - banner?: React.ReactNode + banner?: ReactNode isEstopNotDisengaged: boolean } diff --git a/app/src/molecules/InterventionModal/InterventionContent/index.tsx b/app/src/molecules/InterventionModal/InterventionContent/index.tsx index 8d2bbba9c8c..e9b156cf0e6 100644 --- a/app/src/molecules/InterventionModal/InterventionContent/index.tsx +++ b/app/src/molecules/InterventionModal/InterventionContent/index.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { Flex, StyledText, @@ -7,15 +6,17 @@ import { RESPONSIVENESS, } from '@opentrons/components' import { InlineNotification } from '/app/atoms/InlineNotification' - import { InterventionInfo } from './InterventionInfo' + +import type { ComponentProps } from 'react' + export type { InterventionInfoProps } from './InterventionInfo' export { InterventionInfo } export interface InterventionContentProps { headline: string - infoProps: React.ComponentProps - notificationProps?: React.ComponentProps + infoProps: ComponentProps + notificationProps?: ComponentProps } export function InterventionContent({ diff --git a/app/src/molecules/InterventionModal/OneColumn.tsx b/app/src/molecules/InterventionModal/OneColumn.tsx index 35a37dd10f9..8fca9f26ff3 100644 --- a/app/src/molecules/InterventionModal/OneColumn.tsx +++ b/app/src/molecules/InterventionModal/OneColumn.tsx @@ -1,14 +1,14 @@ -import type * as React from 'react' - import { Flex, DIRECTION_COLUMN, JUSTIFY_SPACE_BETWEEN, } from '@opentrons/components' + +import type { ReactNode } from 'react' import type { StyleProps } from '@opentrons/components' export interface OneColumnProps extends StyleProps { - children: React.ReactNode + children: ReactNode } export function OneColumn({ diff --git a/app/src/molecules/InterventionModal/OneColumnOrTwoColumn.tsx b/app/src/molecules/InterventionModal/OneColumnOrTwoColumn.tsx index db25d343be5..0a02f3397ac 100644 --- a/app/src/molecules/InterventionModal/OneColumnOrTwoColumn.tsx +++ b/app/src/molecules/InterventionModal/OneColumnOrTwoColumn.tsx @@ -1,5 +1,3 @@ -import type * as React from 'react' - import { css } from 'styled-components' import { Flex, @@ -9,11 +7,13 @@ import { WRAP, RESPONSIVENESS, } from '@opentrons/components' -import type { StyleProps } from '@opentrons/components' import { TWO_COLUMN_ELEMENT_MIN_WIDTH } from './constants' +import type { ReactNode } from 'react' +import type { StyleProps } from '@opentrons/components' + export interface OneColumnOrTwoColumnProps extends StyleProps { - children: [React.ReactNode, React.ReactNode] + children: [ReactNode, ReactNode] } export function OneColumnOrTwoColumn({ diff --git a/app/src/molecules/InterventionModal/TwoColumn.tsx b/app/src/molecules/InterventionModal/TwoColumn.tsx index fc9072232be..600386ec60f 100644 --- a/app/src/molecules/InterventionModal/TwoColumn.tsx +++ b/app/src/molecules/InterventionModal/TwoColumn.tsx @@ -1,11 +1,11 @@ -import type * as React from 'react' - import { Flex, Box, DIRECTION_ROW, SPACING, WRAP } from '@opentrons/components' import type { StyleProps } from '@opentrons/components' import { TWO_COLUMN_ELEMENT_MIN_WIDTH } from './constants' +import type { ReactNode } from 'react' + export interface TwoColumnProps extends StyleProps { - children: [React.ReactNode, React.ReactNode] + children: [ReactNode, ReactNode] } export function TwoColumn({ diff --git a/app/src/molecules/InterventionModal/__tests__/InterventionModal.test.tsx b/app/src/molecules/InterventionModal/__tests__/InterventionModal.test.tsx index a063bee13bc..bdbe4c95e70 100644 --- a/app/src/molecules/InterventionModal/__tests__/InterventionModal.test.tsx +++ b/app/src/molecules/InterventionModal/__tests__/InterventionModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, describe, it, expect, beforeEach } from 'vitest' import { when } from 'vitest-when' import '@testing-library/jest-dom/vitest' @@ -12,6 +11,7 @@ import { getIsOnDevice } from '/app/redux/config' import { InterventionModal } from '../' +import type { ComponentProps } from 'react' import type { ModalType } from '../' import type { State } from '/app/redux/types' @@ -23,7 +23,7 @@ const MOCK_STATE: State = { }, } as any -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, initialState: MOCK_STATE, @@ -31,7 +31,7 @@ const render = (props: React.ComponentProps) => { } describe('InterventionModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/molecules/InterventionModal/__tests__/ModalContentOneColSimpleButtons.test.tsx b/app/src/molecules/InterventionModal/__tests__/ModalContentOneColSimpleButtons.test.tsx index b68e8a379a0..bb25d211619 100644 --- a/app/src/molecules/InterventionModal/__tests__/ModalContentOneColSimpleButtons.test.tsx +++ b/app/src/molecules/InterventionModal/__tests__/ModalContentOneColSimpleButtons.test.tsx @@ -1,9 +1,10 @@ -import type * as React from 'react' import { vi, describe, it, expect } from 'vitest' import { render, screen, fireEvent } from '@testing-library/react' import { ModalContentOneColSimpleButtons } from '../ModalContentOneColSimpleButtons' +import type { ChangeEventHandler } from 'react' + /* eslint-disable testing-library/no-node-access */ const inputElForButtonFromButtonText = (text: string): HTMLInputElement => ((screen.getByText(text)?.parentElement?.parentElement @@ -88,7 +89,7 @@ describe('InterventionModal', () => { firstButton={{ label: 'first button', value: 'first', - onChange: onChange as React.ChangeEventHandler, + onChange: onChange as ChangeEventHandler, }} secondButton={{ label: 'second button', value: 'second' }} furtherButtons={[{ label: 'third button', value: 'third' }]} diff --git a/app/src/molecules/InterventionModal/index.tsx b/app/src/molecules/InterventionModal/index.tsx index 679d3b3d1f8..3e4801d4922 100644 --- a/app/src/molecules/InterventionModal/index.tsx +++ b/app/src/molecules/InterventionModal/index.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useSelector } from 'react-redux' import { css } from 'styled-components' @@ -32,6 +31,7 @@ import { DescriptionContent } from './DescriptionContent' import { DeckMapContent } from './DeckMapContent' import { CategorizedStepContent } from './CategorizedStepContent' +import type { MouseEvent, ReactNode } from 'react' import type { FlattenSimpleInterpolation } from 'styled-components' import type { IconName } from '@opentrons/components' @@ -116,9 +116,9 @@ const ERROR_COLOR = COLORS.red50 export interface InterventionModalProps { /** Optional modal title heading. Aligned to the left. */ - titleHeading?: React.ReactNode + titleHeading?: ReactNode /** Optional modal heading right of the icon. Aligned right if titleHeading is supplied, otherwise aligned left. **/ - iconHeading?: React.ReactNode + iconHeading?: ReactNode /** Optional onClick for the icon heading and icon. */ iconHeadingOnClick?: () => void /** overall style hint */ @@ -128,7 +128,7 @@ export interface InterventionModalProps { /* Optional icon size override. */ iconSize?: string /** modal contents */ - children: React.ReactNode + children: ReactNode } export function InterventionModal({ @@ -160,7 +160,7 @@ export function InterventionModal({ {...modalStyle} flexDirection={DIRECTION_COLUMN} border={border} - onClick={(e: React.MouseEvent) => { + onClick={(e: MouseEvent) => { e.stopPropagation() }} > diff --git a/app/src/molecules/InterventionModal/story-utils/StandIn.tsx b/app/src/molecules/InterventionModal/story-utils/StandIn.tsx index 04aa5690e7a..56153551df3 100644 --- a/app/src/molecules/InterventionModal/story-utils/StandIn.tsx +++ b/app/src/molecules/InterventionModal/story-utils/StandIn.tsx @@ -1,10 +1,10 @@ -import type * as React from 'react' import { Box, BORDERS } from '@opentrons/components' +import type { ReactNode } from 'react' export function StandInContent({ children, }: { - children?: React.ReactNode + children?: ReactNode }): JSX.Element { return ( 0) setCurrentStepSize(stepSizes[i - 1]) } - const handleStepSelect = ( - event: React.MouseEvent - ): void => { + const handleStepSelect = (event: MouseEvent): void => { setCurrentStepSize(Number(event.currentTarget.value) as StepSize) event.currentTarget.blur() } diff --git a/app/src/molecules/MiniCard/__tests__/MiniCard.test.tsx b/app/src/molecules/MiniCard/__tests__/MiniCard.test.tsx index fcc76f38505..0e26b805f16 100644 --- a/app/src/molecules/MiniCard/__tests__/MiniCard.test.tsx +++ b/app/src/molecules/MiniCard/__tests__/MiniCard.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, expect, vi, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' import { fireEvent, screen } from '@testing-library/react' @@ -6,12 +5,14 @@ import { COLORS, SPACING, BORDERS, CURSOR_POINTER } from '@opentrons/components' import { renderWithProviders } from '/app/__testing-utils__' import { MiniCard } from '../' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders()[0] } describe('MiniCard', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/molecules/MiniCard/index.tsx b/app/src/molecules/MiniCard/index.tsx index b65ccbbb59d..d95c42e149f 100644 --- a/app/src/molecules/MiniCard/index.tsx +++ b/app/src/molecules/MiniCard/index.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { css } from 'styled-components' import { BORDERS, @@ -8,12 +7,13 @@ import { SPACING, } from '@opentrons/components' +import type { ReactNode } from 'react' import type { StyleProps } from '@opentrons/components' interface MiniCardProps extends StyleProps { onClick: () => void isSelected: boolean - children: React.ReactNode + children: ReactNode isError?: boolean isWarning?: boolean } diff --git a/app/src/molecules/ModuleIcon/__tests__/ModuleIcon.test.tsx b/app/src/molecules/ModuleIcon/__tests__/ModuleIcon.test.tsx index 73c44639e51..6e20f8997fa 100644 --- a/app/src/molecules/ModuleIcon/__tests__/ModuleIcon.test.tsx +++ b/app/src/molecules/ModuleIcon/__tests__/ModuleIcon.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { COLORS, SPACING } from '@opentrons/components' import { describe, it, expect, vi, beforeEach } from 'vitest' import { screen } from '@testing-library/react' @@ -6,6 +5,7 @@ import '@testing-library/jest-dom/vitest' import { renderWithProviders } from '/app/__testing-utils__' import { ModuleIcon } from '../' +import type { ComponentProps } from 'react' import type { AttachedModule } from '/app/redux/modules/types' import type * as OpentronsComponents from '@opentrons/components' @@ -17,7 +17,7 @@ vi.mock('@opentrons/components', async importOriginal => { } }) -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders()[0] } @@ -46,7 +46,7 @@ const mockHeaterShakerModule = { } as AttachedModule describe('ModuleIcon', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/molecules/ModuleInfo/__tests__/ModuleInfo.test.tsx b/app/src/molecules/ModuleInfo/__tests__/ModuleInfo.test.tsx index 1d732faeb18..de5eef75577 100644 --- a/app/src/molecules/ModuleInfo/__tests__/ModuleInfo.test.tsx +++ b/app/src/molecules/ModuleInfo/__tests__/ModuleInfo.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { screen } from '@testing-library/react' import { describe, it, vi, beforeEach, expect } from 'vitest' import '@testing-library/jest-dom/vitest' @@ -7,11 +6,13 @@ import { when } from 'vitest-when' import { i18n } from '/app/i18n' import { ModuleInfo } from '../ModuleInfo' import { useRunHasStarted } from '/app/resources/runs' + +import type { ComponentProps } from 'react' import type { ModuleModel, ModuleType } from '@opentrons/shared-data' vi.mock('/app/resources/runs') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] @@ -26,7 +27,7 @@ const mockTCModule = { const MOCK_RUN_ID = '1' describe('ModuleInfo', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { moduleModel: mockTCModule.model, diff --git a/app/src/molecules/NavTab/__tests__/NavTab.test.tsx b/app/src/molecules/NavTab/__tests__/NavTab.test.tsx index 176c76b60cc..e6a2c9a504f 100644 --- a/app/src/molecules/NavTab/__tests__/NavTab.test.tsx +++ b/app/src/molecules/NavTab/__tests__/NavTab.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import '@testing-library/jest-dom/vitest' import { describe, it, expect, beforeEach } from 'vitest' @@ -7,7 +6,9 @@ import { SPACING, COLORS, TYPOGRAPHY, BORDERS } from '@opentrons/components' import { renderWithProviders } from '/app/__testing-utils__' import { NavTab } from '..' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders( @@ -16,7 +17,7 @@ const render = (props: React.ComponentProps) => { } describe('NavTab', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/molecules/NavTab/index.tsx b/app/src/molecules/NavTab/index.tsx index e170da56e43..6cdf6cb0e6b 100644 --- a/app/src/molecules/NavTab/index.tsx +++ b/app/src/molecules/NavTab/index.tsx @@ -3,6 +3,8 @@ import { NavLink } from 'react-router-dom' import { BORDERS, COLORS, SPACING, TYPOGRAPHY } from '@opentrons/components' +import type { ComponentProps } from 'react' + export const TAB_BORDER_STYLE = css` border-bottom-style: ${BORDERS.styleSolid}; border-bottom-width: 2px; @@ -15,7 +17,7 @@ interface NavTabProps { disabled?: boolean } -const StyledNavLink = styled(NavLink)>` +const StyledNavLink = styled(NavLink)>` padding: 0 ${SPACING.spacing4} ${SPACING.spacing8}; ${TYPOGRAPHY.labelSemiBold} color: ${COLORS.grey50}; diff --git a/app/src/molecules/ODDBackButton/__tests__/ODDBackButton.test.tsx b/app/src/molecules/ODDBackButton/__tests__/ODDBackButton.test.tsx index 2b520279cf8..5b487b2e7dc 100644 --- a/app/src/molecules/ODDBackButton/__tests__/ODDBackButton.test.tsx +++ b/app/src/molecules/ODDBackButton/__tests__/ODDBackButton.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import '@testing-library/jest-dom/vitest' import { describe, it, expect, vi, beforeEach } from 'vitest' import { fireEvent, screen } from '@testing-library/react' @@ -6,12 +5,14 @@ import { COLORS } from '@opentrons/components' import { ODDBackButton } from '..' import { renderWithProviders } from '/app/__testing-utils__' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders()[0] } describe('ODDBackButton', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/molecules/ODDBackButton/index.tsx b/app/src/molecules/ODDBackButton/index.tsx index 396feaa5e19..0390dc21284 100644 --- a/app/src/molecules/ODDBackButton/index.tsx +++ b/app/src/molecules/ODDBackButton/index.tsx @@ -1,5 +1,3 @@ -import type * as React from 'react' - import { ALIGN_CENTER, Btn, @@ -11,8 +9,10 @@ import { TYPOGRAPHY, } from '@opentrons/components' +import type { HTMLProps } from 'react' + export function ODDBackButton( - props: React.HTMLProps + props: HTMLProps ): JSX.Element { const { onClick, label } = props diff --git a/app/src/molecules/OT2CalibrationNeedHelpLink/NeedHelpLink.tsx b/app/src/molecules/OT2CalibrationNeedHelpLink/NeedHelpLink.tsx index a87a7808827..6dd9a5f8d86 100644 --- a/app/src/molecules/OT2CalibrationNeedHelpLink/NeedHelpLink.tsx +++ b/app/src/molecules/OT2CalibrationNeedHelpLink/NeedHelpLink.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useTranslation } from 'react-i18next' import { Flex, @@ -11,9 +10,11 @@ import { SPACING, } from '@opentrons/components' +import type { ComponentProps } from 'react' + const SUPPORT_PAGE_URL = 'https://support.opentrons.com/s/ot2-calibration' -interface NeedHelpLinkProps extends React.ComponentProps { +interface NeedHelpLinkProps extends ComponentProps { href?: string } diff --git a/app/src/molecules/OddModal/OddModal.tsx b/app/src/molecules/OddModal/OddModal.tsx index 9b32974000c..e95aaa1d9a4 100644 --- a/app/src/molecules/OddModal/OddModal.tsx +++ b/app/src/molecules/OddModal/OddModal.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { ALIGN_CENTER, BORDERS, @@ -11,14 +10,15 @@ import { import { BackgroundOverlay } from '../BackgroundOverlay' import { OddModalHeader } from './OddModalHeader' +import type { MouseEvent, MouseEventHandler, ReactNode } from 'react' import type { StyleProps } from '@opentrons/components' import type { OddModalHeaderBaseProps, ModalSize } from './types' interface OddModalProps extends StyleProps { /** clicking anywhere outside of the modal closes it */ - onOutsideClick?: React.MouseEventHandler + onOutsideClick?: MouseEventHandler /** modal content */ - children: React.ReactNode + children: ReactNode /** for small, medium, or large modal sizes, medium by default */ modalSize?: ModalSize /** see OddModalHeader component for more details */ @@ -66,7 +66,7 @@ export function OddModal(props: OddModalProps): JSX.Element { margin={SPACING.spacing32} flexDirection={DIRECTION_COLUMN} aria-label={`modal_${modalSize}`} - onClick={(e: React.MouseEvent) => { + onClick={(e: MouseEvent) => { e.stopPropagation() }} > diff --git a/app/src/molecules/OddModal/__tests__/OddModal.test.tsx b/app/src/molecules/OddModal/__tests__/OddModal.test.tsx index d8c129a8b01..9d9097b4729 100644 --- a/app/src/molecules/OddModal/__tests__/OddModal.test.tsx +++ b/app/src/molecules/OddModal/__tests__/OddModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import '@testing-library/jest-dom/vitest' import { describe, it, expect, vi, beforeEach } from 'vitest' @@ -7,14 +6,16 @@ import { renderWithProviders } from '/app/__testing-utils__' import { OddModalHeader } from '../OddModalHeader' import { OddModal } from '../OddModal' +import type { ComponentProps } from 'react' + vi.mock('../OddModalHeader') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders()[0] } describe('OddModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { onOutsideClick: vi.fn(), diff --git a/app/src/molecules/OddModal/__tests__/OddModalHeader.test.tsx b/app/src/molecules/OddModal/__tests__/OddModalHeader.test.tsx index e824e49648c..94499d35abf 100644 --- a/app/src/molecules/OddModal/__tests__/OddModalHeader.test.tsx +++ b/app/src/molecules/OddModal/__tests__/OddModalHeader.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import '@testing-library/jest-dom/vitest' import { describe, it, expect, vi, beforeEach } from 'vitest' import { fireEvent, screen } from '@testing-library/react' @@ -6,12 +5,14 @@ import { COLORS } from '@opentrons/components' import { renderWithProviders } from '/app/__testing-utils__' import { OddModalHeader } from '../OddModalHeader' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders()[0] } describe('OddModalHeader', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { title: 'title', diff --git a/app/src/molecules/OddModal/types.ts b/app/src/molecules/OddModal/types.ts index b0fa6d103ae..e4f07cc52ad 100644 --- a/app/src/molecules/OddModal/types.ts +++ b/app/src/molecules/OddModal/types.ts @@ -1,10 +1,11 @@ +import type { MouseEventHandler } from 'react' import type { IconName, StyleProps } from '@opentrons/components' export type ModalSize = 'small' | 'medium' | 'large' export interface OddModalHeaderBaseProps extends StyleProps { title: string | JSX.Element - onClick?: React.MouseEventHandler + onClick?: MouseEventHandler hasExitIcon?: boolean iconName?: IconName iconColor?: string diff --git a/app/src/molecules/OffsetVector/__tests__/OffsetVector.test.tsx b/app/src/molecules/OffsetVector/__tests__/OffsetVector.test.tsx index bb247c0175a..e3b4c87da6c 100644 --- a/app/src/molecules/OffsetVector/__tests__/OffsetVector.test.tsx +++ b/app/src/molecules/OffsetVector/__tests__/OffsetVector.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { screen } from '@testing-library/react' import '@testing-library/jest-dom/vitest' import { describe, it, expect, beforeEach } from 'vitest' @@ -7,12 +6,14 @@ import { renderWithProviders } from '/app/__testing-utils__' import { OffsetVector } from '../' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders()[0] } describe('OffsetVector', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/molecules/OffsetVector/index.tsx b/app/src/molecules/OffsetVector/index.tsx index 155019e8074..af4d8c5dc68 100644 --- a/app/src/molecules/OffsetVector/index.tsx +++ b/app/src/molecules/OffsetVector/index.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { Flex, SPACING, @@ -6,13 +5,14 @@ import { LegacyStyledText, } from '@opentrons/components' +import type { ComponentProps } from 'react' import type { StyleProps } from '@opentrons/components' interface OffsetVectorProps extends StyleProps { x: number y: number z: number - as?: React.ComponentProps['as'] + as?: ComponentProps['as'] } export function OffsetVector(props: OffsetVectorProps): JSX.Element { diff --git a/app/src/molecules/SimpleWizardBody/SimpleWizardBodyContent.tsx b/app/src/molecules/SimpleWizardBody/SimpleWizardBodyContent.tsx index 16113e28c9a..1a179f1b987 100644 --- a/app/src/molecules/SimpleWizardBody/SimpleWizardBodyContent.tsx +++ b/app/src/molecules/SimpleWizardBody/SimpleWizardBodyContent.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useSelector } from 'react-redux' import { css } from 'styled-components' import { @@ -21,13 +20,15 @@ import SuccessIcon from '/app/assets/images/icon_success.png' import { getIsOnDevice } from '/app/redux/config' import { Skeleton } from '/app/atoms/Skeleton' + +import type { ReactNode } from 'react' import type { RobotType } from '@opentrons/shared-data' interface Props { iconColor: string header: string isSuccess: boolean - children?: React.ReactNode + children?: ReactNode subHeader?: string | JSX.Element isPending?: boolean robotType?: RobotType diff --git a/app/src/molecules/SimpleWizardBody/SimpleWizardInProgressBody.tsx b/app/src/molecules/SimpleWizardBody/SimpleWizardInProgressBody.tsx index 10882025dfc..92f65aa2cf2 100644 --- a/app/src/molecules/SimpleWizardBody/SimpleWizardInProgressBody.tsx +++ b/app/src/molecules/SimpleWizardBody/SimpleWizardInProgressBody.tsx @@ -1,9 +1,10 @@ -import type * as React from 'react' -import type { StyleProps } from '@opentrons/components' import { InProgressModal } from '../InProgressModal/InProgressModal' import { SimpleWizardBodyContainer } from './SimpleWizardBodyContainer' -export type SimpleWizardInProgressBodyProps = React.ComponentProps< +import type { ComponentProps } from 'react' +import type { StyleProps } from '@opentrons/components' + +export type SimpleWizardInProgressBodyProps = ComponentProps< typeof InProgressModal > & StyleProps diff --git a/app/src/molecules/SimpleWizardBody/__tests__/SimpleWizardBody.test.tsx b/app/src/molecules/SimpleWizardBody/__tests__/SimpleWizardBody.test.tsx index 9849e8fa03c..f21e14f0580 100644 --- a/app/src/molecules/SimpleWizardBody/__tests__/SimpleWizardBody.test.tsx +++ b/app/src/molecules/SimpleWizardBody/__tests__/SimpleWizardBody.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { screen } from '@testing-library/react' import { describe, it, expect, vi, beforeEach } from 'vitest' import { COLORS } from '@opentrons/components' @@ -7,14 +6,16 @@ import { Skeleton } from '/app/atoms/Skeleton' import { getIsOnDevice } from '/app/redux/config' import { SimpleWizardBody } from '..' +import type { ComponentProps } from 'react' + vi.mock('/app/atoms/Skeleton') vi.mock('/app/redux/config') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders()[0] } describe('SimpleWizardBody', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { iconColor: COLORS.red60, diff --git a/app/src/molecules/SimpleWizardBody/index.tsx b/app/src/molecules/SimpleWizardBody/index.tsx index b554b71b90e..c49c49be2a8 100644 --- a/app/src/molecules/SimpleWizardBody/index.tsx +++ b/app/src/molecules/SimpleWizardBody/index.tsx @@ -1,8 +1,9 @@ -import type * as React from 'react' - import { SimpleWizardBodyContainer } from './SimpleWizardBodyContainer' import { SimpleWizardBodyContent } from './SimpleWizardBodyContent' import { SimpleWizardInProgressBody } from './SimpleWizardInProgressBody' + +import type { ComponentProps } from 'react' + export { SimpleWizardBodyContainer, SimpleWizardBodyContent, @@ -10,8 +11,8 @@ export { } export function SimpleWizardBody( - props: React.ComponentProps & - React.ComponentProps + props: ComponentProps & + ComponentProps ): JSX.Element { const { children, ...rest } = props return ( diff --git a/app/src/molecules/ToggleGroup/__tests__/useToggleGroup.test.tsx b/app/src/molecules/ToggleGroup/__tests__/useToggleGroup.test.tsx index c4829b79615..b90da347489 100644 --- a/app/src/molecules/ToggleGroup/__tests__/useToggleGroup.test.tsx +++ b/app/src/molecules/ToggleGroup/__tests__/useToggleGroup.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { Provider } from 'react-redux' import { createStore } from 'redux' import '@testing-library/jest-dom/vitest' @@ -7,6 +6,7 @@ import { renderHook, render, fireEvent, screen } from '@testing-library/react' import { useTrackEvent } from '/app/redux/analytics' import { useToggleGroup } from '../useToggleGroup' +import type { FunctionComponent, ReactNode } from 'react' import type { Store } from 'redux' import type { State } from '/app/redux/types' @@ -23,7 +23,7 @@ describe('useToggleGroup', () => { }) it('should return default selectedValue and toggle buttons', () => { - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) => {children} @@ -35,7 +35,7 @@ describe('useToggleGroup', () => { expect(result.current[0]).toBe('List View') }) it('should record an analytics event for list view', async () => { - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) => {children} @@ -53,7 +53,7 @@ describe('useToggleGroup', () => { }) }) it('should record an analytics event for map view', () => { - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) => {children} diff --git a/app/src/molecules/UnorderedList/index.tsx b/app/src/molecules/UnorderedList/index.tsx index cf9937266a8..f48c3e685ba 100644 --- a/app/src/molecules/UnorderedList/index.tsx +++ b/app/src/molecules/UnorderedList/index.tsx @@ -1,9 +1,10 @@ -import type * as React from 'react' import { css } from 'styled-components' import { SPACING, LegacyStyledText } from '@opentrons/components' +import type { ReactNode } from 'react' + interface UnorderedListProps { - items: React.ReactNode[] + items: ReactNode[] } export function UnorderedList(props: UnorderedListProps): JSX.Element { const { items } = props diff --git a/app/src/molecules/UpdateBanner/__tests__/UpdateBanner.test.tsx b/app/src/molecules/UpdateBanner/__tests__/UpdateBanner.test.tsx index 52b074b37d8..1f8470efcd0 100644 --- a/app/src/molecules/UpdateBanner/__tests__/UpdateBanner.test.tsx +++ b/app/src/molecules/UpdateBanner/__tests__/UpdateBanner.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, expect, vi, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' import { when } from 'vitest-when' @@ -9,10 +8,12 @@ import { useIsEstopNotDisengaged } from '/app/resources/devices/hooks/useIsEstop import { UpdateBanner } from '..' import { renderWithProviders } from '/app/__testing-utils__' +import type { ComponentProps } from 'react' + vi.mock('/app/redux-resources/robots') vi.mock('/app/resources/devices/hooks/useIsEstopNotDisengaged') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, initialState: { robotsByName: 'test' }, @@ -20,7 +21,7 @@ const render = (props: React.ComponentProps) => { } describe('Module Update Banner', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/molecules/WizardHeader/__tests__/WizardHeader.test.tsx b/app/src/molecules/WizardHeader/__tests__/WizardHeader.test.tsx index 0e11447cac2..436e594dd59 100644 --- a/app/src/molecules/WizardHeader/__tests__/WizardHeader.test.tsx +++ b/app/src/molecules/WizardHeader/__tests__/WizardHeader.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, expect, vi, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' import { fireEvent, screen } from '@testing-library/react' @@ -8,17 +7,19 @@ import { StepMeter } from '/app/atoms/StepMeter' import { WizardHeader } from '..' import { renderWithProviders } from '/app/__testing-utils__' +import type { ComponentProps } from 'react' + vi.mock('/app/atoms/StepMeter') vi.mock('/app/redux/config') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('WizardHeader', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/molecules/WizardRequiredEquipmentList/index.tsx b/app/src/molecules/WizardRequiredEquipmentList/index.tsx index f6f7457a71a..3a39d904639 100644 --- a/app/src/molecules/WizardRequiredEquipmentList/index.tsx +++ b/app/src/molecules/WizardRequiredEquipmentList/index.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useSelector } from 'react-redux' import { useTranslation } from 'react-i18next' import { css } from 'styled-components' @@ -23,9 +22,10 @@ import { Divider } from '/app/atoms/structure' import { labwareImages } from '/app/local-resources/labware' import { equipmentImages } from './equipmentImages' +import type { ComponentProps } from 'react' import type { StyleProps } from '@opentrons/components' interface WizardRequiredEquipmentListProps extends StyleProps { - equipmentList: Array> + equipmentList: Array> footer?: string } export function WizardRequiredEquipmentList( diff --git a/app/src/molecules/modals/BottomButtonBar.tsx b/app/src/molecules/modals/BottomButtonBar.tsx index d5c202e943c..f7f78f067e4 100644 --- a/app/src/molecules/modals/BottomButtonBar.tsx +++ b/app/src/molecules/modals/BottomButtonBar.tsx @@ -1,18 +1,18 @@ // bottom button bar for modals // TODO(mc, 2018-08-18): maybe make this the default AlertModal behavior -import type * as React from 'react' import cx from 'classnames' import { OutlineButton } from '@opentrons/components' import styles from './styles.module.css' +import type { ReactNode } from 'react' import type { ButtonProps } from '@opentrons/components' type MaybeButtonProps = ButtonProps | null | undefined interface Props { buttons: MaybeButtonProps[] className?: string | null - description?: React.ReactNode | null + description?: ReactNode | null } export function BottomButtonBar(props: Props): JSX.Element { diff --git a/app/src/molecules/modals/ScrollableAlertModal.tsx b/app/src/molecules/modals/ScrollableAlertModal.tsx index c98846899b8..d8ebdc18543 100644 --- a/app/src/molecules/modals/ScrollableAlertModal.tsx +++ b/app/src/molecules/modals/ScrollableAlertModal.tsx @@ -1,12 +1,13 @@ // AlertModal with vertical scrolling -import type * as React from 'react' import omit from 'lodash/omit' import { AlertModal } from '@opentrons/components' import { BottomButtonBar } from './BottomButtonBar' import styles from './styles.module.css' -type Props = React.ComponentProps +import type { ComponentProps } from 'react' + +type Props = ComponentProps export function ScrollableAlertModal(props: Props): JSX.Element { return ( diff --git a/app/src/organisms/Desktop/AdvancedSettings/AdditionalCustomLabwareSourceFolder.tsx b/app/src/organisms/Desktop/AdvancedSettings/AdditionalCustomLabwareSourceFolder.tsx index 57708f2854d..75c0d411cff 100644 --- a/app/src/organisms/Desktop/AdvancedSettings/AdditionalCustomLabwareSourceFolder.tsx +++ b/app/src/organisms/Desktop/AdvancedSettings/AdditionalCustomLabwareSourceFolder.tsx @@ -8,10 +8,10 @@ import { Flex, Icon, JUSTIFY_SPACE_BETWEEN, + LegacyStyledText, Link, SPACING_AUTO, SPACING, - LegacyStyledText, TYPOGRAPHY, } from '@opentrons/components' diff --git a/app/src/organisms/Desktop/AdvancedSettings/OT2AdvancedSettings.tsx b/app/src/organisms/Desktop/AdvancedSettings/OT2AdvancedSettings.tsx index 7ab3ebb0bd0..3ff3313a840 100644 --- a/app/src/organisms/Desktop/AdvancedSettings/OT2AdvancedSettings.tsx +++ b/app/src/organisms/Desktop/AdvancedSettings/OT2AdvancedSettings.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useSelector, useDispatch } from 'react-redux' import { useTranslation } from 'react-i18next' import { css } from 'styled-components' @@ -17,6 +16,7 @@ import { } from '/app/redux/calibration' import { getUseTrashSurfaceForTipCal } from '/app/redux/config' +import type { ChangeEvent } from 'react' import type { Dispatch, State } from '/app/redux/types' const ALWAYS_BLOCK: 'always-block' = 'always-block' @@ -74,7 +74,7 @@ export function OT2AdvancedSettings(): JSX.Element { ? ALWAYS_BLOCK : ALWAYS_PROMPT } - onChange={(event: React.ChangeEvent) => { + onChange={(event: ChangeEvent) => { // you know this is a limited-selection field whose values are only // the elements of BlockSelection; i know this is a limited-selection // field whose values are only the elements of BlockSelection; but sadly, diff --git a/app/src/organisms/Desktop/AdvancedSettings/OverridePathToPython.tsx b/app/src/organisms/Desktop/AdvancedSettings/OverridePathToPython.tsx index d0e5b7d6d93..a87d739172f 100644 --- a/app/src/organisms/Desktop/AdvancedSettings/OverridePathToPython.tsx +++ b/app/src/organisms/Desktop/AdvancedSettings/OverridePathToPython.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useTranslation } from 'react-i18next' import { useSelector, useDispatch } from 'react-redux' @@ -27,6 +26,7 @@ import { ANALYTICS_CHANGE_PATH_TO_PYTHON_DIRECTORY, } from '/app/redux/analytics' +import type { MouseEventHandler } from 'react' import type { Dispatch } from '/app/redux/types' export function OverridePathToPython(): JSX.Element { @@ -35,7 +35,7 @@ export function OverridePathToPython(): JSX.Element { const dispatch = useDispatch() const trackEvent = useTrackEvent() - const handleClickPythonDirectoryChange: React.MouseEventHandler = _event => { + const handleClickPythonDirectoryChange: MouseEventHandler = _event => { dispatch(changePythonPathOverrideConfig()) trackEvent({ name: ANALYTICS_CHANGE_PATH_TO_PYTHON_DIRECTORY, diff --git a/app/src/organisms/Desktop/AdvancedSettings/UpdatedChannel.tsx b/app/src/organisms/Desktop/AdvancedSettings/UpdatedChannel.tsx index aca0348cb7b..ec261c75083 100644 --- a/app/src/organisms/Desktop/AdvancedSettings/UpdatedChannel.tsx +++ b/app/src/organisms/Desktop/AdvancedSettings/UpdatedChannel.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useTranslation } from 'react-i18next' import { useDispatch, useSelector } from 'react-redux' @@ -19,6 +18,7 @@ import { updateConfigValue, } from '/app/redux/config' +import type { ComponentProps } from 'react' import type { SelectOption } from '/app/atoms/SelectField/Select' import type { Dispatch } from '/app/redux/types' @@ -31,7 +31,7 @@ export function UpdatedChannel(): JSX.Element { dispatch(updateConfigValue('update.channel', value)) } - const formatOptionLabel: React.ComponentProps< + const formatOptionLabel: ComponentProps< typeof SelectField >['formatOptionLabel'] = (option, index): JSX.Element => { const { label, value } = option diff --git a/app/src/organisms/Desktop/AppSettings/__tests__/ConnectRobotSlideout.test.tsx b/app/src/organisms/Desktop/AppSettings/__tests__/ConnectRobotSlideout.test.tsx index c92e1f495a0..4cddd3e1763 100644 --- a/app/src/organisms/Desktop/AppSettings/__tests__/ConnectRobotSlideout.test.tsx +++ b/app/src/organisms/Desktop/AppSettings/__tests__/ConnectRobotSlideout.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import '@testing-library/jest-dom/vitest' import { describe, it, expect, vi, beforeEach } from 'vitest' @@ -8,17 +7,19 @@ import { getConfig } from '/app/redux/config' import { renderWithProviders } from '/app/__testing-utils__' import { ConnectRobotSlideout } from '../ConnectRobotSlideout' +import type { ComponentProps } from 'react' + vi.mock('/app/redux/discovery') vi.mock('/app/redux/config') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('ConnectRobotSlideout', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { vi.mocked(getScanning).mockReturnValue(true) @@ -54,7 +55,7 @@ describe('ConnectRobotSlideout', () => { checkIpAndHostname: vi.fn(), isExpanded: true, onCloseClick: vi.fn(), - } as React.ComponentProps + } as ComponentProps }) it('renders correct title, body, and footer for ConnectRobotSlideout', () => { diff --git a/app/src/organisms/Desktop/AppSettings/__tests__/PreviousVersionModal.test.tsx b/app/src/organisms/Desktop/AppSettings/__tests__/PreviousVersionModal.test.tsx index b4449623c05..59eff47aa2c 100644 --- a/app/src/organisms/Desktop/AppSettings/__tests__/PreviousVersionModal.test.tsx +++ b/app/src/organisms/Desktop/AppSettings/__tests__/PreviousVersionModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, vi } from 'vitest' import '@testing-library/jest-dom/vitest' @@ -10,12 +9,14 @@ import { PREVIOUS_RELEASES_URL, } from '../PreviousVersionModal' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } -const props: React.ComponentProps = { +const props: ComponentProps = { closeModal: vi.fn(), } diff --git a/app/src/organisms/Desktop/CalibrateDeck/__tests__/CalibrateDeck.test.tsx b/app/src/organisms/Desktop/CalibrateDeck/__tests__/CalibrateDeck.test.tsx index 3f90064c03c..13415c8e47c 100644 --- a/app/src/organisms/Desktop/CalibrateDeck/__tests__/CalibrateDeck.test.tsx +++ b/app/src/organisms/Desktop/CalibrateDeck/__tests__/CalibrateDeck.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, describe, beforeEach, expect, it } from 'vitest' import { fireEvent, screen } from '@testing-library/react' @@ -14,6 +13,7 @@ import { CalibrationError, } from '/app/organisms/Desktop/CalibrationError' +import type { ComponentProps, ComponentType } from 'react' import type { DeckCalibrationStep } from '/app/redux/sessions/types' import type { DispatchRequestsType } from '/app/redux/robot-api' @@ -41,14 +41,14 @@ describe('CalibrateDeck', () => { ...mockDeckCalibrationSessionAttributes, } const render = ( - props: Partial> = {} + props: Partial> = {} ) => { const { showSpinner = false, isJogging = false, session = mockDeckCalSession, } = props - return renderWithProviders>( + return renderWithProviders>( { const actual = await importOriginal() @@ -35,16 +36,14 @@ interface CalibratePipetteOffsetSpec { describe('CalibratePipetteOffset', () => { let dispatchRequests: DispatchRequestsType const render = ( - props: Partial> = {} + props: Partial> = {} ) => { const { showSpinner = false, isJogging = false, session = mockPipOffsetCalSession, } = props - return renderWithProviders< - React.ComponentType - >( + return renderWithProviders>( { const onResponse = vi.fn() const render = () => { return renderWithProviders< - React.ComponentProps + ComponentProps >( { @@ -41,14 +41,14 @@ describe('CalibrateTipLength', () => { ...mockTipLengthCalibrationSessionAttributes, } const render = ( - props: Partial> = {} + props: Partial> = {} ) => { const { showSpinner = false, isJogging = false, session = mockTipLengthSession, } = props - return renderWithProviders>( + return renderWithProviders>( { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/Desktop/CalibrationPanels/CompleteConfirmation.tsx b/app/src/organisms/Desktop/CalibrationPanels/CompleteConfirmation.tsx index cbd0e214cd1..3f6de1fed33 100644 --- a/app/src/organisms/Desktop/CalibrationPanels/CompleteConfirmation.tsx +++ b/app/src/organisms/Desktop/CalibrationPanels/CompleteConfirmation.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useTranslation } from 'react-i18next' import { ALIGN_CENTER, @@ -16,11 +15,13 @@ import { TYPOGRAPHY, } from '@opentrons/components' +import type { MouseEventHandler, ReactNode } from 'react' + interface CompleteConfirmationProps { - proceed: React.MouseEventHandler + proceed: MouseEventHandler flowName?: string body?: string - visualAid?: React.ReactNode + visualAid?: ReactNode } export function CompleteConfirmation( diff --git a/app/src/organisms/Desktop/CalibrationPanels/Introduction/__tests__/Body.test.tsx b/app/src/organisms/Desktop/CalibrationPanels/Introduction/__tests__/Body.test.tsx index c1300fb3218..26682dff0cc 100644 --- a/app/src/organisms/Desktop/CalibrationPanels/Introduction/__tests__/Body.test.tsx +++ b/app/src/organisms/Desktop/CalibrationPanels/Introduction/__tests__/Body.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { it, describe } from 'vitest' import { screen } from '@testing-library/react' @@ -8,7 +7,9 @@ import * as Sessions from '/app/redux/sessions' import { i18n } from '/app/i18n' import { Body } from '../Body' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] diff --git a/app/src/organisms/Desktop/CalibrationPanels/Introduction/__tests__/Introduction.test.tsx b/app/src/organisms/Desktop/CalibrationPanels/Introduction/__tests__/Introduction.test.tsx index a34460571ed..4005f6c996c 100644 --- a/app/src/organisms/Desktop/CalibrationPanels/Introduction/__tests__/Introduction.test.tsx +++ b/app/src/organisms/Desktop/CalibrationPanels/Introduction/__tests__/Introduction.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, it, expect, describe, beforeEach, afterEach } from 'vitest' import { fireEvent, screen } from '@testing-library/react' @@ -9,6 +8,8 @@ import { i18n } from '/app/i18n' import { Introduction } from '../' import { ChooseTipRack } from '../../ChooseTipRack' +import type { ComponentProps } from 'react' + vi.mock('../../ChooseTipRack') const mockCalInvalidationHandler = vi.fn() @@ -17,9 +18,7 @@ describe('Introduction', () => { const mockSendCommands = vi.fn() const mockCleanUpAndExit = vi.fn() - const render = ( - props: Partial> = {} - ) => { + const render = (props: Partial> = {}) => { return renderWithProviders( ) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('ChooseTipRack', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { vi.mocked(Select).mockReturnValue(
        mock select
        ) diff --git a/app/src/organisms/Desktop/CalibrationPanels/__tests__/ChosenTipRackRender.test.tsx b/app/src/organisms/Desktop/CalibrationPanels/__tests__/ChosenTipRackRender.test.tsx index 5eb7fa1db8b..27bc9a7d233 100644 --- a/app/src/organisms/Desktop/CalibrationPanels/__tests__/ChosenTipRackRender.test.tsx +++ b/app/src/organisms/Desktop/CalibrationPanels/__tests__/ChosenTipRackRender.test.tsx @@ -1,13 +1,14 @@ -import type * as React from 'react' import { it, describe, beforeEach } from 'vitest' import { screen } from '@testing-library/react' import { i18n } from '/app/i18n' import { renderWithProviders } from '/app/__testing-utils__' import { ChosenTipRackRender } from '../ChosenTipRackRender' + +import type { ComponentProps } from 'react' import type { SelectOption } from '/app/atoms/SelectField/Select' -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] @@ -19,7 +20,7 @@ const mockSelectValue = { } as SelectOption describe('ChosenTipRackRender', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { selectedValue: mockSelectValue, diff --git a/app/src/organisms/Desktop/CalibrationPanels/__tests__/CompleteConfirmation.test.tsx b/app/src/organisms/Desktop/CalibrationPanels/__tests__/CompleteConfirmation.test.tsx index 99dc73310d1..8dd9575a2c3 100644 --- a/app/src/organisms/Desktop/CalibrationPanels/__tests__/CompleteConfirmation.test.tsx +++ b/app/src/organisms/Desktop/CalibrationPanels/__tests__/CompleteConfirmation.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { vi, it, describe, expect } from 'vitest' @@ -7,10 +6,12 @@ import { i18n } from '/app/i18n' import { CompleteConfirmation } from '../CompleteConfirmation' +import type { ComponentProps } from 'react' + describe('CompleteConfirmation', () => { const mockCleanUpAndExit = vi.fn() const render = ( - props: Partial> = {} + props: Partial> = {} ) => { const { proceed = mockCleanUpAndExit, flowName, body, visualAid } = props return renderWithProviders( diff --git a/app/src/organisms/Desktop/CalibrationPanels/__tests__/ConfirmCrashRecovery.test.tsx b/app/src/organisms/Desktop/CalibrationPanels/__tests__/ConfirmCrashRecovery.test.tsx index 53fb8559e55..11581f72c55 100644 --- a/app/src/organisms/Desktop/CalibrationPanels/__tests__/ConfirmCrashRecovery.test.tsx +++ b/app/src/organisms/Desktop/CalibrationPanels/__tests__/ConfirmCrashRecovery.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { vi, it, describe, expect } from 'vitest' @@ -6,11 +5,13 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { ConfirmCrashRecovery } from '../ConfirmCrashRecovery' +import type { ComponentProps } from 'react' + describe('ConfirmCrashRecovery', () => { const mockBack = vi.fn() const mockConfirm = vi.fn() const render = ( - props: Partial> = {} + props: Partial> = {} ) => { const { back = mockBack, confirm = mockConfirm } = props return renderWithProviders( diff --git a/app/src/organisms/Desktop/CalibrationPanels/__tests__/ConfirmExit.test.tsx b/app/src/organisms/Desktop/CalibrationPanels/__tests__/ConfirmExit.test.tsx index 086c122e8bf..c09bf0dcd84 100644 --- a/app/src/organisms/Desktop/CalibrationPanels/__tests__/ConfirmExit.test.tsx +++ b/app/src/organisms/Desktop/CalibrationPanels/__tests__/ConfirmExit.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { vi, it, describe, expect } from 'vitest' @@ -7,12 +6,12 @@ import { i18n } from '/app/i18n' import { ConfirmExit } from '../ConfirmExit' +import type { ComponentProps } from 'react' + describe('ConfirmExit', () => { const mockBack = vi.fn() const mockExit = vi.fn() - const render = ( - props: Partial> = {} - ) => { + const render = (props: Partial> = {}) => { const { heading, body } = props return renderWithProviders( { const mockSendCommands = vi.fn() const mockDeleteSession = vi.fn() - const render = ( - props: Partial> = {} - ) => { + const render = (props: Partial> = {}) => { const { mount = 'left', isMulti = false, diff --git a/app/src/organisms/Desktop/CalibrationPanels/__tests__/MeasureNozzle.test.tsx b/app/src/organisms/Desktop/CalibrationPanels/__tests__/MeasureNozzle.test.tsx index d0de251b0ad..e95c612ec01 100644 --- a/app/src/organisms/Desktop/CalibrationPanels/__tests__/MeasureNozzle.test.tsx +++ b/app/src/organisms/Desktop/CalibrationPanels/__tests__/MeasureNozzle.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { vi, it, describe, expect } from 'vitest' @@ -11,11 +10,13 @@ import { import * as Sessions from '/app/redux/sessions' import { MeasureNozzle } from '../MeasureNozzle' +import type { ComponentProps } from 'react' + describe('MeasureNozzle', () => { const mockSendCommands = vi.fn() const mockDeleteSession = vi.fn() const render = ( - props: Partial> = {} + props: Partial> = {} ) => { const { mount = 'left', diff --git a/app/src/organisms/Desktop/CalibrationPanels/__tests__/MeasureTip.test.tsx b/app/src/organisms/Desktop/CalibrationPanels/__tests__/MeasureTip.test.tsx index 70d8ab54a6b..6f37d74fca5 100644 --- a/app/src/organisms/Desktop/CalibrationPanels/__tests__/MeasureTip.test.tsx +++ b/app/src/organisms/Desktop/CalibrationPanels/__tests__/MeasureTip.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { vi, it, describe, expect } from 'vitest' @@ -12,12 +11,12 @@ import * as Sessions from '/app/redux/sessions' import { MeasureTip } from '../MeasureTip' +import type { ComponentProps } from 'react' + describe('MeasureTip', () => { const mockSendCommands = vi.fn() const mockDeleteSession = vi.fn() - const render = ( - props: Partial> = {} - ) => { + const render = (props: Partial> = {}) => { const { mount = 'left', isMulti = false, diff --git a/app/src/organisms/Desktop/CalibrationPanels/__tests__/SaveXYPoint.test.tsx b/app/src/organisms/Desktop/CalibrationPanels/__tests__/SaveXYPoint.test.tsx index 3d7dbda32a9..1965c0b1a14 100644 --- a/app/src/organisms/Desktop/CalibrationPanels/__tests__/SaveXYPoint.test.tsx +++ b/app/src/organisms/Desktop/CalibrationPanels/__tests__/SaveXYPoint.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { vi, it, describe, expect } from 'vitest' @@ -9,12 +8,12 @@ import { mockDeckCalTipRack } from '/app/redux/sessions/__fixtures__' import * as Sessions from '/app/redux/sessions' import { SaveXYPoint } from '../SaveXYPoint' +import type { ComponentProps } from 'react' + describe('SaveXYPoint', () => { const mockSendCommands = vi.fn() const mockDeleteSession = vi.fn() - const render = ( - props: Partial> = {} - ) => { + const render = (props: Partial> = {}) => { const { mount = 'left', isMulti = false, diff --git a/app/src/organisms/Desktop/CalibrationPanels/__tests__/SaveZPoint.test.tsx b/app/src/organisms/Desktop/CalibrationPanels/__tests__/SaveZPoint.test.tsx index 36f04c1ebb2..dab0a5ee2b4 100644 --- a/app/src/organisms/Desktop/CalibrationPanels/__tests__/SaveZPoint.test.tsx +++ b/app/src/organisms/Desktop/CalibrationPanels/__tests__/SaveZPoint.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { vi, it, describe, expect } from 'vitest' @@ -12,13 +11,13 @@ import { import * as Sessions from '/app/redux/sessions' import { SaveZPoint } from '../SaveZPoint' +import type { ComponentProps } from 'react' + describe('SaveZPoint', () => { const mockSendCommands = vi.fn() const mockDeleteSession = vi.fn() - const render = ( - props: Partial> = {} - ) => { + const render = (props: Partial> = {}) => { const { mount = 'left', isMulti = false, diff --git a/app/src/organisms/Desktop/CalibrationPanels/__tests__/TipConfirmation.test.tsx b/app/src/organisms/Desktop/CalibrationPanels/__tests__/TipConfirmation.test.tsx index f9eee22d78b..979db72ecb0 100644 --- a/app/src/organisms/Desktop/CalibrationPanels/__tests__/TipConfirmation.test.tsx +++ b/app/src/organisms/Desktop/CalibrationPanels/__tests__/TipConfirmation.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { vi, it, describe, expect } from 'vitest' @@ -8,11 +7,13 @@ import { mockDeckCalTipRack } from '/app/redux/sessions/__fixtures__' import * as Sessions from '/app/redux/sessions' import { TipConfirmation } from '../TipConfirmation' +import type { ComponentProps } from 'react' + describe('TipConfirmation', () => { const mockSendCommands = vi.fn() const mockDeleteSession = vi.fn() const render = ( - props: Partial> = {} + props: Partial> = {} ) => { const { mount = 'left', diff --git a/app/src/organisms/Desktop/CalibrationPanels/__tests__/TipPickUp.test.tsx b/app/src/organisms/Desktop/CalibrationPanels/__tests__/TipPickUp.test.tsx index b6836cf96fb..6b8aac3fe88 100644 --- a/app/src/organisms/Desktop/CalibrationPanels/__tests__/TipPickUp.test.tsx +++ b/app/src/organisms/Desktop/CalibrationPanels/__tests__/TipPickUp.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { vi, it, describe, expect } from 'vitest' @@ -8,12 +7,12 @@ import { mockDeckCalTipRack } from '/app/redux/sessions/__fixtures__' import * as Sessions from '/app/redux/sessions' import { TipPickUp } from '../TipPickUp' +import type { ComponentProps } from 'react' + describe('TipPickUp', () => { const mockSendCommands = vi.fn() const mockDeleteSession = vi.fn() - const render = ( - props: Partial> = {} - ) => { + const render = (props: Partial> = {}) => { const { mount = 'left', isMulti = false, diff --git a/app/src/organisms/Desktop/CalibrationStatusCard/__tests__/CalibrationStatusCard.test.tsx b/app/src/organisms/Desktop/CalibrationStatusCard/__tests__/CalibrationStatusCard.test.tsx index 400e73b3078..3a3e09c4005 100644 --- a/app/src/organisms/Desktop/CalibrationStatusCard/__tests__/CalibrationStatusCard.test.tsx +++ b/app/src/organisms/Desktop/CalibrationStatusCard/__tests__/CalibrationStatusCard.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { MemoryRouter } from 'react-router-dom' import { vi, it, describe, expect, beforeEach } from 'vitest' import { fireEvent, screen } from '@testing-library/react' @@ -18,9 +17,11 @@ import { expectedTaskList, } from '../../Devices/hooks/__fixtures__/taskListFixtures' +import type { ComponentProps } from 'react' + vi.mock('../../Devices/hooks') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders( @@ -38,7 +39,7 @@ describe('CalibrationStatusCard', () => { vi.mocked(useCalibrationTaskList).mockReturnValue(expectedTaskList) }) - const props: React.ComponentProps = { + const props: ComponentProps = { robotName: 'otie', setShowHowCalibrationWorksModal: mockSetShowHowCalibrationWorksModal, } diff --git a/app/src/organisms/Desktop/CheckCalibration/ResultsSummary/__tests__/CalibrationHealthCheckResults.test.tsx b/app/src/organisms/Desktop/CheckCalibration/ResultsSummary/__tests__/CalibrationHealthCheckResults.test.tsx index dbe7c8349a0..bb66e979624 100644 --- a/app/src/organisms/Desktop/CheckCalibration/ResultsSummary/__tests__/CalibrationHealthCheckResults.test.tsx +++ b/app/src/organisms/Desktop/CheckCalibration/ResultsSummary/__tests__/CalibrationHealthCheckResults.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { it, describe, expect, beforeEach } from 'vitest' import { screen } from '@testing-library/react' @@ -8,8 +7,10 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { CalibrationHealthCheckResults } from '../CalibrationHealthCheckResults' +import type { ComponentProps } from 'react' + const render = ( - props: React.ComponentProps + props: ComponentProps ) => { return renderWithProviders(, { i18nInstance: i18n, @@ -17,7 +18,7 @@ const render = ( } describe('CalibrationHealthCheckResults', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { isCalibrationRecommended: false, diff --git a/app/src/organisms/Desktop/CheckCalibration/ResultsSummary/__tests__/CalibrationResult.test.tsx b/app/src/organisms/Desktop/CheckCalibration/ResultsSummary/__tests__/CalibrationResult.test.tsx index 70432556944..c4d6bd4e67d 100644 --- a/app/src/organisms/Desktop/CheckCalibration/ResultsSummary/__tests__/CalibrationResult.test.tsx +++ b/app/src/organisms/Desktop/CheckCalibration/ResultsSummary/__tests__/CalibrationResult.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, it, describe, beforeEach } from 'vitest' import { screen } from '@testing-library/react' @@ -7,16 +6,18 @@ import { i18n } from '/app/i18n' import { RenderResult } from '../RenderResult' import { CalibrationResult } from '../CalibrationResult' +import type { ComponentProps } from 'react' + vi.mock('../RenderResult') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('PipetteCalibrationResult', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/Desktop/CheckCalibration/ResultsSummary/__tests__/RenderMountInformation.test.tsx b/app/src/organisms/Desktop/CheckCalibration/ResultsSummary/__tests__/RenderMountInformation.test.tsx index bae133b6522..3a5fc13d0c1 100644 --- a/app/src/organisms/Desktop/CheckCalibration/ResultsSummary/__tests__/RenderMountInformation.test.tsx +++ b/app/src/organisms/Desktop/CheckCalibration/ResultsSummary/__tests__/RenderMountInformation.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, it, describe, beforeEach } from 'vitest' import { screen } from '@testing-library/react' @@ -10,6 +9,8 @@ import { LEFT, RIGHT } from '/app/redux/pipettes' import * as Fixtures from '/app/redux/sessions/__fixtures__' import { RenderMountInformation } from '../RenderMountInformation' +import type { ComponentProps } from 'react' + vi.mock('@opentrons/shared-data', async importOriginal => { const actual = await importOriginal() return { @@ -20,14 +21,14 @@ vi.mock('@opentrons/shared-data', async importOriginal => { const mockSessionDetails = Fixtures.mockRobotCalibrationCheckSessionDetails -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('RenderMountInformation', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/Desktop/CheckCalibration/ResultsSummary/__tests__/RenderResult.test.tsx b/app/src/organisms/Desktop/CheckCalibration/ResultsSummary/__tests__/RenderResult.test.tsx index 90ed47fc126..7b60f864218 100644 --- a/app/src/organisms/Desktop/CheckCalibration/ResultsSummary/__tests__/RenderResult.test.tsx +++ b/app/src/organisms/Desktop/CheckCalibration/ResultsSummary/__tests__/RenderResult.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { it, describe, expect, beforeEach } from 'vitest' import { screen } from '@testing-library/react' @@ -9,14 +8,16 @@ import { i18n } from '/app/i18n' import { RenderResult } from '../RenderResult' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('RenderResult', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/Desktop/CheckCalibration/__tests__/CheckCalibration.test.tsx b/app/src/organisms/Desktop/CheckCalibration/__tests__/CheckCalibration.test.tsx index d5f5a9814d7..853716d3d46 100644 --- a/app/src/organisms/Desktop/CheckCalibration/__tests__/CheckCalibration.test.tsx +++ b/app/src/organisms/Desktop/CheckCalibration/__tests__/CheckCalibration.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { when } from 'vitest-when' import { vi, it, describe, expect, beforeEach, afterEach } from 'vitest' @@ -11,6 +10,8 @@ import * as Sessions from '/app/redux/sessions' import { mockCalibrationCheckSessionAttributes } from '/app/redux/sessions/__fixtures__' import { CheckCalibration } from '../index' + +import type { ComponentProps, ComponentType } from 'react' import type { RobotCalibrationCheckStep } from '/app/redux/sessions/types' vi.mock('/app/redux/calibration/selectors') @@ -36,14 +37,14 @@ describe('CheckCalibration', () => { } const render = ( - props: Partial> = {} + props: Partial> = {} ) => { const { showSpinner = false, isJogging = false, session = mockCalibrationCheckSession, } = props - return renderWithProviders>( + return renderWithProviders>( ) => { +const render = (props: ComponentProps) => { return renderWithProviders( diff --git a/app/src/organisms/Desktop/ChooseRobotSlideout/__tests__/ChooseRobotSlideout.test.tsx b/app/src/organisms/Desktop/ChooseRobotSlideout/__tests__/ChooseRobotSlideout.test.tsx index 998c82462bc..33f601165d2 100644 --- a/app/src/organisms/Desktop/ChooseRobotSlideout/__tests__/ChooseRobotSlideout.test.tsx +++ b/app/src/organisms/Desktop/ChooseRobotSlideout/__tests__/ChooseRobotSlideout.test.tsx @@ -1,6 +1,4 @@ -import type * as React from 'react' import { vi, it, describe, expect, beforeEach } from 'vitest' - import { MemoryRouter } from 'react-router-dom' import { fireEvent, screen } from '@testing-library/react' import { OT2_ROBOT_TYPE } from '@opentrons/shared-data' @@ -22,13 +20,15 @@ import { import { getNetworkInterfaces } from '/app/redux/networking' import { ChooseRobotSlideout } from '..' import { useNotifyDataReady } from '/app/resources/useNotifyDataReady' + +import type { ComponentProps } from 'react' import type { RunTimeParameter } from '@opentrons/shared-data' vi.mock('/app/redux/discovery') vi.mock('/app/redux/robot-update') vi.mock('/app/redux/networking') vi.mock('/app/resources/useNotifyDataReady') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders( diff --git a/app/src/organisms/Desktop/ChooseRobotSlideout/__tests__/FileCard.test.tsx b/app/src/organisms/Desktop/ChooseRobotSlideout/__tests__/FileCard.test.tsx index 9a151cd1704..9a150141526 100644 --- a/app/src/organisms/Desktop/ChooseRobotSlideout/__tests__/FileCard.test.tsx +++ b/app/src/organisms/Desktop/ChooseRobotSlideout/__tests__/FileCard.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, it, describe, expect } from 'vitest' import { MemoryRouter } from 'react-router-dom' import { fireEvent, screen } from '@testing-library/react' @@ -7,6 +6,7 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { FileCard } from '../FileCard' +import type { ComponentProps } from 'react' import type { CsvFileParameter } from '@opentrons/shared-data' vi.mock('/app/redux/discovery') @@ -15,7 +15,7 @@ vi.mock('/app/redux/networking') vi.mock('/app/resources/useNotifyDataReady') vi.mock('/app/redux/config') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders( diff --git a/app/src/organisms/Desktop/ChooseRobotToRunProtocolSlideout/__tests__/ChooseRobotToRunProtocolSlideout.test.tsx b/app/src/organisms/Desktop/ChooseRobotToRunProtocolSlideout/__tests__/ChooseRobotToRunProtocolSlideout.test.tsx index 3c6416a5290..19e3d39c370 100644 --- a/app/src/organisms/Desktop/ChooseRobotToRunProtocolSlideout/__tests__/ChooseRobotToRunProtocolSlideout.test.tsx +++ b/app/src/organisms/Desktop/ChooseRobotToRunProtocolSlideout/__tests__/ChooseRobotToRunProtocolSlideout.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, it, describe, expect, beforeEach, afterEach } from 'vitest' import { MemoryRouter } from 'react-router-dom' import { fireEvent, screen, waitFor } from '@testing-library/react' @@ -32,6 +31,7 @@ import { ChooseRobotToRunProtocolSlideout } from '../' import { useNotifyDataReady } from '/app/resources/useNotifyDataReady' import { useCurrentRunId, useCloseCurrentRun } from '/app/resources/runs' +import type { ComponentProps } from 'react' import type { State } from '/app/redux/types' vi.mock('/app/organisms/Desktop/Devices/hooks') @@ -49,7 +49,7 @@ vi.mock('/app/resources/useNotifyDataReady') vi.mock('/app/resources/runs') const render = ( - props: React.ComponentProps + props: ComponentProps ) => { return renderWithProviders( diff --git a/app/src/organisms/Desktop/Devices/ChangePipette/ConfirmPipette.tsx b/app/src/organisms/Desktop/Devices/ChangePipette/ConfirmPipette.tsx index f756059d003..6f6585cefe4 100644 --- a/app/src/organisms/Desktop/Devices/ChangePipette/ConfirmPipette.tsx +++ b/app/src/organisms/Desktop/Devices/ChangePipette/ConfirmPipette.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useTranslation } from 'react-i18next' import { OT2_ROBOT_TYPE } from '@opentrons/shared-data' import { @@ -13,6 +12,7 @@ import { CheckPipettesButton } from './CheckPipettesButton' import { SimpleWizardBody } from '/app/molecules/SimpleWizardBody' import { LevelPipette } from './LevelPipette' +import type { Dispatch, SetStateAction } from 'react' import type { PipetteNameSpecs, PipetteModelSpecs, @@ -36,11 +36,9 @@ export interface ConfirmPipetteProps { // wrongWantedPipette is referring to if the user attaches a pipette that is different // from wantedPipette and they want to use it anyway wrongWantedPipette: PipetteNameSpecs | null - setWrongWantedPipette: React.Dispatch< - React.SetStateAction - > + setWrongWantedPipette: Dispatch> confirmPipetteLevel: boolean - setConfirmPipetteLevel: React.Dispatch> + setConfirmPipetteLevel: Dispatch> tryAgain: () => void exit: () => void nextStep: () => void diff --git a/app/src/organisms/Desktop/Devices/ChangePipette/InstructionStep.tsx b/app/src/organisms/Desktop/Devices/ChangePipette/InstructionStep.tsx index 5b6338be6a5..94d617f2ea4 100644 --- a/app/src/organisms/Desktop/Devices/ChangePipette/InstructionStep.tsx +++ b/app/src/organisms/Desktop/Devices/ChangePipette/InstructionStep.tsx @@ -1,14 +1,15 @@ -import type * as React from 'react' import { Box, Flex, JUSTIFY_SPACE_EVENLY, SPACING } from '@opentrons/components' import type { PipetteChannels, PipetteDisplayCategory, } from '@opentrons/shared-data' + +import type { ReactNode } from 'react' import type { Mount } from '@opentrons/components' import type { Diagram, Direction } from './types' interface Props { - children: React.ReactNode + children: ReactNode direction: Direction mount: Mount channels: PipetteChannels diff --git a/app/src/organisms/Desktop/Devices/ChangePipette/PipetteSelection.tsx b/app/src/organisms/Desktop/Devices/ChangePipette/PipetteSelection.tsx index c306f132154..f998887afbd 100644 --- a/app/src/organisms/Desktop/Devices/ChangePipette/PipetteSelection.tsx +++ b/app/src/organisms/Desktop/Devices/ChangePipette/PipetteSelection.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useTranslation } from 'react-i18next' import { DIRECTION_COLUMN, @@ -10,7 +9,9 @@ import { import { OT3_PIPETTES } from '@opentrons/shared-data' import { PipetteSelect } from '/app/molecules/PipetteSelect' -export type PipetteSelectionProps = React.ComponentProps +import type { ComponentProps } from 'react' + +export type PipetteSelectionProps = ComponentProps export function PipetteSelection(props: PipetteSelectionProps): JSX.Element { const { t } = useTranslation('change_pipette') diff --git a/app/src/organisms/Desktop/Devices/ChangePipette/__tests__/ChangePipette.test.tsx b/app/src/organisms/Desktop/Devices/ChangePipette/__tests__/ChangePipette.test.tsx index 89112a484d4..6cedab5a47b 100644 --- a/app/src/organisms/Desktop/Devices/ChangePipette/__tests__/ChangePipette.test.tsx +++ b/app/src/organisms/Desktop/Devices/ChangePipette/__tests__/ChangePipette.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, it, describe, expect, beforeEach } from 'vitest' import { fireEvent, screen } from '@testing-library/react' @@ -21,6 +20,7 @@ import { ExitModal } from '../ExitModal' import { ConfirmPipette } from '../ConfirmPipette' import { ChangePipette } from '..' +import type { ComponentProps } from 'react' import type { NavigateFunction } from 'react-router-dom' import type { PipetteNameSpecs } from '@opentrons/shared-data' import type { AttachedPipette } from '/app/redux/pipettes/types' @@ -54,7 +54,7 @@ vi.mock('../ConfirmPipette') vi.mock('/app/resources/instruments') vi.mock('/app/assets/images') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] @@ -78,7 +78,7 @@ const mockAttachedPipettes = { } describe('ChangePipette', () => { - let props: React.ComponentProps + let props: ComponentProps let dispatchApiRequest: DispatchApiRequestType beforeEach(() => { diff --git a/app/src/organisms/Desktop/Devices/ChangePipette/__tests__/CheckPipettesButton.test.tsx b/app/src/organisms/Desktop/Devices/ChangePipette/__tests__/CheckPipettesButton.test.tsx index a5fa3a50bd6..ce6f7f2db25 100644 --- a/app/src/organisms/Desktop/Devices/ChangePipette/__tests__/CheckPipettesButton.test.tsx +++ b/app/src/organisms/Desktop/Devices/ChangePipette/__tests__/CheckPipettesButton.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { vi, it, describe, expect, beforeEach } from 'vitest' @@ -8,16 +7,18 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { CheckPipettesButton } from '../CheckPipettesButton' +import type { ComponentProps } from 'react' + vi.mock('@opentrons/react-api-client') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('CheckPipettesButton', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { robotName: 'otie', diff --git a/app/src/organisms/Desktop/Devices/ChangePipette/__tests__/ClearDeckModal.test.tsx b/app/src/organisms/Desktop/Devices/ChangePipette/__tests__/ClearDeckModal.test.tsx index f4af4566141..85ae7a52495 100644 --- a/app/src/organisms/Desktop/Devices/ChangePipette/__tests__/ClearDeckModal.test.tsx +++ b/app/src/organisms/Desktop/Devices/ChangePipette/__tests__/ClearDeckModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { vi, it, describe, expect, beforeEach } from 'vitest' @@ -6,13 +5,15 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { ClearDeckModal } from '../ClearDeckModal' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('ClearDeckModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { onContinueClick: vi.fn(), diff --git a/app/src/organisms/Desktop/Devices/ChangePipette/__tests__/ConfirmPipette.test.tsx b/app/src/organisms/Desktop/Devices/ChangePipette/__tests__/ConfirmPipette.test.tsx index a328df38383..ebb06f3dc91 100644 --- a/app/src/organisms/Desktop/Devices/ChangePipette/__tests__/ConfirmPipette.test.tsx +++ b/app/src/organisms/Desktop/Devices/ChangePipette/__tests__/ConfirmPipette.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { vi, it, describe, expect } from 'vitest' @@ -9,6 +8,7 @@ import { mockPipetteInfo } from '/app/redux/pipettes/__fixtures__' import { CheckPipettesButton } from '../CheckPipettesButton' import { ConfirmPipette } from '../ConfirmPipette' +import type { ComponentProps } from 'react' import type { PipetteModelSpecs, PipetteNameSpecs, @@ -25,7 +25,7 @@ vi.mock('../LevelPipette', async importOriginal => { } }) -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] @@ -87,7 +87,7 @@ const MOCK_WANTED_PIPETTE = { } as PipetteNameSpecs describe('ConfirmPipette', () => { - let props: React.ComponentProps + let props: ComponentProps it('Should detach a pipette successfully', () => { props = { diff --git a/app/src/organisms/Desktop/Devices/ChangePipette/__tests__/ExitModal.test.tsx b/app/src/organisms/Desktop/Devices/ChangePipette/__tests__/ExitModal.test.tsx index 29bf417071c..0b4155ebd09 100644 --- a/app/src/organisms/Desktop/Devices/ChangePipette/__tests__/ExitModal.test.tsx +++ b/app/src/organisms/Desktop/Devices/ChangePipette/__tests__/ExitModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { vi, it, describe, expect, beforeEach } from 'vitest' @@ -6,13 +5,15 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { ExitModal } from '../ExitModal' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('ExitModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { back: vi.fn(), diff --git a/app/src/organisms/Desktop/Devices/ChangePipette/__tests__/InstructionStep.test.tsx b/app/src/organisms/Desktop/Devices/ChangePipette/__tests__/InstructionStep.test.tsx index 80cdde63972..39e53564b68 100644 --- a/app/src/organisms/Desktop/Devices/ChangePipette/__tests__/InstructionStep.test.tsx +++ b/app/src/organisms/Desktop/Devices/ChangePipette/__tests__/InstructionStep.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { it, describe, beforeEach } from 'vitest' import { screen } from '@testing-library/react' @@ -8,13 +7,15 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { InstructionStep } from '../InstructionStep' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('InstructionStep', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { children:
        children
        , diff --git a/app/src/organisms/Desktop/Devices/ChangePipette/__tests__/Instructions.test.tsx b/app/src/organisms/Desktop/Devices/ChangePipette/__tests__/Instructions.test.tsx index 024be58e798..4f01b748286 100644 --- a/app/src/organisms/Desktop/Devices/ChangePipette/__tests__/Instructions.test.tsx +++ b/app/src/organisms/Desktop/Devices/ChangePipette/__tests__/Instructions.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, it, describe, expect, beforeEach } from 'vitest' import { fireEvent, screen } from '@testing-library/react' @@ -12,9 +11,11 @@ import { mockPipetteInfo } from '/app/redux/pipettes/__fixtures__' import { Instructions } from '../Instructions' import { CheckPipettesButton } from '../CheckPipettesButton' +import type { ComponentProps } from 'react' + vi.mock('../CheckPipettesButton') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] @@ -29,7 +30,7 @@ const MOCK_ACTUAL_PIPETTE = { } as PipetteModelSpecs describe('Instructions', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/Desktop/Devices/ChangePipette/__tests__/LevelPipette.test.tsx b/app/src/organisms/Desktop/Devices/ChangePipette/__tests__/LevelPipette.test.tsx index 78c2e9f8d6d..3b74cf10ea1 100644 --- a/app/src/organisms/Desktop/Devices/ChangePipette/__tests__/LevelPipette.test.tsx +++ b/app/src/organisms/Desktop/Devices/ChangePipette/__tests__/LevelPipette.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, it, describe, expect, beforeEach } from 'vitest' import { fireEvent, screen } from '@testing-library/react' @@ -6,9 +5,11 @@ import { LEFT } from '@opentrons/shared-data' import { nestedTextMatcher, renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { LevelPipette } from '../LevelPipette' + +import type { ComponentProps } from 'react' import type { PipetteNameSpecs } from '@opentrons/shared-data' -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] @@ -57,7 +58,7 @@ const MOCK_WANTED_PIPETTE = { } as PipetteNameSpecs describe('LevelPipette', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/Desktop/Devices/ChangePipette/__tests__/PipetteSelection.test.tsx b/app/src/organisms/Desktop/Devices/ChangePipette/__tests__/PipetteSelection.test.tsx index f3619e9930d..9f507dc8a36 100644 --- a/app/src/organisms/Desktop/Devices/ChangePipette/__tests__/PipetteSelection.test.tsx +++ b/app/src/organisms/Desktop/Devices/ChangePipette/__tests__/PipetteSelection.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, it, describe, beforeEach } from 'vitest' import { screen } from '@testing-library/react' @@ -7,15 +6,17 @@ import { i18n } from '/app/i18n' import { PipetteSelect } from '/app/molecules/PipetteSelect' import { PipetteSelection } from '../PipetteSelection' +import type { ComponentProps } from 'react' + vi.mock('/app/molecules/PipetteSelect') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('PipetteSelection', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { pipetteName: null, diff --git a/app/src/organisms/Desktop/Devices/ConfigurePipette/ConfigFormGroup.tsx b/app/src/organisms/Desktop/Devices/ConfigurePipette/ConfigFormGroup.tsx index 9c8a2c25acf..e006efe1c5c 100644 --- a/app/src/organisms/Desktop/Devices/ConfigurePipette/ConfigFormGroup.tsx +++ b/app/src/organisms/Desktop/Devices/ConfigurePipette/ConfigFormGroup.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { Controller } from 'react-hook-form' import { CheckboxField, @@ -12,11 +11,12 @@ import { } from '@opentrons/components' import styles from './styles.module.css' +import type { ReactNode } from 'react' import type { Control } from 'react-hook-form' import type { DisplayFieldProps, DisplayQuirkFieldProps } from './ConfigForm' export interface FormColumnProps { - children: React.ReactNode + children: ReactNode } export function FormColumn(props: FormColumnProps): JSX.Element { @@ -65,7 +65,7 @@ export function ConfigFormGroup(props: ConfigFormGroupProps): JSX.Element { export interface ConfigFormRowProps { label: string labelFor: string - children: React.ReactNode + children: ReactNode } const FIELD_ID_PREFIX = '__PipetteConfig__' diff --git a/app/src/organisms/Desktop/Devices/ConfigurePipette/__tests__/ConfigFormResetButton.test.tsx b/app/src/organisms/Desktop/Devices/ConfigurePipette/__tests__/ConfigFormResetButton.test.tsx index 4c2ec08c7d4..7e26987f573 100644 --- a/app/src/organisms/Desktop/Devices/ConfigurePipette/__tests__/ConfigFormResetButton.test.tsx +++ b/app/src/organisms/Desktop/Devices/ConfigurePipette/__tests__/ConfigFormResetButton.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { vi, it, expect, describe, beforeEach } from 'vitest' @@ -6,14 +5,16 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { ConfigFormResetButton } from '../ConfigFormResetButton' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('ConfigFormResetButton', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { onClick: vi.fn(), diff --git a/app/src/organisms/Desktop/Devices/ConfigurePipette/__tests__/ConfigFormSubmitButton.test.tsx b/app/src/organisms/Desktop/Devices/ConfigurePipette/__tests__/ConfigFormSubmitButton.test.tsx index 3dbab681883..73db2ec1596 100644 --- a/app/src/organisms/Desktop/Devices/ConfigurePipette/__tests__/ConfigFormSubmitButton.test.tsx +++ b/app/src/organisms/Desktop/Devices/ConfigurePipette/__tests__/ConfigFormSubmitButton.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { it, expect, describe, beforeEach } from 'vitest' import { screen } from '@testing-library/react' @@ -6,14 +5,16 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { ConfigFormSubmitButton } from '../ConfigFormSubmitButton' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('ConfigFormSubmitButton', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { disabled: false, diff --git a/app/src/organisms/Desktop/Devices/ConfigurePipette/__tests__/ConfigurePipette.test.tsx b/app/src/organisms/Desktop/Devices/ConfigurePipette/__tests__/ConfigurePipette.test.tsx index 2d7790bdd24..5f810b3b97c 100644 --- a/app/src/organisms/Desktop/Devices/ConfigurePipette/__tests__/ConfigurePipette.test.tsx +++ b/app/src/organisms/Desktop/Devices/ConfigurePipette/__tests__/ConfigurePipette.test.tsx @@ -1,6 +1,6 @@ -import type * as React from 'react' import { when } from 'vitest-when' import { vi, it, expect, describe, beforeEach } from 'vitest' +import { screen } from '@testing-library/react' import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' @@ -9,14 +9,14 @@ import { ConfigurePipette } from '../../ConfigurePipette' import { mockPipetteSettingsFieldsMap } from '/app/redux/pipettes/__fixtures__' import { getConfig } from '/app/redux/config' +import type { ComponentProps } from 'react' import type { DispatchApiRequestType } from '/app/redux/robot-api' import type { State } from '/app/redux/types' -import { screen } from '@testing-library/react' vi.mock('/app/redux/robot-api') vi.mock('/app/redux/config') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] @@ -26,7 +26,7 @@ const mockRobotName = 'mockRobotName' describe('ConfigurePipette', () => { let dispatchApiRequest: DispatchApiRequestType - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/Desktop/Devices/ErrorRecoveryBanner/__tests__/ErrorRecoveryBanner.test.tsx b/app/src/organisms/Desktop/Devices/ErrorRecoveryBanner/__tests__/ErrorRecoveryBanner.test.tsx index fc234a52629..58a79593fe6 100644 --- a/app/src/organisms/Desktop/Devices/ErrorRecoveryBanner/__tests__/ErrorRecoveryBanner.test.tsx +++ b/app/src/organisms/Desktop/Devices/ErrorRecoveryBanner/__tests__/ErrorRecoveryBanner.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, vi, beforeEach } from 'vitest' import { screen } from '@testing-library/react' @@ -6,6 +5,8 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { useErrorRecoveryBanner, ErrorRecoveryBanner } from '..' +import type { ComponentProps } from 'react' + vi.mock('..', async importOriginal => { const actualReact = await importOriginal() return { @@ -14,7 +15,7 @@ vi.mock('..', async importOriginal => { } }) -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] diff --git a/app/src/organisms/Desktop/Devices/GripperCard/__tests__/AboutGripperSlideout.test.tsx b/app/src/organisms/Desktop/Devices/GripperCard/__tests__/AboutGripperSlideout.test.tsx index 9ad4381a40c..373ba5256af 100644 --- a/app/src/organisms/Desktop/Devices/GripperCard/__tests__/AboutGripperSlideout.test.tsx +++ b/app/src/organisms/Desktop/Devices/GripperCard/__tests__/AboutGripperSlideout.test.tsx @@ -1,18 +1,19 @@ -import type * as React from 'react' import { screen, fireEvent } from '@testing-library/react' import { describe, it, vi, beforeEach, expect } from 'vitest' import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { AboutGripperSlideout } from '../AboutGripperSlideout' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('AboutGripperSlideout', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { serialNumber: '123', diff --git a/app/src/organisms/Desktop/Devices/GripperCard/__tests__/GripperCard.test.tsx b/app/src/organisms/Desktop/Devices/GripperCard/__tests__/GripperCard.test.tsx index ccdbc80c2b3..32538ba2cb5 100644 --- a/app/src/organisms/Desktop/Devices/GripperCard/__tests__/GripperCard.test.tsx +++ b/app/src/organisms/Desktop/Devices/GripperCard/__tests__/GripperCard.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, vi, beforeEach, expect } from 'vitest' import { renderWithProviders } from '/app/__testing-utils__' @@ -7,20 +6,22 @@ import { i18n } from '/app/i18n' import { GripperWizardFlows } from '/app/organisms/GripperWizardFlows' import { AboutGripperSlideout } from '../AboutGripperSlideout' import { GripperCard } from '../' + +import type { ComponentProps } from 'react' import type { GripperData } from '@opentrons/api-client' vi.mock('/app/organisms/GripperWizardFlows') vi.mock('../AboutGripperSlideout') vi.mock('@opentrons/react-api-client') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('GripperCard', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { attachedGripper: { diff --git a/app/src/organisms/Desktop/Devices/HistoricalProtocolRunOverflowMenu.tsx b/app/src/organisms/Desktop/Devices/HistoricalProtocolRunOverflowMenu.tsx index 18dc44cb11b..b696d8285cb 100644 --- a/app/src/organisms/Desktop/Devices/HistoricalProtocolRunOverflowMenu.tsx +++ b/app/src/organisms/Desktop/Devices/HistoricalProtocolRunOverflowMenu.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useTranslation } from 'react-i18next' import { NavLink, useNavigate } from 'react-router-dom' @@ -38,6 +37,7 @@ import { useIsEstopNotDisengaged } from '/app/resources/devices' import { useTrackProtocolRunEvent } from '/app/redux-resources/analytics' import { useRobot } from '/app/redux-resources/robots' +import type { MouseEventHandler } from 'react' import type { Run } from '@opentrons/api-client' export interface HistoricalProtocolRunOverflowMenuProps { @@ -99,7 +99,7 @@ export function HistoricalProtocolRunOverflowMenu( } interface MenuDropdownProps extends HistoricalProtocolRunOverflowMenuProps { - closeOverflowMenu: React.MouseEventHandler + closeOverflowMenu: MouseEventHandler downloadRunLog: () => void isRunLogLoading: boolean } @@ -126,7 +126,7 @@ function MenuDropdown(props: MenuDropdownProps): JSX.Element { `/devices/${robotName}/protocol-runs/${createRunResponse.data.id}/run-preview` ) } - const onDownloadClick: React.MouseEventHandler = e => { + const onDownloadClick: MouseEventHandler = e => { e.preventDefault() e.stopPropagation() downloadRunLog() @@ -143,9 +143,7 @@ function MenuDropdown(props: MenuDropdownProps): JSX.Element { const robotSerialNumber = robot?.health?.robot_serial ?? robot?.serverHealth?.serialNumber ?? null - const handleResetClick: React.MouseEventHandler = ( - e - ): void => { + const handleResetClick: MouseEventHandler = (e): void => { e.preventDefault() e.stopPropagation() @@ -160,7 +158,7 @@ function MenuDropdown(props: MenuDropdownProps): JSX.Element { trackProtocolRunEvent({ name: ANALYTICS_PROTOCOL_RUN_ACTION.AGAIN }) } - const handleDeleteClick: React.MouseEventHandler = e => { + const handleDeleteClick: MouseEventHandler = e => { e.preventDefault() e.stopPropagation() deleteRun(runId) diff --git a/app/src/organisms/Desktop/Devices/PipetteCard/__tests__/AboutPipetteSlideout.test.tsx b/app/src/organisms/Desktop/Devices/PipetteCard/__tests__/AboutPipetteSlideout.test.tsx index dd2274a3ab3..c39a0e286fc 100644 --- a/app/src/organisms/Desktop/Devices/PipetteCard/__tests__/AboutPipetteSlideout.test.tsx +++ b/app/src/organisms/Desktop/Devices/PipetteCard/__tests__/AboutPipetteSlideout.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, vi, beforeEach, expect } from 'vitest' import '@testing-library/jest-dom/vitest' import { renderWithProviders } from '/app/__testing-utils__' @@ -7,16 +6,18 @@ import { i18n } from '/app/i18n' import { AboutPipetteSlideout } from '../AboutPipetteSlideout' import { mockLeftSpecs } from '/app/redux/pipettes/__fixtures__' +import type { ComponentProps } from 'react' + vi.mock('@opentrons/react-api-client') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('AboutPipetteSlideout', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { pipetteId: '123', diff --git a/app/src/organisms/Desktop/Devices/PipetteCard/__tests__/FlexPipetteCard.test.tsx b/app/src/organisms/Desktop/Devices/PipetteCard/__tests__/FlexPipetteCard.test.tsx index bd753e9f9d3..6bbb7eacbd9 100644 --- a/app/src/organisms/Desktop/Devices/PipetteCard/__tests__/FlexPipetteCard.test.tsx +++ b/app/src/organisms/Desktop/Devices/PipetteCard/__tests__/FlexPipetteCard.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, vi, beforeEach, afterEach, expect } from 'vitest' import { renderWithProviders } from '/app/__testing-utils__' @@ -11,8 +10,9 @@ import { FlexPipetteCard } from '../FlexPipetteCard' import { ChoosePipette } from '/app/organisms/PipetteWizardFlows/ChoosePipette' import { useDropTipWizardFlows } from '/app/organisms/DropTipWizardFlows' -import type { PipetteData } from '@opentrons/api-client' +import type { ComponentProps } from 'react' import type { Mock } from 'vitest' +import type { PipetteData } from '@opentrons/api-client' vi.mock('/app/organisms/PipetteWizardFlows') vi.mock('/app/organisms/PipetteWizardFlows/ChoosePipette') @@ -20,7 +20,7 @@ vi.mock('../AboutPipetteSlideout') vi.mock('/app/organisms/DropTipWizardFlows') vi.mock('@opentrons/react-api-client') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] @@ -29,7 +29,7 @@ const render = (props: React.ComponentProps) => { let mockDTWizToggle: Mock describe('FlexPipetteCard', () => { - let props: React.ComponentProps + let props: ComponentProps mockDTWizToggle = vi.fn() beforeEach(() => { props = { diff --git a/app/src/organisms/Desktop/Devices/PipetteCard/__tests__/PipetteCard.test.tsx b/app/src/organisms/Desktop/Devices/PipetteCard/__tests__/PipetteCard.test.tsx index e04796bd491..c71ee4ec4b4 100644 --- a/app/src/organisms/Desktop/Devices/PipetteCard/__tests__/PipetteCard.test.tsx +++ b/app/src/organisms/Desktop/Devices/PipetteCard/__tests__/PipetteCard.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { when } from 'vitest-when' import { fireEvent, screen } from '@testing-library/react' import { describe, it, vi, beforeEach, expect } from 'vitest' @@ -15,6 +14,7 @@ import { useDropTipWizardFlows } from '/app/organisms/DropTipWizardFlows' import { mockLeftSpecs, mockRightSpecs } from '/app/redux/pipettes/__fixtures__' +import type { ComponentProps } from 'react' import type { DispatchApiRequestType } from '/app/redux/robot-api' vi.mock('../PipetteOverflowMenu') @@ -24,7 +24,7 @@ vi.mock('@opentrons/react-api-client') vi.mock('/app/redux/pipettes') vi.mock('/app/organisms/DropTipWizardFlows') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] @@ -33,7 +33,7 @@ const render = (props: React.ComponentProps) => { const mockRobotName = 'mockRobotName' describe('PipetteCard', () => { let dispatchApiRequest: DispatchApiRequestType - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { dispatchApiRequest = vi.fn() diff --git a/app/src/organisms/Desktop/Devices/PipetteCard/__tests__/PipetteOverflowMenu.test.tsx b/app/src/organisms/Desktop/Devices/PipetteCard/__tests__/PipetteOverflowMenu.test.tsx index 155d955b6ea..273d6bdf7b6 100644 --- a/app/src/organisms/Desktop/Devices/PipetteCard/__tests__/PipetteOverflowMenu.test.tsx +++ b/app/src/organisms/Desktop/Devices/PipetteCard/__tests__/PipetteOverflowMenu.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, vi, beforeEach, expect } from 'vitest' import '@testing-library/jest-dom/vitest' @@ -11,8 +10,9 @@ import { } from '/app/redux/pipettes/__fixtures__' import { isFlexPipette } from '@opentrons/shared-data' -import type { Mount } from '/app/redux/pipettes/types' +import type { ComponentProps } from 'react' import type * as SharedData from '@opentrons/shared-data' +import type { Mount } from '/app/redux/pipettes/types' vi.mock('/app/redux/config') vi.mock('@opentrons/shared-data', async importOriginal => { @@ -23,7 +23,7 @@ vi.mock('@opentrons/shared-data', async importOriginal => { } }) -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] @@ -31,7 +31,7 @@ const render = (props: React.ComponentProps) => { const LEFT = 'left' as Mount describe('PipetteOverflowMenu', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/Desktop/Devices/PipetteCard/__tests__/PipetteSettingsSlideout.test.tsx b/app/src/organisms/Desktop/Devices/PipetteCard/__tests__/PipetteSettingsSlideout.test.tsx index 37b6f66b863..c75945cd549 100644 --- a/app/src/organisms/Desktop/Devices/PipetteCard/__tests__/PipetteSettingsSlideout.test.tsx +++ b/app/src/organisms/Desktop/Devices/PipetteCard/__tests__/PipetteSettingsSlideout.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { when } from 'vitest-when' import { fireEvent, waitFor, screen } from '@testing-library/react' import { describe, it, vi, beforeEach, expect } from 'vitest' @@ -16,13 +15,12 @@ import { mockPipetteSettingsFieldsMap, } from '/app/redux/pipettes/__fixtures__' +import type { ComponentProps } from 'react' import type { Mock } from 'vitest' vi.mock('@opentrons/react-api-client') -const render = ( - props: React.ComponentProps -) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] @@ -31,7 +29,7 @@ const render = ( const mockRobotName = 'mockRobotName' describe('PipetteSettingsSlideout', () => { - let props: React.ComponentProps + let props: ComponentProps let mockUpdatePipetteSettings: Mock beforeEach(() => { diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/BackToTopButton.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/BackToTopButton.tsx index a8524988bf2..909b49f1548 100644 --- a/app/src/organisms/Desktop/Devices/ProtocolRun/BackToTopButton.tsx +++ b/app/src/organisms/Desktop/Devices/ProtocolRun/BackToTopButton.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useTranslation } from 'react-i18next' import { Link } from 'react-router-dom' import { useRobot } from '/app/redux-resources/robots' @@ -10,8 +9,10 @@ import { ANALYTICS_PROTOCOL_PROCEED_TO_RUN, } from '/app/redux/analytics' +import type { RefObject } from 'react' + interface BackToTopButtonProps { - protocolRunHeaderRef: React.RefObject | null + protocolRunHeaderRef: RefObject | null robotName: string runId: string sourceLocation: string diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/EmptySetupStep.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/EmptySetupStep.tsx index 24c2b449083..5d9eb70774e 100644 --- a/app/src/organisms/Desktop/Devices/ProtocolRun/EmptySetupStep.tsx +++ b/app/src/organisms/Desktop/Devices/ProtocolRun/EmptySetupStep.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { COLORS, DIRECTION_COLUMN, @@ -10,10 +9,12 @@ import { JUSTIFY_SPACE_BETWEEN, } from '@opentrons/components' +import type { ReactNode } from 'react' + interface EmptySetupStepProps { - title: React.ReactNode + title: ReactNode description: string - rightElement?: React.ReactNode + rightElement?: ReactNode } export function EmptySetupStep(props: EmptySetupStepProps): JSX.Element { diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderBannerContainer/__tests__/ProtocolAnalysisErrorBanner.test.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderBannerContainer/__tests__/ProtocolAnalysisErrorBanner.test.tsx index 5b60de044d7..fceea1d15c0 100644 --- a/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderBannerContainer/__tests__/ProtocolAnalysisErrorBanner.test.tsx +++ b/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderBannerContainer/__tests__/ProtocolAnalysisErrorBanner.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, beforeEach } from 'vitest' @@ -6,16 +5,16 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { ProtocolAnalysisErrorBanner } from '../ProtocolAnalysisErrorBanner' -const render = ( - props: React.ComponentProps -) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('ProtocolAnalysisErrorBanner', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderContent/ActionButton/index.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderContent/ActionButton/index.tsx index 4b8c0f68076..31495064a14 100644 --- a/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderContent/ActionButton/index.tsx +++ b/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderContent/ActionButton/index.tsx @@ -1,5 +1,3 @@ -import type * as React from 'react' - import { RUN_STATUS_STOP_REQUESTED } from '@opentrons/api-client' import { ALIGN_CENTER, @@ -28,12 +26,13 @@ import { useActionBtnDisabledUtils, useActionButtonProperties } from './hooks' import { getFallbackRobotSerialNumber, isRunAgainStatus } from '../../utils' import { useIsRobotOnWrongVersionOfSoftware } from '/app/redux/robot-update' +import type { MutableRefObject } from 'react' import type { RunHeaderContentProps } from '..' export type BaseActionButtonProps = RunHeaderContentProps interface ActionButtonProps extends BaseActionButtonProps { - isResetRunLoadingRef: React.MutableRefObject + isResetRunLoadingRef: MutableRefObject } export function ActionButton(props: ActionButtonProps): JSX.Element { diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderContent/LabeledValue.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderContent/LabeledValue.tsx index 135dd72bbae..183f6194a3f 100644 --- a/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderContent/LabeledValue.tsx +++ b/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderContent/LabeledValue.tsx @@ -1,5 +1,3 @@ -import type * as React from 'react' - import { DIRECTION_COLUMN, COLORS, @@ -8,9 +6,11 @@ import { StyledText, } from '@opentrons/components' +import type { ReactNode } from 'react' + interface LabeledValueProps { label: string - value: React.ReactNode + value: ReactNode } export function LabeledValue(props: LabeledValueProps): JSX.Element { diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderContent/index.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderContent/index.tsx index 51908e4435d..7d653c6f439 100644 --- a/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderContent/index.tsx +++ b/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderContent/index.tsx @@ -1,16 +1,15 @@ -import type * as React from 'react' - import { RunHeaderSectionUpper } from './RunHeaderSectionUpper' import { RunHeaderSectionLower } from './RunHeaderSectionLower' -import type { ProtocolRunHeaderProps } from '..' +import type { MutableRefObject } from 'react' import type { AttachedModule, RunStatus } from '@opentrons/api-client' +import type { ProtocolRunHeaderProps } from '..' import type { RunControls } from '/app/organisms/RunTimeControl' import type { UseRunHeaderModalContainerResult } from '../RunHeaderModalContainer' export type RunHeaderContentProps = ProtocolRunHeaderProps & { runStatus: RunStatus | null - isResetRunLoadingRef: React.MutableRefObject + isResetRunLoadingRef: MutableRefObject attachedModules: AttachedModule[] protocolRunControls: RunControls runHeaderModalContainerUtils: UseRunHeaderModalContainerResult diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderModalContainer/modals/HeaterShakerIsRunningModal/__tests__/HeaterShakerIsRunningModal.test.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderModalContainer/modals/HeaterShakerIsRunningModal/__tests__/HeaterShakerIsRunningModal.test.tsx index 03b59af1b57..5960c2a39fa 100644 --- a/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderModalContainer/modals/HeaterShakerIsRunningModal/__tests__/HeaterShakerIsRunningModal.test.tsx +++ b/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderModalContainer/modals/HeaterShakerIsRunningModal/__tests__/HeaterShakerIsRunningModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, vi, beforeEach, expect } from 'vitest' @@ -12,6 +11,7 @@ import { HeaterShakerModuleCard } from '../HeaterShakerModuleCard' import { useAttachedModules } from '/app/resources/modules' import { useMostRecentCompletedAnalysis } from '/app/resources/runs' +import type { ComponentProps } from 'react' import type * as ReactApiClient from '@opentrons/react-api-client' vi.mock('@opentrons/react-api-client', async importOriginal => { @@ -69,16 +69,14 @@ const mockMovingHeaterShakerTwo = { usbPort: { path: '/dev/ot_module_heatershaker0', port: 1 }, } as any -const render = ( - props: React.ComponentProps -) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('HeaterShakerIsRunningModal', () => { - let props: React.ComponentProps + let props: ComponentProps let mockCreateLiveCommand = vi.fn() beforeEach(() => { props = { diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderModalContainer/modals/HeaterShakerIsRunningModal/__tests__/HeaterShakerModuleCard.test.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderModalContainer/modals/HeaterShakerIsRunningModal/__tests__/HeaterShakerModuleCard.test.tsx index 4cd20822890..8e98d4778fa 100644 --- a/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderModalContainer/modals/HeaterShakerIsRunningModal/__tests__/HeaterShakerModuleCard.test.tsx +++ b/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderModalContainer/modals/HeaterShakerIsRunningModal/__tests__/HeaterShakerModuleCard.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { screen } from '@testing-library/react' import { describe, it, vi, beforeEach } from 'vitest' @@ -8,16 +7,18 @@ import { i18n } from '/app/i18n' import { HeaterShakerModuleCard } from '../HeaterShakerModuleCard' import { HeaterShakerModuleData } from '/app/organisms/ModuleCard/HeaterShakerModuleData' +import type { ComponentProps } from 'react' + vi.mock('/app/organisms/ModuleCard/HeaterShakerModuleData') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('HeaterShakerModuleCard', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { module: mockHeaterShaker, diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderModalContainer/modals/HeaterShakerIsRunningModal/__tests__/hooks.test.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderModalContainer/modals/HeaterShakerIsRunningModal/__tests__/hooks.test.tsx index c5028c6a821..8c9c83fcaf9 100644 --- a/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderModalContainer/modals/HeaterShakerIsRunningModal/__tests__/hooks.test.tsx +++ b/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderModalContainer/modals/HeaterShakerIsRunningModal/__tests__/hooks.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { Provider } from 'react-redux' import { describe, it, vi, beforeEach, expect } from 'vitest' import { createStore } from 'redux' @@ -10,6 +9,7 @@ import { RUN_ID_1 } from '/app/resources/runs/__fixtures__' import { useMostRecentCompletedAnalysis } from '/app/resources/runs' import { useHeaterShakerModuleIdsFromRun } from '../hooks' +import type { FunctionComponent, ReactNode } from 'react' import type { Store } from 'redux' import type { State } from '/app/redux/types' @@ -57,7 +57,7 @@ describe('useHeaterShakerModuleIdsFromRun', () => { }, ], } as any) - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) => {children} const { result } = renderHook( @@ -127,7 +127,7 @@ describe('useHeaterShakerModuleIdsFromRun', () => { ], } as any) - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) => {children} const { result } = renderHook( diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderModalContainer/modals/__tests__/ConfirmCancelModal.test.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderModalContainer/modals/__tests__/ConfirmCancelModal.test.tsx index c6421040e17..08559f181be 100644 --- a/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderModalContainer/modals/__tests__/ConfirmCancelModal.test.tsx +++ b/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderModalContainer/modals/__tests__/ConfirmCancelModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { when } from 'vitest-when' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest' @@ -17,6 +16,7 @@ import { useIsFlex } from '/app/redux-resources/robots' import { useTrackEvent } from '/app/redux/analytics' import { ConfirmCancelModal } from '../ConfirmCancelModal' +import type { ComponentProps } from 'react' import type * as ApiClient from '@opentrons/react-api-client' vi.mock('@opentrons/react-api-client', async importOriginal => { @@ -30,7 +30,7 @@ vi.mock('/app/redux/analytics') vi.mock('/app/redux-resources/analytics') vi.mock('/app/redux-resources/robots') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] @@ -43,7 +43,7 @@ let mockTrackProtocolRunEvent: any const ROBOT_NAME = 'otie' describe('ConfirmCancelModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { mockTrackEvent = vi.fn() mockStopRun = vi.fn((_runId, opts) => opts.onSuccess()) diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderModalContainer/modals/__tests__/ProtocolAnalysisErrorModal.test.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderModalContainer/modals/__tests__/ProtocolAnalysisErrorModal.test.tsx index 44fcb0278ad..027f6b76b03 100644 --- a/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderModalContainer/modals/__tests__/ProtocolAnalysisErrorModal.test.tsx +++ b/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderModalContainer/modals/__tests__/ProtocolAnalysisErrorModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, beforeEach, expect, vi } from 'vitest' @@ -6,16 +5,16 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { ProtocolAnalysisErrorModal } from '../ProtocolAnalysisErrorModal' -const render = ( - props: React.ComponentProps -) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('ProtocolAnalysisErrorModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderModalContainer/modals/__tests__/ProtocolDropTipModal.test.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderModalContainer/modals/__tests__/ProtocolDropTipModal.test.tsx index 0d95071a969..4e583be0648 100644 --- a/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderModalContainer/modals/__tests__/ProtocolDropTipModal.test.tsx +++ b/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderModalContainer/modals/__tests__/ProtocolDropTipModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, vi, expect, beforeEach } from 'vitest' import { renderHook, act, screen, fireEvent } from '@testing-library/react' @@ -10,6 +9,7 @@ import { ProtocolDropTipModal, } from '../ProtocolDropTipModal' +import type { ComponentProps } from 'react' import type { Mock } from 'vitest' vi.mock('/app/local-resources/instruments') @@ -104,14 +104,14 @@ describe('useProtocolDropTipModal', () => { }) }) -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('ProtocolDropTipModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderModalContainer/modals/__tests__/RunFailedModal.test.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderModalContainer/modals/__tests__/RunFailedModal.test.tsx index d49875a0859..75ea8c0c720 100644 --- a/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderModalContainer/modals/__tests__/RunFailedModal.test.tsx +++ b/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/RunHeaderModalContainer/modals/__tests__/RunFailedModal.test.tsx @@ -1,5 +1,5 @@ -import type * as React from 'react' import { describe, it, beforeEach, vi, expect, afterEach } from 'vitest' +import { fireEvent, screen } from '@testing-library/react' import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' @@ -7,8 +7,9 @@ import { useDownloadRunLog } from '../../../../../hooks' import { RunFailedModal } from '../RunFailedModal' import { RUN_STATUS_FAILED } from '@opentrons/api-client' + +import type { ComponentProps } from 'react' import type { RunError } from '@opentrons/api-client' -import { fireEvent, screen } from '@testing-library/react' vi.mock('../../../../../hooks') @@ -25,14 +26,14 @@ const mockError: RunError = { wrappedErrors: [], } -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('RunFailedModal - DesktopApp', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/__tests__/ProtocolRunHeader.test.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/__tests__/ProtocolRunHeader.test.tsx index e82d58cb75e..f6c88119707 100644 --- a/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/__tests__/ProtocolRunHeader.test.tsx +++ b/app/src/organisms/Desktop/Devices/ProtocolRun/ProtocolRunHeader/__tests__/ProtocolRunHeader.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, vi, expect, beforeEach, afterEach } from 'vitest' import { screen } from '@testing-library/react' import { useNavigate } from 'react-router-dom' @@ -26,6 +25,8 @@ import { useRunHeaderRunControls, } from '../hooks' +import type { ComponentProps } from 'react' + vi.mock('react-router-dom') vi.mock('@opentrons/react-api-client') vi.mock('/app/redux-resources/robots') @@ -43,7 +44,7 @@ const MOCK_RUN_ID = 'MOCK_RUN_ID' const MOCK_ROBOT = 'MOCK_ROBOT' describe('ProtocolRunHeader', () => { - let props: React.ComponentProps + let props: ComponentProps const mockNavigate = vi.fn() beforeEach(() => { @@ -92,7 +93,7 @@ describe('ProtocolRunHeader', () => { vi.resetAllMocks() }) - const render = (props: React.ComponentProps) => { + const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabware/__tests__/LabwareListItem.test.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabware/__tests__/LabwareListItem.test.tsx index eabef743182..89622cd7e5e 100644 --- a/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabware/__tests__/LabwareListItem.test.tsx +++ b/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabware/__tests__/LabwareListItem.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, beforeEach, vi, expect } from 'vitest' import { MemoryRouter } from 'react-router-dom' @@ -21,6 +20,8 @@ import { getLocationInfoNames } from '/app/transformations/commands' import { mockLabwareDef } from '/app/organisms/LegacyLabwarePositionCheck/__fixtures__/mockLabwareDef' import { SecureLabwareModal } from '../SecureLabwareModal' import { LabwareListItem } from '../LabwareListItem' + +import type { ComponentProps } from 'react' import type { LoadLabwareRunTimeCommand, ModuleModel, @@ -78,7 +79,7 @@ const mockThermocyclerModuleDefinition = { const mockModuleId = 'moduleId' const mockNickName = 'nickName' -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders( diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabware/__tests__/OffDeckLabwareList.test.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabware/__tests__/OffDeckLabwareList.test.tsx index 0204958f0f0..b543c3f27c8 100644 --- a/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabware/__tests__/OffDeckLabwareList.test.tsx +++ b/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabware/__tests__/OffDeckLabwareList.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { MemoryRouter } from 'react-router-dom' import { screen } from '@testing-library/react' import { describe, it, beforeEach, vi, expect } from 'vitest' @@ -9,9 +8,11 @@ import { mockLabwareDef } from '/app/organisms/LegacyLabwarePositionCheck/__fixt import { LabwareListItem } from '../LabwareListItem' import { OffDeckLabwareList } from '../OffDeckLabwareList' +import type { ComponentProps } from 'react' + vi.mock('../LabwareListItem') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders( diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabware/__tests__/SecureLabwareModal.test.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabware/__tests__/SecureLabwareModal.test.tsx index 80147006dc1..f367e007375 100644 --- a/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabware/__tests__/SecureLabwareModal.test.tsx +++ b/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabware/__tests__/SecureLabwareModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, beforeEach, vi, expect } from 'vitest' @@ -6,7 +5,9 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { SecureLabwareModal } from '../SecureLabwareModal' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] @@ -15,7 +16,7 @@ const mockTypeMagDeck = 'magneticModuleType' const mockTypeTC = 'thermocyclerModuleType' describe('SecureLabwareModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { type: mockTypeMagDeck, onCloseClick: vi.fn() } }) diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabware/__tests__/SetupLabwareList.test.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabware/__tests__/SetupLabwareList.test.tsx index 85068d39a1b..9f9860de1d4 100644 --- a/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabware/__tests__/SetupLabwareList.test.tsx +++ b/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabware/__tests__/SetupLabwareList.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { MemoryRouter } from 'react-router-dom' import { describe, it, beforeEach, vi } from 'vitest' import { screen } from '@testing-library/react' @@ -9,13 +8,15 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { SetupLabwareList } from '../SetupLabwareList' import { LabwareListItem } from '../LabwareListItem' + +import type { ComponentProps } from 'react' import type { CompletedProtocolAnalysis } from '@opentrons/shared-data' vi.mock('../LabwareListItem') const protocolWithTC = (multiple_tipacks_with_tc as unknown) as CompletedProtocolAnalysis -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders( diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabware/__tests__/SetupLabwareMap.test.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabware/__tests__/SetupLabwareMap.test.tsx index 40f63cbc170..57a84b1f737 100644 --- a/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabware/__tests__/SetupLabwareMap.test.tsx +++ b/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabware/__tests__/SetupLabwareMap.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { when } from 'vitest-when' import { MemoryRouter } from 'react-router-dom' import { describe, it, beforeEach, vi, afterEach, expect } from 'vitest' @@ -20,6 +19,7 @@ import { } from '/app/transformations/analysis' import { SetupLabwareMap } from '../SetupLabwareMap' +import type { ComponentProps } from 'react' import type { CompletedProtocolAnalysis, LabwareDefinition2, @@ -86,7 +86,7 @@ const mockTCModule = { type: 'thermocyclerModuleType' as ModuleType, } -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders( diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabwarePositionCheck/__tests__/CurrentOffsetsTable.test.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabwarePositionCheck/__tests__/CurrentOffsetsTable.test.tsx index 334d5328cec..db2e5a8b5a1 100644 --- a/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabwarePositionCheck/__tests__/CurrentOffsetsTable.test.tsx +++ b/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabwarePositionCheck/__tests__/CurrentOffsetsTable.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, beforeEach, vi, expect, afterEach } from 'vitest' import { screen } from '@testing-library/react' @@ -15,6 +14,7 @@ import { useLPCDisabledReason } from '/app/resources/runs' import { getLatestCurrentOffsets } from '/app/transformations/runs' import { CurrentOffsetsTable } from '../CurrentOffsetsTable' +import type { ComponentProps } from 'react' import type { CompletedProtocolAnalysis } from '@opentrons/shared-data' import type { LabwareOffset } from '@opentrons/api-client' @@ -31,7 +31,7 @@ vi.mock('@opentrons/shared-data', async importOriginal => { } }) -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] @@ -64,7 +64,7 @@ const mockCurrentOffsets: LabwareOffset[] = [ ] describe('CurrentOffsetsTable', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { currentOffsets: mockCurrentOffsets, diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabwarePositionCheck/__tests__/HowLPCWorksModal.test.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabwarePositionCheck/__tests__/HowLPCWorksModal.test.tsx index 5dd3d15db69..a12b6948d75 100644 --- a/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabwarePositionCheck/__tests__/HowLPCWorksModal.test.tsx +++ b/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabwarePositionCheck/__tests__/HowLPCWorksModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, vi, beforeEach, expect } from 'vitest' @@ -6,14 +5,16 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { HowLPCWorksModal } from '../HowLPCWorksModal' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('HowLPCWorksModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { onCloseClick: vi.fn() } }) diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLiquids/__tests__/SetupLiquids.test.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLiquids/__tests__/SetupLiquids.test.tsx index 736d5f5bc85..8436072e2f1 100644 --- a/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLiquids/__tests__/SetupLiquids.test.tsx +++ b/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLiquids/__tests__/SetupLiquids.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, beforeEach, vi, expect } from 'vitest' import { screen, fireEvent } from '@testing-library/react' @@ -11,6 +10,8 @@ import { SetupLiquidsList } from '../SetupLiquidsList' import { SetupLiquidsMap } from '../SetupLiquidsMap' import { useRunHasStarted } from '/app/resources/runs' +import type { ComponentProps } from 'react' + vi.mock('@opentrons/components', async () => { const actual = await vi.importActual('@opentrons/components') return { @@ -24,7 +25,7 @@ vi.mock('/app/resources/runs') describe('SetupLiquids', () => { const render = ( - props: React.ComponentProps & { + props: ComponentProps & { startConfirmed?: boolean } ) => { @@ -47,7 +48,7 @@ describe('SetupLiquids', () => { ) } - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { vi.mocked(SetupLiquidsList).mockReturnValue(
        Mock setup liquids list
        diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLiquids/__tests__/SetupLiquidsList.test.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLiquids/__tests__/SetupLiquidsList.test.tsx index 60cb6a759a0..2d96d408044 100644 --- a/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLiquids/__tests__/SetupLiquidsList.test.tsx +++ b/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLiquids/__tests__/SetupLiquidsList.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { when } from 'vitest-when' import { describe, it, beforeEach, vi, expect } from 'vitest' @@ -25,6 +24,7 @@ import { import { LiquidsLabwareDetailsModal } from '/app/organisms/LiquidsLabwareDetailsModal' import { useNotifyRunQuery } from '/app/resources/runs' +import type { ComponentProps } from 'react' import type { Mock } from 'vitest' import type * as SharedData from '@opentrons/shared-data' @@ -70,7 +70,7 @@ vi.mock('@opentrons/shared-data', async importOriginal => { vi.mock('/app/redux/analytics') vi.mock('/app/resources/runs') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) @@ -78,7 +78,7 @@ const render = (props: React.ComponentProps) => { let mockTrackEvent: Mock describe('SetupLiquidsList', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { runId: '123', robotName: 'test_flex' } vi.mocked(getTotalVolumePerLiquidId).mockReturnValue(400) diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLiquids/__tests__/SetupLiquidsMap.test.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLiquids/__tests__/SetupLiquidsMap.test.tsx index 023e73af09c..97e96232b7e 100644 --- a/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLiquids/__tests__/SetupLiquidsMap.test.tsx +++ b/app/src/organisms/Desktop/Devices/ProtocolRun/SetupLiquids/__tests__/SetupLiquidsMap.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { when } from 'vitest-when' import { screen } from '@testing-library/react' import { describe, it, beforeEach, vi, afterEach, expect } from 'vitest' @@ -35,6 +34,7 @@ import { mockFetchModulesSuccessActionPayloadModules } from '/app/redux/modules/ import { SetupLiquidsMap } from '../SetupLiquidsMap' +import type { ComponentProps } from 'react' import type { ModuleModel, ModuleType, @@ -102,7 +102,7 @@ const mockMagneticModule = { quirks: [], } -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) @@ -113,7 +113,7 @@ const mockProtocolAnalysis = { } as any describe('SetupLiquidsMap', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { runId: RUN_ID, diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/SetupModuleAndDeck/__tests__/NotConfiguredModal.test.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/SetupModuleAndDeck/__tests__/NotConfiguredModal.test.tsx index 9f371faaa64..fc2b584cf22 100644 --- a/app/src/organisms/Desktop/Devices/ProtocolRun/SetupModuleAndDeck/__tests__/NotConfiguredModal.test.tsx +++ b/app/src/organisms/Desktop/Devices/ProtocolRun/SetupModuleAndDeck/__tests__/NotConfiguredModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, beforeEach, vi, expect } from 'vitest' import { renderWithProviders } from '/app/__testing-utils__' @@ -9,20 +8,21 @@ import { i18n } from '/app/i18n' import { NotConfiguredModal } from '../NotConfiguredModal' import { useNotifyDeckConfigurationQuery } from '/app/resources/deck_configuration' +import type { ComponentProps } from 'react' import type { UseQueryResult } from 'react-query' import type { DeckConfiguration } from '@opentrons/shared-data' vi.mock('@opentrons/react-api-client') vi.mock('/app/resources/deck_configuration') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('NotConfiguredModal', () => { - let props: React.ComponentProps + let props: ComponentProps const mockUpdate = vi.fn() beforeEach(() => { props = { diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/SetupModuleAndDeck/__tests__/SetupFixtureList.test.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/SetupModuleAndDeck/__tests__/SetupFixtureList.test.tsx index dd0236ac96d..61708168788 100644 --- a/app/src/organisms/Desktop/Devices/ProtocolRun/SetupModuleAndDeck/__tests__/SetupFixtureList.test.tsx +++ b/app/src/organisms/Desktop/Devices/ProtocolRun/SetupModuleAndDeck/__tests__/SetupFixtureList.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, beforeEach, vi } from 'vitest' import { renderWithProviders } from '/app/__testing-utils__' @@ -16,6 +15,7 @@ import { NotConfiguredModal } from '../NotConfiguredModal' import { LocationConflictModal } from '/app/organisms/LocationConflictModal' import { DeckFixtureSetupInstructionsModal } from '/app/organisms/DeviceDetailsDeckConfiguration/DeckFixtureSetupInstructionsModal' +import type { ComponentProps } from 'react' import type { CutoutConfigAndCompatibility } from '/app/resources/deck_configuration/hooks' vi.mock('/app/resources/deck_configuration/hooks') @@ -61,14 +61,14 @@ const mockConflictDeckConfigCompatibility: CutoutConfigAndCompatibility[] = [ }, ] -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('SetupFixtureList', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { deckConfigCompatibility: mockDeckConfigCompatibility, diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/SetupModuleAndDeck/__tests__/SetupModulesAndDeck.test.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/SetupModuleAndDeck/__tests__/SetupModulesAndDeck.test.tsx index 21926d3c823..615bb5a487d 100644 --- a/app/src/organisms/Desktop/Devices/ProtocolRun/SetupModuleAndDeck/__tests__/SetupModulesAndDeck.test.tsx +++ b/app/src/organisms/Desktop/Devices/ProtocolRun/SetupModuleAndDeck/__tests__/SetupModulesAndDeck.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { when } from 'vitest-when' import { describe, it, beforeEach, expect, vi } from 'vitest' import { fireEvent, screen } from '@testing-library/react' @@ -20,6 +19,8 @@ import { SetupModulesList } from '../SetupModulesList' import { SetupModulesMap } from '../SetupModulesMap' import { SetupFixtureList } from '../SetupFixtureList' +import type { ComponentProps } from 'react' + vi.mock('/app/redux-resources/robots') vi.mock('../SetupModulesList') vi.mock('../SetupModulesMap') @@ -31,14 +32,14 @@ vi.mock('/app/resources/runs') const MOCK_ROBOT_NAME = 'otie' const MOCK_RUN_ID = '1' -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('SetupModuleAndDeck', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { robotName: MOCK_ROBOT_NAME, diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/SetupModuleAndDeck/__tests__/SetupModulesList.test.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/SetupModuleAndDeck/__tests__/SetupModulesList.test.tsx index e62d600cea6..95c95fced5a 100644 --- a/app/src/organisms/Desktop/Devices/ProtocolRun/SetupModuleAndDeck/__tests__/SetupModulesList.test.tsx +++ b/app/src/organisms/Desktop/Devices/ProtocolRun/SetupModuleAndDeck/__tests__/SetupModulesList.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { when } from 'vitest-when' import { fireEvent, screen, waitFor } from '@testing-library/react' import { describe, it, beforeEach, expect, vi } from 'vitest' @@ -27,6 +26,7 @@ import { UnMatchedModuleWarning } from '../UnMatchedModuleWarning' import { SetupModulesList } from '../SetupModulesList' import { LocationConflictModal } from '/app/organisms/LocationConflictModal' +import type { ComponentProps } from 'react' import type { ModuleModel, ModuleType } from '@opentrons/shared-data' import type { DiscoveredRobot } from '/app/redux/discovery/types' @@ -77,14 +77,14 @@ const mockCalibratedData = { last_modified: '2023-06-01T14:42:20.131798+00:00', } -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('SetupModulesList', () => { - let props: React.ComponentProps + let props: ComponentProps let mockChainLiveCommands = vi.fn() beforeEach(() => { props = { diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/SetupModuleAndDeck/__tests__/SetupModulesMap.test.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/SetupModuleAndDeck/__tests__/SetupModulesMap.test.tsx index 9d9449283dc..c7619b44f9b 100644 --- a/app/src/organisms/Desktop/Devices/ProtocolRun/SetupModuleAndDeck/__tests__/SetupModulesMap.test.tsx +++ b/app/src/organisms/Desktop/Devices/ProtocolRun/SetupModuleAndDeck/__tests__/SetupModulesMap.test.tsx @@ -1,6 +1,4 @@ /* eslint-disable @typescript-eslint/no-unsafe-argument */ - -import type * as React from 'react' import { when } from 'vitest-when' import { MemoryRouter } from 'react-router-dom' import { describe, it, beforeEach, vi, afterEach, expect } from 'vitest' @@ -18,6 +16,8 @@ import { useMostRecentCompletedAnalysis } from '/app/resources/runs' import { ModuleInfo } from '/app/molecules/ModuleInfo' import { SetupModulesMap } from '../SetupModulesMap' import { getAttachedProtocolModuleMatches } from '/app/transformations/analysis' + +import type { ComponentProps } from 'react' import type { CompletedProtocolAnalysis, ModuleModel, @@ -47,7 +47,7 @@ vi.mock('/app/transformations/analysis') vi.mock('/app/molecules/ModuleInfo') vi.mock('/app/resources/modules') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders( @@ -98,7 +98,7 @@ const mockTCModule = { } describe('SetupModulesMap', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { runId: MOCK_RUN_ID, diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/SetupStep.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/SetupStep.tsx index 25f2baf1d64..2d5fedf7700 100644 --- a/app/src/organisms/Desktop/Devices/ProtocolRun/SetupStep.tsx +++ b/app/src/organisms/Desktop/Devices/ProtocolRun/SetupStep.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { css } from 'styled-components' import { @@ -18,19 +17,21 @@ import { TYPOGRAPHY, } from '@opentrons/components' +import type { ReactNode } from 'react' + interface SetupStepProps { /** whether or not to show the full contents of the step */ expanded: boolean /** always shown text name of the step */ - title: React.ReactNode + title: ReactNode /** always shown text that provides a one sentence explanation of the contents */ description: string /** callback that should toggle the expanded state (managed by parent) */ toggleExpanded: () => void /** contents to be shown only when expanded */ - children: React.ReactNode + children: ReactNode /** element to be shown (right aligned) regardless of expanded state */ - rightElement: React.ReactNode + rightElement: ReactNode } const EXPANDED_STYLE = css` diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/__tests__/EmptySetupStep.test.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/__tests__/EmptySetupStep.test.tsx index 673d8b4806c..b716de57f06 100644 --- a/app/src/organisms/Desktop/Devices/ProtocolRun/__tests__/EmptySetupStep.test.tsx +++ b/app/src/organisms/Desktop/Devices/ProtocolRun/__tests__/EmptySetupStep.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, beforeEach } from 'vitest' import { screen } from '@testing-library/react' @@ -6,14 +5,16 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { EmptySetupStep } from '../EmptySetupStep' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('EmptySetupStep', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { title: 'mockTitle', diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/__tests__/LabwareInfoOverlay.test.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/__tests__/LabwareInfoOverlay.test.tsx index 0198aa9e448..a47f37e1136 100644 --- a/app/src/organisms/Desktop/Devices/ProtocolRun/__tests__/LabwareInfoOverlay.test.tsx +++ b/app/src/organisms/Desktop/Devices/ProtocolRun/__tests__/LabwareInfoOverlay.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { when } from 'vitest-when' import { screen } from '@testing-library/react' import { describe, it, beforeEach, vi, afterEach, expect } from 'vitest' @@ -13,6 +12,8 @@ import { getLabwareLocation } from '/app/transformations/commands' import { LabwareInfoOverlay } from '../LabwareInfoOverlay' import { getLabwareDefinitionUri } from '/app/transformations/protocols' import { useLabwareOffsetForLabware } from '../useLabwareOffsetForLabware' + +import type { ComponentProps } from 'react' import type { LabwareDefinition2, ProtocolFile, @@ -33,7 +34,7 @@ vi.mock('@opentrons/shared-data', async importOriginal => { } }) -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders( @@ -51,7 +52,7 @@ const MOCK_LABWARE_VECTOR = { x: 1, y: 2, z: 3 } const MOCK_RUN_ID = 'fake_run_id' describe('LabwareInfoOverlay', () => { - let props: React.ComponentProps + let props: ComponentProps let labware: LoadedLabware[] let labwareDefinitions: ProtocolFile<{}>['labwareDefinitions'] beforeEach(() => { diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/__tests__/ProtocolRunModuleControls.test.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/__tests__/ProtocolRunModuleControls.test.tsx index 5dd1507f893..1895c2e4eca 100644 --- a/app/src/organisms/Desktop/Devices/ProtocolRun/__tests__/ProtocolRunModuleControls.test.tsx +++ b/app/src/organisms/Desktop/Devices/ProtocolRun/__tests__/ProtocolRunModuleControls.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { when } from 'vitest-when' import { describe, it, beforeEach, vi, afterEach } from 'vitest' import { screen } from '@testing-library/react' @@ -15,6 +14,8 @@ import { mockThermocycler, mockHeaterShaker, } from '/app/redux/modules/__fixtures__' + +import type { ComponentProps } from 'react' import type { ModuleModel, ModuleType } from '@opentrons/shared-data' vi.mock('@opentrons/react-api-client') @@ -49,9 +50,7 @@ const mockTCModule = { } const MOCK_TC_COORDS = [20, 30, 0] -const render = ( - props: React.ComponentProps -) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/__tests__/ProtocolRunRuntimeParameters.test.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/__tests__/ProtocolRunRuntimeParameters.test.tsx index 59425f6ff6b..99922644961 100644 --- a/app/src/organisms/Desktop/Devices/ProtocolRun/__tests__/ProtocolRunRuntimeParameters.test.tsx +++ b/app/src/organisms/Desktop/Devices/ProtocolRun/__tests__/ProtocolRunRuntimeParameters.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, vi, beforeEach, afterEach, expect } from 'vitest' import { screen } from '@testing-library/react' import { when } from 'vitest-when' @@ -16,6 +15,7 @@ import { } from '/app/resources/runs/__fixtures__' import { ProtocolRunRuntimeParameters } from '../ProtocolRunRunTimeParameters' +import type { ComponentProps } from 'react' import type { UseQueryResult } from 'react-query' import type { Run } from '@opentrons/api-client' import type { @@ -100,16 +100,14 @@ const mockCsvRtp = { }, } -const render = ( - props: React.ComponentProps -) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('ProtocolRunRuntimeParameters', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { runId: RUN_ID, diff --git a/app/src/organisms/Desktop/Devices/ProtocolRun/__tests__/SetupCalibrationItem.test.tsx b/app/src/organisms/Desktop/Devices/ProtocolRun/__tests__/SetupCalibrationItem.test.tsx index e39e5d7c83c..9002eb0da0d 100644 --- a/app/src/organisms/Desktop/Devices/ProtocolRun/__tests__/SetupCalibrationItem.test.tsx +++ b/app/src/organisms/Desktop/Devices/ProtocolRun/__tests__/SetupCalibrationItem.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { screen } from '@testing-library/react' import { when } from 'vitest-when' import { describe, it, beforeEach, vi, afterEach } from 'vitest' @@ -9,6 +8,8 @@ import { useRunHasStarted } from '/app/resources/runs' import { formatTimestamp } from '/app/transformations/runs' import { SetupCalibrationItem } from '../SetupCalibrationItem' +import type { ComponentProps } from 'react' + vi.mock('/app/resources/runs') vi.mock('/app/transformations/runs') @@ -21,7 +22,7 @@ describe('SetupCalibrationItem', () => { title = 'stub title', button = , runId = RUN_ID, - }: Partial> = {}) => { + }: Partial> = {}) => { return renderWithProviders( { const render = ({ mount = 'left', runId = RUN_ID, - }: Partial< - React.ComponentProps - > = {}) => { + }: Partial> = {}) => { return renderWithProviders( { mount = 'left', robotName = ROBOT_NAME, runId = RUN_ID, - }: Partial< - React.ComponentProps - > = {}) => { + }: Partial> = {}) => { return renderWithProviders( { nextStep = 'module_setup_step', calibrationStatus = { complete: true }, expandStep = mockExpandStep, - }: Partial> = {}) => { + }: Partial> = {}) => { return renderWithProviders( { @@ -16,7 +16,7 @@ describe('SetupStep', () => { toggleExpanded = toggleExpandedMock, children = , rightElement =
        right element
        , - }: Partial> = {}) => { + }: Partial> = {}) => { return renderWithProviders( { hasCalibrated = false, tipRackDefinition = fixtureTiprack300ul as LabwareDefinition2, isExtendedPipOffset = false, - }: Partial< - React.ComponentProps - > = {}) => { + }: Partial> = {}) => { return renderWithProviders( ) => { +const render = (props: ComponentProps) => { return renderWithProviders( diff --git a/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/DeviceReset.tsx b/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/DeviceReset.tsx index 2249e453fe6..b9cd537894a 100644 --- a/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/DeviceReset.tsx +++ b/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/DeviceReset.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useTranslation } from 'react-i18next' import { @@ -14,6 +13,8 @@ import { import { TertiaryButton } from '/app/atoms/buttons' +import type { MouseEventHandler } from 'react' + interface DeviceResetProps { updateIsExpanded: ( isExpanded: boolean, @@ -28,7 +29,7 @@ export function DeviceReset({ }: DeviceResetProps): JSX.Element { const { t } = useTranslation('device_settings') - const handleClick: React.MouseEventHandler = () => { + const handleClick: MouseEventHandler = () => { if (!isRobotBusy) { updateIsExpanded(true, 'deviceReset') } diff --git a/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/DisplayRobotName.tsx b/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/DisplayRobotName.tsx index c6a380cd6e5..7f1d51022b4 100644 --- a/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/DisplayRobotName.tsx +++ b/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/DisplayRobotName.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useTranslation } from 'react-i18next' import { @@ -14,6 +13,8 @@ import { } from '@opentrons/components' import { TertiaryButton } from '/app/atoms/buttons' + +import type { MouseEventHandler } from 'react' interface DisplayRobotNameProps { robotName: string updateIsExpanded: ( @@ -30,7 +31,7 @@ export function DisplayRobotName({ }: DisplayRobotNameProps): JSX.Element { const { t } = useTranslation('device_settings') - const handleClick: React.MouseEventHandler = () => { + const handleClick: MouseEventHandler = () => { if (!isRobotBusy) { updateIsExpanded(true, 'renameRobot') } diff --git a/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/FactoryMode.tsx b/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/FactoryMode.tsx index 14cb3766040..8fea7e0f82d 100644 --- a/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/FactoryMode.tsx +++ b/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/FactoryMode.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useTranslation } from 'react-i18next' import { @@ -14,9 +13,11 @@ import { import { TertiaryButton } from '/app/atoms/buttons' +import type { Dispatch, SetStateAction } from 'react' + interface FactoryModeProps { isRobotBusy: boolean - setShowFactoryModeSlideout: React.Dispatch> + setShowFactoryModeSlideout: Dispatch> sn: string | null } diff --git a/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/GantryHoming.tsx b/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/GantryHoming.tsx index 96ea82a59cf..6537d1fdf1a 100644 --- a/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/GantryHoming.tsx +++ b/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/GantryHoming.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useDispatch } from 'react-redux' import { useTranslation } from 'react-i18next' @@ -15,6 +14,7 @@ import { import { ToggleButton } from '/app/atoms/buttons' import { updateSetting } from '/app/redux/robot-settings' +import type { MouseEventHandler } from 'react' import type { Dispatch } from '/app/redux/types' import type { RobotSettingsField } from '/app/redux/robot-settings/types' @@ -34,7 +34,7 @@ export function GantryHoming({ const value = settings?.value ? settings.value : false const id = settings?.id ? settings.id : 'disableHomeOnBoot' - const handleClick: React.MouseEventHandler = () => { + const handleClick: MouseEventHandler = () => { if (!isRobotBusy) { dispatch(updateSetting(robotName, id, !value)) } diff --git a/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/LegacySettings.tsx b/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/LegacySettings.tsx index 5ea0ae6e5ec..7947243d13f 100644 --- a/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/LegacySettings.tsx +++ b/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/LegacySettings.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useDispatch } from 'react-redux' import { useTranslation } from 'react-i18next' @@ -15,6 +14,7 @@ import { import { ToggleButton } from '/app/atoms/buttons' import { updateSetting } from '/app/redux/robot-settings' +import type { MouseEventHandler } from 'react' import type { Dispatch } from '/app/redux/types' import type { RobotSettingsField } from '/app/redux/robot-settings/types' @@ -34,7 +34,7 @@ export function LegacySettings({ const value = settings?.value ? settings.value : false const id = settings?.id ? settings.id : 'deckCalibrationDots' - const handleClick: React.MouseEventHandler = () => { + const handleClick: MouseEventHandler = () => { if (!isRobotBusy) { dispatch(updateSetting(robotName, id, !value)) } diff --git a/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/ShortTrashBin.tsx b/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/ShortTrashBin.tsx index 5bc00476406..6152163c223 100644 --- a/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/ShortTrashBin.tsx +++ b/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/ShortTrashBin.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useDispatch } from 'react-redux' import { useTranslation } from 'react-i18next' @@ -15,6 +14,7 @@ import { import { ToggleButton } from '/app/atoms/buttons' import { updateSetting } from '/app/redux/robot-settings' +import type { MouseEventHandler } from 'react' import type { Dispatch } from '/app/redux/types' import type { RobotSettingsField } from '/app/redux/robot-settings/types' @@ -34,7 +34,7 @@ export function ShortTrashBin({ const value = settings?.value ? settings.value : false const id = settings?.id ? settings.id : 'shortTrashBin' - const handleClick: React.MouseEventHandler = () => { + const handleClick: MouseEventHandler = () => { if (!isRobotBusy) { dispatch(updateSetting(robotName, id, !value)) } diff --git a/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/UsageSettings.tsx b/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/UsageSettings.tsx index e8843af6019..c44f573f7a2 100644 --- a/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/UsageSettings.tsx +++ b/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/UsageSettings.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useDispatch } from 'react-redux' import { useTranslation } from 'react-i18next' @@ -15,6 +14,7 @@ import { import { ToggleButton } from '/app/atoms/buttons' import { updateSetting } from '/app/redux/robot-settings' +import type { MouseEventHandler } from 'react' import type { Dispatch } from '/app/redux/types' import type { RobotSettingsField } from '/app/redux/robot-settings/types' @@ -34,7 +34,7 @@ export function UsageSettings({ const value = settings?.value ? settings.value : false const id = settings?.id ? settings.id : 'enableDoorSafetySwitch' - const handleClick: React.MouseEventHandler = () => { + const handleClick: MouseEventHandler = () => { if (!isRobotBusy) { dispatch(updateSetting(robotName, id, !value)) } diff --git a/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/UseOlderAspirateBehavior.tsx b/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/UseOlderAspirateBehavior.tsx index c3496621f18..c12941a12a0 100644 --- a/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/UseOlderAspirateBehavior.tsx +++ b/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/UseOlderAspirateBehavior.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useDispatch } from 'react-redux' import { useTranslation } from 'react-i18next' @@ -15,6 +14,7 @@ import { import { ToggleButton } from '/app/atoms/buttons' import { updateSetting } from '/app/redux/robot-settings' +import type { MouseEventHandler } from 'react' import type { Dispatch } from '/app/redux/types' import type { RobotSettingsField } from '/app/redux/robot-settings/types' @@ -34,7 +34,7 @@ export function UseOlderAspirateBehavior({ const value = settings?.value ? settings.value : false const id = settings?.id ? settings.id : 'useOldAspirationFunctions' - const handleClick: React.MouseEventHandler = () => { + const handleClick: MouseEventHandler = () => { if (!isRobotBusy) { dispatch(updateSetting(robotName, id, !value)) } diff --git a/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/__tests__/EnableErrorRecoveryMode.test.tsx b/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/__tests__/EnableErrorRecoveryMode.test.tsx index 9406e38f768..b3ff80c9341 100644 --- a/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/__tests__/EnableErrorRecoveryMode.test.tsx +++ b/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/__tests__/EnableErrorRecoveryMode.test.tsx @@ -5,21 +5,19 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { useErrorRecoverySettingsToggle } from '/app/resources/errorRecovery' import { EnableErrorRecoveryMode } from '../EnableErrorRecoveryMode' -import type * as React from 'react' +import type { ComponentProps } from 'react' vi.mock('/app/resources/errorRecovery') const mockToggleERSettings = vi.fn() -const render = ( - props: React.ComponentProps -) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('EnableErrorRecoveryMode', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { isRobotBusy: false } diff --git a/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/__tests__/EnableStatusLight.test.tsx b/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/__tests__/EnableStatusLight.test.tsx index 2e2cc956bde..c36d79a04db 100644 --- a/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/__tests__/EnableStatusLight.test.tsx +++ b/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/__tests__/EnableStatusLight.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, vi, expect, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' @@ -8,18 +7,20 @@ import { i18n } from '/app/i18n' import { useLEDLights } from '/app/resources/robot-settings' import { EnableStatusLight } from '../EnableStatusLight' +import type { ComponentProps } from 'react' + vi.mock('/app/resources/robot-settings') const ROBOT_NAME = 'otie' const mockToggleLights = vi.fn() -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('EnableStatusLight', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/__tests__/OpenJupyterControl.test.tsx b/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/__tests__/OpenJupyterControl.test.tsx index 57a01e25680..b6c5b2d9be4 100644 --- a/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/__tests__/OpenJupyterControl.test.tsx +++ b/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/__tests__/OpenJupyterControl.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { MemoryRouter } from 'react-router-dom' import { fireEvent, screen } from '@testing-library/react' import { describe, it, vi, beforeEach, expect } from 'vitest' @@ -8,6 +7,8 @@ import { i18n } from '/app/i18n' import { useTrackEvent, ANALYTICS_JUPYTER_OPEN } from '/app/redux/analytics' import { OpenJupyterControl } from '../OpenJupyterControl' +import type { ComponentProps } from 'react' + vi.mock('/app/redux/analytics') const mockIpAddress = '1.1.1.1' @@ -18,7 +19,7 @@ global.window = Object.create(window) Object.defineProperty(window, 'open', { writable: true, configurable: true }) window.open = vi.fn() -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders( @@ -28,7 +29,7 @@ const render = (props: React.ComponentProps) => { } describe('RobotSettings OpenJupyterControl', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { robotIp: mockIpAddress, diff --git a/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/__tests__/Troubleshooting.test.tsx b/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/__tests__/Troubleshooting.test.tsx index a5f28ee7da2..ef9cc7ff185 100644 --- a/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/__tests__/Troubleshooting.test.tsx +++ b/app/src/organisms/Desktop/Devices/RobotSettings/AdvancedTab/__tests__/Troubleshooting.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { MemoryRouter } from 'react-router-dom' import { act, waitFor, screen } from '@testing-library/react' import { when } from 'vitest-when' @@ -16,6 +15,7 @@ import { import { useRobot } from '/app/redux-resources/robots' import { Troubleshooting } from '../Troubleshooting' +import type { ComponentProps } from 'react' import type { HostConfig } from '@opentrons/api-client' import type { ToasterContextType } from '/app/organisms/ToasterOven/ToasterContext' @@ -29,7 +29,7 @@ const HOST_CONFIG: HostConfig = { hostname: 'localhost' } const MOCK_MAKE_TOAST = vi.fn() const MOCK_EAT_TOAST = vi.fn() -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders( @@ -39,7 +39,7 @@ const render = (props: React.ComponentProps) => { } describe('RobotSettings Troubleshooting', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { robotName: ROBOT_NAME, diff --git a/app/src/organisms/Desktop/Devices/RobotSettings/ConnectNetwork/ConnectModal/FormRow.tsx b/app/src/organisms/Desktop/Devices/RobotSettings/ConnectNetwork/ConnectModal/FormRow.tsx index 1481d3f40f9..fddda5bc96a 100644 --- a/app/src/organisms/Desktop/Devices/RobotSettings/ConnectNetwork/ConnectModal/FormRow.tsx +++ b/app/src/organisms/Desktop/Devices/RobotSettings/ConnectNetwork/ConnectModal/FormRow.tsx @@ -1,12 +1,13 @@ // presentational components for the wifi connect form -import type * as React from 'react' import styled from 'styled-components' import { FONT_WEIGHT_SEMIBOLD, SPACING } from '@opentrons/components' +import type { ReactNode } from 'react' + export interface FormRowProps { label: string labelFor: string - children: React.ReactNode + children: ReactNode } const StyledRow = styled.div` diff --git a/app/src/organisms/Desktop/Devices/RobotSettings/ConnectNetwork/SelectSsid/index.tsx b/app/src/organisms/Desktop/Devices/RobotSettings/ConnectNetwork/SelectSsid/index.tsx index a8b04feba4b..02de4cfabaa 100644 --- a/app/src/organisms/Desktop/Devices/RobotSettings/ConnectNetwork/SelectSsid/index.tsx +++ b/app/src/organisms/Desktop/Devices/RobotSettings/ConnectNetwork/SelectSsid/index.tsx @@ -1,12 +1,11 @@ -import type * as React from 'react' import { useTranslation } from 'react-i18next' import { CONTEXT_MENU } from '@opentrons/components' import { SelectField } from '/app/atoms/SelectField' import { NetworkOptionLabel, NetworkActionLabel } from './NetworkOptionLabel' +import type { ComponentProps } from 'react' import type { TFunction } from 'i18next' import type { SelectOptionOrGroup } from '@opentrons/components' - import type { WifiNetwork } from '../types' export interface SelectSsidProps { @@ -51,7 +50,7 @@ export function SelectSsid(props: SelectSsidProps): JSX.Element { } } - const formatOptionLabel: React.ComponentProps< + const formatOptionLabel: ComponentProps< typeof SelectField >['formatOptionLabel'] = (option, { context }): JSX.Element | null => { const { value, label } = option diff --git a/app/src/organisms/Desktop/Devices/RobotSettings/ConnectNetwork/types.ts b/app/src/organisms/Desktop/Devices/RobotSettings/ConnectNetwork/types.ts index 050d26c08c3..ccfa37a7a44 100644 --- a/app/src/organisms/Desktop/Devices/RobotSettings/ConnectNetwork/types.ts +++ b/app/src/organisms/Desktop/Devices/RobotSettings/ConnectNetwork/types.ts @@ -1,3 +1,4 @@ +import type { ChangeEventHandler, FocusEventHandler } from 'react' import type { FieldError } from 'react-hook-form' import type { WifiNetwork, @@ -80,8 +81,8 @@ export type ConnectFormField = export type ConnectFormFieldProps = Readonly<{ value: string | null error: string | null - onChange: React.ChangeEventHandler - onBlur: React.FocusEventHandler + onChange: ChangeEventHandler + onBlur: FocusEventHandler setValue: (value: string) => unknown setTouched: (touched: boolean) => unknown }> diff --git a/app/src/organisms/Desktop/Devices/RobotSettings/SettingToggle.tsx b/app/src/organisms/Desktop/Devices/RobotSettings/SettingToggle.tsx index 4407779d888..bb5b3c0d824 100644 --- a/app/src/organisms/Desktop/Devices/RobotSettings/SettingToggle.tsx +++ b/app/src/organisms/Desktop/Devices/RobotSettings/SettingToggle.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useDispatch } from 'react-redux' import { @@ -13,6 +12,8 @@ import { import { ToggleButton } from '/app/atoms/buttons' import { updateSetting } from '/app/redux/robot-settings' + +import type { MouseEventHandler } from 'react' import type { Dispatch } from '/app/redux/types' import type { RobotSettingsField } from '/app/redux/robot-settings/types' @@ -38,7 +39,7 @@ export function SettingToggle({ if (id == null) return null - const handleClick: React.MouseEventHandler = () => { + const handleClick: MouseEventHandler = () => { dispatch(updateSetting(robotName, id, !value)) } diff --git a/app/src/organisms/Desktop/Devices/RobotSettings/UpdateBuildroot/__tests__/RobotUpdateProgressModal.test.tsx b/app/src/organisms/Desktop/Devices/RobotSettings/UpdateBuildroot/__tests__/RobotUpdateProgressModal.test.tsx index a2139f636bd..927c1acfdc8 100644 --- a/app/src/organisms/Desktop/Devices/RobotSettings/UpdateBuildroot/__tests__/RobotUpdateProgressModal.test.tsx +++ b/app/src/organisms/Desktop/Devices/RobotSettings/UpdateBuildroot/__tests__/RobotUpdateProgressModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { i18n } from '/app/i18n' import { act, fireEvent, screen } from '@testing-library/react' import { describe, it, vi, beforeEach, expect } from 'vitest' @@ -21,6 +20,7 @@ import { INIT_STATUS, } from '/app/resources/health/hooks' +import type { ComponentProps } from 'react' import type { SetStatusBarCreateCommand } from '@opentrons/shared-data' import type { RobotUpdateSession } from '/app/redux/robot-update/types' @@ -30,9 +30,7 @@ vi.mock('/app/redux/robot-update') vi.mock('/app/redux/robot-update/hooks') vi.mock('/app/resources/health/hooks') -const render = ( - props: React.ComponentProps -) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) @@ -50,8 +48,9 @@ describe('DownloadUpdateModal', () => { error: null, } - let props: React.ComponentProps + let props: ComponentProps const mockCreateLiveCommand = vi.fn() + const mockDispatchStartRobotUpdate = vi.fn() beforeEach(() => { mockCreateLiveCommand.mockResolvedValue(null) @@ -68,7 +67,9 @@ describe('DownloadUpdateModal', () => { progressPercent: 50, }) vi.mocked(getRobotSessionIsManualFile).mockReturnValue(false) - vi.mocked(useDispatchStartRobotUpdate).mockReturnValue(vi.fn) + vi.mocked(useDispatchStartRobotUpdate).mockReturnValue( + mockDispatchStartRobotUpdate + ) vi.mocked(getRobotUpdateDownloadError).mockReturnValue(null) }) diff --git a/app/src/organisms/Desktop/Devices/RobotSettings/UpdateBuildroot/__tests__/UpdateRobotModal.test.tsx b/app/src/organisms/Desktop/Devices/RobotSettings/UpdateBuildroot/__tests__/UpdateRobotModal.test.tsx index e77a0df9533..e4c6b7bfb12 100644 --- a/app/src/organisms/Desktop/Devices/RobotSettings/UpdateBuildroot/__tests__/UpdateRobotModal.test.tsx +++ b/app/src/organisms/Desktop/Devices/RobotSettings/UpdateBuildroot/__tests__/UpdateRobotModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { createStore } from 'redux' import { fireEvent, screen } from '@testing-library/react' import { describe, it, vi, beforeEach, expect } from 'vitest' @@ -14,6 +13,7 @@ import { getDiscoverableRobotByName } from '/app/redux/discovery' import { UpdateRobotModal, RELEASE_NOTES_URL_BASE } from '../UpdateRobotModal' import { useIsRobotBusy } from '/app/redux-resources/robots' +import type { ComponentProps } from 'react' import type { Store } from 'redux' import type { State } from '/app/redux/types' @@ -21,14 +21,14 @@ vi.mock('/app/redux/robot-update') vi.mock('/app/redux/discovery') vi.mock('/app/redux-resources/robots') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('UpdateRobotModal', () => { - let props: React.ComponentProps + let props: ComponentProps let store: Store beforeEach(() => { store = createStore(vi.fn(), {}) diff --git a/app/src/organisms/Desktop/Devices/RobotSettings/UpdateBuildroot/__tests__/useRobotUpdateInfo.test.tsx b/app/src/organisms/Desktop/Devices/RobotSettings/UpdateBuildroot/__tests__/useRobotUpdateInfo.test.tsx index 2897110aacc..e81d61f1d5c 100644 --- a/app/src/organisms/Desktop/Devices/RobotSettings/UpdateBuildroot/__tests__/useRobotUpdateInfo.test.tsx +++ b/app/src/organisms/Desktop/Devices/RobotSettings/UpdateBuildroot/__tests__/useRobotUpdateInfo.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { renderHook } from '@testing-library/react' import { createStore } from 'redux' import { I18nextProvider } from 'react-i18next' @@ -9,6 +8,7 @@ import { i18n } from '/app/i18n' import { useRobotUpdateInfo } from '../useRobotUpdateInfo' import { getRobotUpdateDownloadProgress } from '/app/redux/robot-update' +import type { FunctionComponent, ReactNode } from 'react' import type { Store } from 'redux' import type { State } from '/app/redux/types' import type { @@ -21,7 +21,7 @@ vi.mock('/app/redux/robot-update') describe('useRobotUpdateInfo', () => { let store: Store - let wrapper: React.FunctionComponent<{ children: React.ReactNode }> + let wrapper: FunctionComponent<{ children: ReactNode }> const MOCK_ROBOT_NAME = 'testRobot' const mockRobotUpdateSession: RobotUpdateSession | null = { diff --git a/app/src/organisms/Desktop/Devices/RobotStatusHeader.tsx b/app/src/organisms/Desktop/Devices/RobotStatusHeader.tsx index 77cad0933ea..abeeceddc0b 100644 --- a/app/src/organisms/Desktop/Devices/RobotStatusHeader.tsx +++ b/app/src/organisms/Desktop/Devices/RobotStatusHeader.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useTranslation } from 'react-i18next' import { useSelector, useDispatch } from 'react-redux' import { Link, useNavigate } from 'react-router-dom' @@ -35,6 +34,7 @@ import { import { getNetworkInterfaces, fetchStatus } from '/app/redux/networking' import { useNotifyRunQuery, useCurrentRunId } from '/app/resources/runs' +import type { MouseEvent } from 'react' import type { IconName, StyleProps } from '@opentrons/components' import type { DiscoveredRobot } from '/app/redux/discovery/types' import type { Dispatch, State } from '/app/redux/types' @@ -79,7 +79,7 @@ export function RobotStatusHeader(props: RobotStatusHeaderProps): JSX.Element { currentRunId != null && currentRunStatus != null && displayName != null ? ( { + onClick={(e: MouseEvent) => { e.stopPropagation() }} > diff --git a/app/src/organisms/Desktop/Devices/RunPreview/index.tsx b/app/src/organisms/Desktop/Devices/RunPreview/index.tsx index c2a48aba59a..c217833593e 100644 --- a/app/src/organisms/Desktop/Devices/RunPreview/index.tsx +++ b/app/src/organisms/Desktop/Devices/RunPreview/index.tsx @@ -33,9 +33,11 @@ import { Divider } from '/app/atoms/structure' import { NAV_BAR_WIDTH } from '/app/App/constants' import { getLabwareDefinitionsFromCommands } from '/app/local-resources/labware' +import type { ForwardedRef } from 'react' +import type { ViewportListRef } from 'react-viewport-list' import type { RunStatus } from '@opentrons/api-client' import type { RobotType } from '@opentrons/shared-data' -import type { ViewportListRef } from 'react-viewport-list' + const COLOR_FADE_MS = 500 const LIVE_RUN_COMMANDS_POLL_MS = 3000 // arbitrary large number of commands @@ -49,7 +51,7 @@ interface RunPreviewProps { } export const RunPreviewComponent = ( { runId, jumpedIndex, makeHandleScrollToStep, robotType }: RunPreviewProps, - ref: React.ForwardedRef + ref: ForwardedRef ): JSX.Element | null => { const { t } = useTranslation(['run_details', 'protocol_setup']) const robotSideAnalysis = useMostRecentCompletedAnalysis(runId) diff --git a/app/src/organisms/Desktop/Devices/__tests__/CalibrationStatusBanner.test.tsx b/app/src/organisms/Desktop/Devices/__tests__/CalibrationStatusBanner.test.tsx index fd50c5185ae..316315515b5 100644 --- a/app/src/organisms/Desktop/Devices/__tests__/CalibrationStatusBanner.test.tsx +++ b/app/src/organisms/Desktop/Devices/__tests__/CalibrationStatusBanner.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { screen } from '@testing-library/react' import { describe, it, expect, vi, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' @@ -8,11 +7,11 @@ import { i18n } from '/app/i18n' import { CalibrationStatusBanner } from '../CalibrationStatusBanner' import { useCalibrationTaskList } from '../hooks' +import type { ComponentProps } from 'react' + vi.mock('../hooks') -const render = ( - props: React.ComponentProps -) => { +const render = (props: ComponentProps) => { return renderWithProviders( @@ -24,7 +23,7 @@ const render = ( } describe('CalibrationStatusBanner', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { robotName: 'otie' } }) diff --git a/app/src/organisms/Desktop/Devices/__tests__/ConnectionTroubleshootingModal.test.tsx b/app/src/organisms/Desktop/Devices/__tests__/ConnectionTroubleshootingModal.test.tsx index d725929a081..a810d459f12 100644 --- a/app/src/organisms/Desktop/Devices/__tests__/ConnectionTroubleshootingModal.test.tsx +++ b/app/src/organisms/Desktop/Devices/__tests__/ConnectionTroubleshootingModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, expect, vi, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' import { renderWithProviders } from '/app/__testing-utils__' @@ -6,8 +5,10 @@ import { fireEvent, screen } from '@testing-library/react' import { i18n } from '/app/i18n' import { ConnectionTroubleshootingModal } from '../ConnectionTroubleshootingModal' +import type { ComponentProps } from 'react' + const render = ( - props: React.ComponentProps + props: ComponentProps ) => { return renderWithProviders(, { i18nInstance: i18n, @@ -15,7 +16,7 @@ const render = ( } describe('ConnectionTroubleshootingModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { onClose: vi.fn(), diff --git a/app/src/organisms/Desktop/Devices/__tests__/EstopBanner.test.tsx b/app/src/organisms/Desktop/Devices/__tests__/EstopBanner.test.tsx index 7d052568378..4e9f74b6310 100644 --- a/app/src/organisms/Desktop/Devices/__tests__/EstopBanner.test.tsx +++ b/app/src/organisms/Desktop/Devices/__tests__/EstopBanner.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { screen } from '@testing-library/react' import { describe, it, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' @@ -6,11 +5,13 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { EstopBanner } from '../EstopBanner' -const render = (props: React.ComponentProps) => +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => renderWithProviders(, { i18nInstance: i18n }) describe('EstopBanner', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { status: 'physicallyEngaged', diff --git a/app/src/organisms/Desktop/Devices/__tests__/HistoricalProtocolRun.test.tsx b/app/src/organisms/Desktop/Devices/__tests__/HistoricalProtocolRun.test.tsx index 070f1c614de..1b9ec0cde4e 100644 --- a/app/src/organisms/Desktop/Devices/__tests__/HistoricalProtocolRun.test.tsx +++ b/app/src/organisms/Desktop/Devices/__tests__/HistoricalProtocolRun.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { screen } from '@testing-library/react' import { describe, it, vi, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' @@ -10,6 +9,7 @@ import { useRunStatus, useRunTimestamps } from '/app/resources/runs' import { HistoricalProtocolRun } from '../HistoricalProtocolRun' import { HistoricalProtocolRunOverflowMenu } from '../HistoricalProtocolRunOverflowMenu' +import type { ComponentProps } from 'react' import type { RunStatus, RunData } from '@opentrons/api-client' import type { RunTimeParameter } from '@opentrons/shared-data' @@ -25,14 +25,14 @@ const run = { runTimeParameters: [] as RunTimeParameter[], } as RunData -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('RecentProtocolRuns', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/Desktop/Devices/__tests__/HistoricalProtocolRunOverflowMenu.test.tsx b/app/src/organisms/Desktop/Devices/__tests__/HistoricalProtocolRunOverflowMenu.test.tsx index 2b2706c9645..72148f614bf 100644 --- a/app/src/organisms/Desktop/Devices/__tests__/HistoricalProtocolRunOverflowMenu.test.tsx +++ b/app/src/organisms/Desktop/Devices/__tests__/HistoricalProtocolRunOverflowMenu.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, vi, beforeEach, expect } from 'vitest' import { when } from 'vitest-when' @@ -23,6 +22,7 @@ import { useIsEstopNotDisengaged } from '/app/resources/devices' import { HistoricalProtocolRunOverflowMenu } from '../HistoricalProtocolRunOverflowMenu' import { useNotifyAllCommandsQuery } from '/app/resources/runs' +import type { ComponentProps } from 'react' import type { UseQueryResult } from 'react-query' import type { CommandsData } from '@opentrons/api-client' @@ -40,7 +40,7 @@ vi.mock('/app/redux-resources/analytics') vi.mock('@opentrons/react-api-client') const render = ( - props: React.ComponentProps + props: ComponentProps ) => { return renderWithProviders( @@ -59,7 +59,7 @@ let mockTrackProtocolRunEvent: any const mockDownloadRunLog = vi.fn() describe('HistoricalProtocolRunOverflowMenu', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { mockTrackEvent = vi.fn() vi.mocked(useTrackEvent).mockReturnValue(mockTrackEvent) diff --git a/app/src/organisms/Desktop/Devices/__tests__/RobotCard.test.tsx b/app/src/organisms/Desktop/Devices/__tests__/RobotCard.test.tsx index 89d59c47cf8..f2814630b2b 100644 --- a/app/src/organisms/Desktop/Devices/__tests__/RobotCard.test.tsx +++ b/app/src/organisms/Desktop/Devices/__tests__/RobotCard.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { MemoryRouter } from 'react-router-dom' import { when } from 'vitest-when' import { screen } from '@testing-library/react' @@ -37,6 +36,7 @@ import { useErrorRecoveryBanner, } from '../ErrorRecoveryBanner' +import type { ComponentProps } from 'react' import type { State } from '/app/redux/types' vi.mock('/app/redux/robot-update/selectors') @@ -94,7 +94,7 @@ const MOCK_STATE: State = { }, } as any -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders( @@ -107,7 +107,7 @@ const render = (props: React.ComponentProps) => { } describe('RobotCard', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { robot: mockConnectableRobot } diff --git a/app/src/organisms/Desktop/Devices/__tests__/RobotOverflowMenu.test.tsx b/app/src/organisms/Desktop/Devices/__tests__/RobotOverflowMenu.test.tsx index b3735e72a77..7f8ce943211 100644 --- a/app/src/organisms/Desktop/Devices/__tests__/RobotOverflowMenu.test.tsx +++ b/app/src/organisms/Desktop/Devices/__tests__/RobotOverflowMenu.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { MemoryRouter } from 'react-router-dom' import { fireEvent, screen } from '@testing-library/react' import { describe, it, vi, beforeEach, expect } from 'vitest' @@ -16,6 +15,8 @@ import { mockConnectedRobot, } from '/app/redux/discovery/__fixtures__' +import type { ComponentProps } from 'react' + vi.mock('/app/redux/robot-update/hooks') vi.mock('/app/resources/runs') vi.mock('/app/organisms/Desktop/ChooseProtocolSlideout') @@ -23,7 +24,7 @@ vi.mock('../hooks') vi.mock('/app/redux-resources/robots') vi.mock('/app/resources/devices/hooks/useIsEstopNotDisengaged') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders( @@ -35,7 +36,7 @@ const render = (props: React.ComponentProps) => { } describe('RobotOverflowMenu', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/Desktop/Devices/__tests__/RobotOverview.test.tsx b/app/src/organisms/Desktop/Devices/__tests__/RobotOverview.test.tsx index 5d2513bec23..6f262e0a094 100644 --- a/app/src/organisms/Desktop/Devices/__tests__/RobotOverview.test.tsx +++ b/app/src/organisms/Desktop/Devices/__tests__/RobotOverview.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { MemoryRouter } from 'react-router-dom' import { when } from 'vitest-when' import { screen, fireEvent } from '@testing-library/react' @@ -48,10 +47,11 @@ import { useErrorRecoveryBanner, } from '../ErrorRecoveryBanner' +import type { ComponentProps } from 'react' +import type * as ReactApiClient from '@opentrons/react-api-client' import type { Config } from '/app/redux/config/types' import type { DiscoveryClientRobotAddress } from '/app/redux/discovery/types' import type { State } from '/app/redux/types' -import type * as ReactApiClient from '@opentrons/react-api-client' vi.mock('@opentrons/react-api-client', async importOriginal => { const actual = await importOriginal() @@ -104,7 +104,7 @@ const MOCK_STATE: State = { const mockToggleLights = vi.fn() -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders( @@ -117,7 +117,7 @@ const render = (props: React.ComponentProps) => { } describe('RobotOverview', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { robotName: mockConnectableRobot.name } diff --git a/app/src/organisms/Desktop/Devices/__tests__/RobotOverviewOverflowMenu.test.tsx b/app/src/organisms/Desktop/Devices/__tests__/RobotOverviewOverflowMenu.test.tsx index c4d384d0805..21d8e13b666 100644 --- a/app/src/organisms/Desktop/Devices/__tests__/RobotOverviewOverflowMenu.test.tsx +++ b/app/src/organisms/Desktop/Devices/__tests__/RobotOverviewOverflowMenu.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { MemoryRouter } from 'react-router-dom' import { fireEvent, screen } from '@testing-library/react' import { when } from 'vitest-when' @@ -24,6 +23,8 @@ import { handleUpdateBuildroot } from '../RobotSettings/UpdateBuildroot' import { useIsEstopNotDisengaged } from '/app/resources/devices/hooks/useIsEstopNotDisengaged' import { RobotOverviewOverflowMenu } from '../RobotOverviewOverflowMenu' +import type { ComponentProps } from 'react' + vi.mock('/app/redux/robot-controls') vi.mock('/app/redux/robot-admin') vi.mock('../hooks') @@ -36,9 +37,7 @@ vi.mock('../RobotSettings/UpdateBuildroot') vi.mock('/app/resources/devices/hooks/useIsEstopNotDisengaged') vi.mock('/app/redux-resources/robots') -const render = ( - props: React.ComponentProps -) => { +const render = (props: ComponentProps) => { return renderWithProviders( @@ -50,7 +49,7 @@ const render = ( } describe('RobotOverviewOverflowMenu', () => { - let props: React.ComponentProps + let props: ComponentProps vi.useFakeTimers() beforeEach(() => { diff --git a/app/src/organisms/Desktop/Devices/__tests__/RobotStatusHeader.test.tsx b/app/src/organisms/Desktop/Devices/__tests__/RobotStatusHeader.test.tsx index 465c46cc566..af05d9ce131 100644 --- a/app/src/organisms/Desktop/Devices/__tests__/RobotStatusHeader.test.tsx +++ b/app/src/organisms/Desktop/Devices/__tests__/RobotStatusHeader.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { MemoryRouter } from 'react-router-dom' import { RUN_STATUS_RUNNING } from '@opentrons/api-client' import { when } from 'vitest-when' @@ -20,6 +19,7 @@ import { useIsFlex } from '/app/redux-resources/robots' import { RobotStatusHeader } from '../RobotStatusHeader' import { useNotifyRunQuery, useCurrentRunId } from '/app/resources/runs' +import type { ComponentProps } from 'react' import type { DiscoveryClientRobotAddress } from '/app/redux/discovery/types' import type { SimpleInterfaceStatus } from '/app/redux/networking/types' import type { State } from '/app/redux/types' @@ -45,7 +45,7 @@ const MOCK_BUZZ = { const WIFI_IP = 'wifi-ip' const ETHERNET_IP = 'ethernet-ip' -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders( @@ -56,7 +56,7 @@ const render = (props: React.ComponentProps) => { ) } describe('RobotStatusHeader', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = MOCK_OTIE diff --git a/app/src/organisms/Desktop/Devices/hooks/__tests__/useCalibrationTaskList.test.tsx b/app/src/organisms/Desktop/Devices/hooks/__tests__/useCalibrationTaskList.test.tsx index 9d675c77f7e..1ca9c1741c2 100644 --- a/app/src/organisms/Desktop/Devices/hooks/__tests__/useCalibrationTaskList.test.tsx +++ b/app/src/organisms/Desktop/Devices/hooks/__tests__/useCalibrationTaskList.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { createStore } from 'redux' import { I18nextProvider } from 'react-i18next' import { Provider } from 'react-redux' @@ -30,6 +29,7 @@ import { } from '../__fixtures__/taskListFixtures' import { i18n } from '/app/i18n' +import type { FunctionComponent, ReactNode } from 'react' import type { Store } from 'redux' import type { State } from '/app/redux/types' @@ -41,7 +41,7 @@ const mockTipLengthCalLauncher = vi.fn() const mockDeckCalLauncher = vi.fn() describe('useCalibrationTaskList hook', () => { - let wrapper: React.FunctionComponent<{ children: React.ReactNode }> + let wrapper: FunctionComponent<{ children: ReactNode }> let store: Store const mockDeleteCalibration = vi.fn() diff --git a/app/src/organisms/Desktop/Devices/hooks/__tests__/useDeckCalibrationData.test.tsx b/app/src/organisms/Desktop/Devices/hooks/__tests__/useDeckCalibrationData.test.tsx index c08f0e3e1e5..1aef843c8ef 100644 --- a/app/src/organisms/Desktop/Devices/hooks/__tests__/useDeckCalibrationData.test.tsx +++ b/app/src/organisms/Desktop/Devices/hooks/__tests__/useDeckCalibrationData.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { when } from 'vitest-when' import { vi, it, expect, describe, beforeEach, afterEach } from 'vitest' import { Provider } from 'react-redux' @@ -15,13 +14,13 @@ import { import { getDiscoverableRobotByName } from '/app/redux/discovery' import { mockDeckCalData } from '/app/redux/calibration/__fixtures__' import { useDispatchApiRequest } from '/app/redux/robot-api' +import { useDeckCalibrationData } from '..' +import { mockConnectableRobot } from '/app/redux/discovery/__fixtures__' +import type { FunctionComponent, ReactNode } from 'react' import type { Store } from 'redux' import type { DispatchApiRequestType } from '/app/redux/robot-api' -import { useDeckCalibrationData } from '..' -import { mockConnectableRobot } from '/app/redux/discovery/__fixtures__' - vi.mock('@opentrons/react-api-client') vi.mock('/app/redux/calibration') vi.mock('/app/redux/robot-api') @@ -31,7 +30,7 @@ const store: Store = createStore(vi.fn(), {}) describe('useDeckCalibrationData hook', () => { let dispatchApiRequest: DispatchApiRequestType - let wrapper: React.FunctionComponent<{ children: React.ReactNode }> + let wrapper: FunctionComponent<{ children: ReactNode }> beforeEach(() => { dispatchApiRequest = vi.fn() const queryClient = new QueryClient() diff --git a/app/src/organisms/Desktop/Devices/hooks/__tests__/usePipetteOffsetCalibration.test.tsx b/app/src/organisms/Desktop/Devices/hooks/__tests__/usePipetteOffsetCalibration.test.tsx index 2c23dcb0f61..50db68fe850 100644 --- a/app/src/organisms/Desktop/Devices/hooks/__tests__/usePipetteOffsetCalibration.test.tsx +++ b/app/src/organisms/Desktop/Devices/hooks/__tests__/usePipetteOffsetCalibration.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, it, expect, describe, beforeEach, afterEach } from 'vitest' import { when } from 'vitest-when' import { Provider } from 'react-redux' @@ -15,6 +14,7 @@ import { useDispatchApiRequest } from '/app/redux/robot-api' import { useRobot } from '/app/redux-resources/robots' import { usePipetteOffsetCalibration } from '..' +import type { FunctionComponent, ReactNode } from 'react' import type { Store } from 'redux' import type { DiscoveredRobot } from '/app/redux/discovery/types' import type { DispatchApiRequestType } from '/app/redux/robot-api' @@ -32,7 +32,7 @@ const MOUNT = 'left' as Mount describe('usePipetteOffsetCalibration hook', () => { let dispatchApiRequest: DispatchApiRequestType - let wrapper: React.FunctionComponent<{ children: React.ReactNode }> + let wrapper: FunctionComponent<{ children: ReactNode }> beforeEach(() => { dispatchApiRequest = vi.fn() const queryClient = new QueryClient() diff --git a/app/src/organisms/Desktop/Devices/hooks/__tests__/usePipetteOffsetCalibrations.test.tsx b/app/src/organisms/Desktop/Devices/hooks/__tests__/usePipetteOffsetCalibrations.test.tsx index 9305b34af38..de390322d11 100644 --- a/app/src/organisms/Desktop/Devices/hooks/__tests__/usePipetteOffsetCalibrations.test.tsx +++ b/app/src/organisms/Desktop/Devices/hooks/__tests__/usePipetteOffsetCalibrations.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, it, expect, describe, beforeEach, afterEach } from 'vitest' import { when } from 'vitest-when' import { renderHook } from '@testing-library/react' @@ -11,12 +10,14 @@ import { } from '/app/redux/calibration/pipette-offset/__fixtures__' import { usePipetteOffsetCalibrations } from '..' +import type { FunctionComponent, ReactNode } from 'react' + vi.mock('@opentrons/react-api-client') const CALIBRATION_DATA_POLL_MS = 5000 describe('usePipetteOffsetCalibrations hook', () => { - let wrapper: React.FunctionComponent<{ children: React.ReactNode }> + let wrapper: FunctionComponent<{ children: ReactNode }> beforeEach(() => { const queryClient = new QueryClient() wrapper = ({ children }) => ( diff --git a/app/src/organisms/Desktop/Devices/hooks/__tests__/useSyncRobotClock.test.tsx b/app/src/organisms/Desktop/Devices/hooks/__tests__/useSyncRobotClock.test.tsx index 02b593fbaab..1ab5c1f55cb 100644 --- a/app/src/organisms/Desktop/Devices/hooks/__tests__/useSyncRobotClock.test.tsx +++ b/app/src/organisms/Desktop/Devices/hooks/__tests__/useSyncRobotClock.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, it, expect, describe, beforeEach, afterEach } from 'vitest' import { Provider } from 'react-redux' import { createStore } from 'redux' @@ -7,6 +6,8 @@ import { QueryClient, QueryClientProvider } from 'react-query' import { syncSystemTime } from '/app/redux/robot-admin' import { useSyncRobotClock } from '..' + +import type { FunctionComponent, ReactNode } from 'react' import type { Store } from 'redux' vi.mock('/app/redux/discovery') @@ -14,7 +15,7 @@ vi.mock('/app/redux/discovery') const store: Store = createStore(vi.fn(), {}) describe('useSyncRobotClock hook', () => { - let wrapper: React.FunctionComponent<{ children: React.ReactNode }> + let wrapper: FunctionComponent<{ children: ReactNode }> beforeEach(() => { store.dispatch = vi.fn() const queryClient = new QueryClient() diff --git a/app/src/organisms/Desktop/Devices/hooks/__tests__/useTipLengthCalibrations.test.tsx b/app/src/organisms/Desktop/Devices/hooks/__tests__/useTipLengthCalibrations.test.tsx index 7281b009b5c..d2cec816973 100644 --- a/app/src/organisms/Desktop/Devices/hooks/__tests__/useTipLengthCalibrations.test.tsx +++ b/app/src/organisms/Desktop/Devices/hooks/__tests__/useTipLengthCalibrations.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, it, expect, describe, beforeEach, afterEach } from 'vitest' import { when } from 'vitest-when' import { QueryClient, QueryClientProvider } from 'react-query' @@ -11,12 +10,14 @@ import { } from '/app/redux/calibration/tip-length/__fixtures__' import { useTipLengthCalibrations } from '..' +import type { FunctionComponent, ReactNode } from 'react' + vi.mock('@opentrons/react-api-client') const CALIBRATIONS_FETCH_MS = 5000 describe('useTipLengthCalibrations hook', () => { - let wrapper: React.FunctionComponent<{ children: React.ReactNode }> + let wrapper: FunctionComponent<{ children: ReactNode }> beforeEach(() => { const queryClient = new QueryClient() wrapper = ({ children }) => ( diff --git a/app/src/organisms/Desktop/Devices/hooks/__tests__/useTrackCreateProtocolRunEvent.test.tsx b/app/src/organisms/Desktop/Devices/hooks/__tests__/useTrackCreateProtocolRunEvent.test.tsx index b8cf7fd9896..1f7eb5041fa 100644 --- a/app/src/organisms/Desktop/Devices/hooks/__tests__/useTrackCreateProtocolRunEvent.test.tsx +++ b/app/src/organisms/Desktop/Devices/hooks/__tests__/useTrackCreateProtocolRunEvent.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { createStore } from 'redux' import { Provider } from 'react-redux' import { QueryClient, QueryClientProvider } from 'react-query' @@ -12,6 +11,7 @@ import { parseProtocolAnalysisOutput } from '/app/transformations/analysis' import { useTrackEvent } from '/app/redux/analytics' import { storedProtocolData } from '/app/redux/protocol-storage/__fixtures__' +import type { FunctionComponent, ReactNode } from 'react' import type { Mock } from 'vitest' import type { Store } from 'redux' import type { ProtocolAnalyticsData } from '/app/redux/analytics/types' @@ -28,7 +28,7 @@ const PROTOCOL_PROPERTIES = { protocolType: 'python' } as ProtocolAnalyticsData let mockTrackEvent: Mock let mockGetProtocolRunAnalyticsData: Mock -let wrapper: React.FunctionComponent<{ children: React.ReactNode }> +let wrapper: FunctionComponent<{ children: ReactNode }> let store: Store = createStore(vi.fn(), {}) describe('useTrackCreateProtocolRunEvent hook', () => { diff --git a/app/src/organisms/Desktop/HowCalibrationWorksModal/__tests__/HowCalibrationWorksModal.test.tsx b/app/src/organisms/Desktop/HowCalibrationWorksModal/__tests__/HowCalibrationWorksModal.test.tsx index 8eee1543c5a..dfa8ae09955 100644 --- a/app/src/organisms/Desktop/HowCalibrationWorksModal/__tests__/HowCalibrationWorksModal.test.tsx +++ b/app/src/organisms/Desktop/HowCalibrationWorksModal/__tests__/HowCalibrationWorksModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import '@testing-library/jest-dom/vitest' import { describe, it, vi, beforeEach, expect } from 'vitest' @@ -6,16 +5,16 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { HowCalibrationWorksModal } from '..' -const render = ( - props: React.ComponentProps -) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('HowCalibrationWorksModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { onCloseClick: vi.fn() } }) diff --git a/app/src/organisms/Desktop/Labware/AddCustomLabwareSlideout/__tests__/AddCustomLabwareSlideout.test.tsx b/app/src/organisms/Desktop/Labware/AddCustomLabwareSlideout/__tests__/AddCustomLabwareSlideout.test.tsx index 1a4fef0be5c..9d67949e289 100644 --- a/app/src/organisms/Desktop/Labware/AddCustomLabwareSlideout/__tests__/AddCustomLabwareSlideout.test.tsx +++ b/app/src/organisms/Desktop/Labware/AddCustomLabwareSlideout/__tests__/AddCustomLabwareSlideout.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { MemoryRouter } from 'react-router-dom' import { describe, it, expect, vi, beforeEach } from 'vitest' import { fireEvent, screen } from '@testing-library/react' @@ -10,6 +9,8 @@ import { import { renderWithProviders } from '/app/__testing-utils__' import { AddCustomLabwareSlideout } from '..' +import type { ComponentProps } from 'react' + vi.mock('/app/redux/custom-labware') vi.mock('/app/local-resources/labware') vi.mock('/app/redux/analytics') @@ -21,9 +22,7 @@ vi.mock('/app/redux/shell/remote', () => ({ let mockTrackEvent: any -const render = ( - props: React.ComponentProps -) => { +const render = (props: ComponentProps) => { return renderWithProviders( @@ -35,7 +34,7 @@ const render = ( } describe('AddCustomLabwareSlideout', () => { - const props: React.ComponentProps = { + const props: ComponentProps = { isExpanded: true, onCloseClick: vi.fn(() => null), } diff --git a/app/src/organisms/Desktop/Labware/LabwareCard/__tests__/CustomLabwareOverflowMenu.test.tsx b/app/src/organisms/Desktop/Labware/LabwareCard/__tests__/CustomLabwareOverflowMenu.test.tsx index 588b47ecea3..5e47b3432f4 100644 --- a/app/src/organisms/Desktop/Labware/LabwareCard/__tests__/CustomLabwareOverflowMenu.test.tsx +++ b/app/src/organisms/Desktop/Labware/LabwareCard/__tests__/CustomLabwareOverflowMenu.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, vi, expect, beforeEach, afterEach } from 'vitest' @@ -9,6 +8,7 @@ import { i18n } from '/app/i18n' import { useTrackEvent } from '/app/redux/analytics' import { CustomLabwareOverflowMenu } from '../CustomLabwareOverflowMenu' +import type { ComponentProps } from 'react' import type { Mock } from 'vitest' import type * as OpentronsComponents from '@opentrons/components' @@ -31,7 +31,7 @@ vi.mock('@opentrons/components', async importOriginal => { }) const render = ( - props: React.ComponentProps + props: ComponentProps ): ReturnType => { return renderWithProviders(, { i18nInstance: i18n, @@ -39,7 +39,7 @@ const render = ( } describe('CustomLabwareOverflowMenu', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/Desktop/Labware/LabwareCard/__tests__/LabwareCard.test.tsx b/app/src/organisms/Desktop/Labware/LabwareCard/__tests__/LabwareCard.test.tsx index 76abb51c72f..2431472e274 100644 --- a/app/src/organisms/Desktop/Labware/LabwareCard/__tests__/LabwareCard.test.tsx +++ b/app/src/organisms/Desktop/Labware/LabwareCard/__tests__/LabwareCard.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { screen } from '@testing-library/react' import { describe, it, vi, beforeEach } from 'vitest' import { renderWithProviders, nestedTextMatcher } from '/app/__testing-utils__' @@ -8,6 +7,7 @@ import { mockDefinition } from '/app/redux/custom-labware/__fixtures__' import { CustomLabwareOverflowMenu } from '../CustomLabwareOverflowMenu' import { LabwareCard } from '..' +import type { ComponentProps } from 'react' import type * as OpentronsComponents from '@opentrons/components' vi.mock('/app/local-resources/labware') @@ -21,14 +21,14 @@ vi.mock('@opentrons/components', async importOriginal => { } }) -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('LabwareCard', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { vi.mocked(CustomLabwareOverflowMenu).mockReturnValue(
        Mock CustomLabwareOverflowMenu
        diff --git a/app/src/organisms/Desktop/Labware/LabwareDetails/StyledComponents/__tests__/ExpandingTitle.test.tsx b/app/src/organisms/Desktop/Labware/LabwareDetails/StyledComponents/__tests__/ExpandingTitle.test.tsx index 6ee44619bc8..b7a872e9a1b 100644 --- a/app/src/organisms/Desktop/Labware/LabwareDetails/StyledComponents/__tests__/ExpandingTitle.test.tsx +++ b/app/src/organisms/Desktop/Labware/LabwareDetails/StyledComponents/__tests__/ExpandingTitle.test.tsx @@ -1,11 +1,12 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, beforeEach } from 'vitest' import { getFootprintDiagram } from '@opentrons/components' import { renderWithProviders } from '/app/__testing-utils__' import { ExpandingTitle } from '../ExpandingTitle' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders() } @@ -13,7 +14,7 @@ const diagram = getFootprintDiagram({}) const DIAGRAM_TEST_ID = 'expanding_title_diagram' describe('ExpandingTitle', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { label: 'Title', diff --git a/app/src/organisms/Desktop/Labware/LabwareDetails/StyledComponents/__tests__/LabeledValue.test.tsx b/app/src/organisms/Desktop/Labware/LabwareDetails/StyledComponents/__tests__/LabeledValue.test.tsx index c3a73771f52..196d85cb707 100644 --- a/app/src/organisms/Desktop/Labware/LabwareDetails/StyledComponents/__tests__/LabeledValue.test.tsx +++ b/app/src/organisms/Desktop/Labware/LabwareDetails/StyledComponents/__tests__/LabeledValue.test.tsx @@ -1,15 +1,16 @@ -import type * as React from 'react' import { screen } from '@testing-library/react' import { describe, it, beforeEach } from 'vitest' import { renderWithProviders } from '/app/__testing-utils__' import { LabeledValue } from '../LabeledValue' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders() } describe('LabeledValue', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { label: 'height', diff --git a/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/Dimensions.test.tsx b/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/Dimensions.test.tsx index 32de832214c..2afc92ad6cf 100644 --- a/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/Dimensions.test.tsx +++ b/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/Dimensions.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { screen } from '@testing-library/react' import { describe, it, beforeEach } from 'vitest' import { renderWithProviders } from '/app/__testing-utils__' @@ -6,14 +5,16 @@ import { i18n } from '/app/i18n' import { mockDefinition } from '/app/redux/custom-labware/__fixtures__' import { Dimensions } from '../Dimensions' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('Dimensions', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { definition: mockDefinition, diff --git a/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/Gallery.test.tsx b/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/Gallery.test.tsx index 344981336b0..5a61aa4684c 100644 --- a/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/Gallery.test.tsx +++ b/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/Gallery.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, beforeEach } from 'vitest' import { renderWithProviders } from '/app/__testing-utils__' @@ -6,12 +5,14 @@ import { mockDefinition } from '/app/redux/custom-labware/__fixtures__' import { labwareImages } from '../labware-images' import { Gallery } from '../Gallery' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders() } describe('Gallery', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { labwareImages.mock_definition = ['image1'] props = { diff --git a/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/LabwareDetails.test.tsx b/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/LabwareDetails.test.tsx index 78c98c50a46..10602db9f9f 100644 --- a/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/LabwareDetails.test.tsx +++ b/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/LabwareDetails.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, beforeEach, afterEach, vi, expect } from 'vitest' @@ -17,6 +16,8 @@ import { WellSpacing } from '../WellSpacing' import { LabwareDetails } from '..' +import type { ComponentProps } from 'react' + vi.mock('/app/local-resources/labware') vi.mock('../../LabwareCard/CustomLabwareOverflowMenu') vi.mock('../Dimensions') @@ -28,7 +29,7 @@ vi.mock('../WellDimensions') vi.mock('../WellSpacing') const render = ( - props: React.ComponentProps + props: ComponentProps ): ReturnType => { return renderWithProviders(, { i18nInstance: i18n, @@ -36,7 +37,7 @@ const render = ( } describe('LabwareDetails', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { vi.mocked(CustomLabwareOverflowMenu).mockReturnValue(
        Mock CustomLabwareOverflowMenu
        diff --git a/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/ManufacturerDetails.test.tsx b/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/ManufacturerDetails.test.tsx index 21dc8c8f1a2..9d50aa61500 100644 --- a/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/ManufacturerDetails.test.tsx +++ b/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/ManufacturerDetails.test.tsx @@ -1,18 +1,19 @@ -import type * as React from 'react' import { screen } from '@testing-library/react' import { describe, it, expect, beforeEach } from 'vitest' import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { ManufacturerDetails } from '../ManufacturerDetails' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('ManufacturerDetails', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { brand: { brand: 'Opentrons' }, diff --git a/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/WellCount.test.tsx b/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/WellCount.test.tsx index f833c0c6e3f..6d94737a9c4 100644 --- a/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/WellCount.test.tsx +++ b/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/WellCount.test.tsx @@ -1,18 +1,19 @@ -import type * as React from 'react' import { screen } from '@testing-library/react' import { describe, it, beforeEach } from 'vitest' import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { WellCount } from '../WellCount' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('WellCount', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { count: 1, diff --git a/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/WellDimensions.test.tsx b/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/WellDimensions.test.tsx index 3269c3ec241..78af2ac24b2 100644 --- a/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/WellDimensions.test.tsx +++ b/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/WellDimensions.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { screen } from '@testing-library/react' import { describe, it, beforeEach, expect } from 'vitest' import { renderWithProviders } from '/app/__testing-utils__' @@ -10,14 +9,16 @@ import { } from '/app/redux/custom-labware/__fixtures__' import { WellDimensions } from '../WellDimensions' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('WellDimensions', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { labwareParams: mockDefinition.parameters, diff --git a/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/WellProperties.test.tsx b/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/WellProperties.test.tsx index 3d21e01f4df..40b17b3b31f 100644 --- a/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/WellProperties.test.tsx +++ b/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/WellProperties.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { screen } from '@testing-library/react' import { describe, it, expect, beforeEach } from 'vitest' import { renderWithProviders } from '/app/__testing-utils__' @@ -6,14 +5,16 @@ import { i18n } from '/app/i18n' import { mockCircularLabwareWellGroupProperties } from '/app/redux/custom-labware/__fixtures__' import { WellProperties } from '../WellProperties' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('WellProperties', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { wellProperties: mockCircularLabwareWellGroupProperties, diff --git a/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/WellSpacing.test.tsx b/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/WellSpacing.test.tsx index 5496bbe33f1..59115886e02 100644 --- a/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/WellSpacing.test.tsx +++ b/app/src/organisms/Desktop/Labware/LabwareDetails/__tests__/WellSpacing.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { screen } from '@testing-library/react' import { describe, it, beforeEach, expect } from 'vitest' import { renderWithProviders } from '/app/__testing-utils__' @@ -6,14 +5,16 @@ import { i18n } from '/app/i18n' import { mockCircularLabwareWellGroupProperties } from '/app/redux/custom-labware/__fixtures__' import { WellSpacing } from '../WellSpacing' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('WellSpacing', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { wellProperties: mockCircularLabwareWellGroupProperties, diff --git a/app/src/organisms/Desktop/ProtocolAnalysisFailure/ProtocolAnalysisStale.tsx b/app/src/organisms/Desktop/ProtocolAnalysisFailure/ProtocolAnalysisStale.tsx index 9b3a7c00d14..4daa1b24c80 100644 --- a/app/src/organisms/Desktop/ProtocolAnalysisFailure/ProtocolAnalysisStale.tsx +++ b/app/src/organisms/Desktop/ProtocolAnalysisFailure/ProtocolAnalysisStale.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useDispatch } from 'react-redux' import { useTranslation, Trans } from 'react-i18next' @@ -13,9 +12,11 @@ import { TYPOGRAPHY, WRAP_REVERSE, } from '@opentrons/components' +import { analyzeProtocol } from '/app/redux/protocol-storage' +import type { MouseEventHandler } from 'react' import type { Dispatch } from '/app/redux/types' -import { analyzeProtocol } from '/app/redux/protocol-storage' + interface ProtocolAnalysisStaleProps { protocolKey: string } @@ -27,7 +28,7 @@ export function ProtocolAnalysisStale( const { t } = useTranslation(['protocol_list', 'shared']) const dispatch = useDispatch() - const handleClickReanalyze: React.MouseEventHandler = e => { + const handleClickReanalyze: MouseEventHandler = e => { e.preventDefault() e.stopPropagation() dispatch(analyzeProtocol(protocolKey)) diff --git a/app/src/organisms/Desktop/ProtocolAnalysisFailure/__tests__/ProtocolAnalysisFailure.test.tsx b/app/src/organisms/Desktop/ProtocolAnalysisFailure/__tests__/ProtocolAnalysisFailure.test.tsx index fbdec0a45ec..becdabef509 100644 --- a/app/src/organisms/Desktop/ProtocolAnalysisFailure/__tests__/ProtocolAnalysisFailure.test.tsx +++ b/app/src/organisms/Desktop/ProtocolAnalysisFailure/__tests__/ProtocolAnalysisFailure.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { MemoryRouter } from 'react-router-dom' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect } from 'vitest' @@ -9,8 +8,10 @@ import { i18n } from '/app/i18n' import { ProtocolAnalysisFailure } from '..' import { analyzeProtocol } from '/app/redux/protocol-storage' +import type { ComponentProps } from 'react' + const render = ( - props: Partial> = {} + props: Partial> = {} ) => { return renderWithProviders( diff --git a/app/src/organisms/Desktop/ProtocolDetails/ProtocolParameters/__tests__/ProtocolParameters.test.tsx b/app/src/organisms/Desktop/ProtocolDetails/ProtocolParameters/__tests__/ProtocolParameters.test.tsx index e52803cc054..78f8184f7a1 100644 --- a/app/src/organisms/Desktop/ProtocolDetails/ProtocolParameters/__tests__/ProtocolParameters.test.tsx +++ b/app/src/organisms/Desktop/ProtocolDetails/ProtocolParameters/__tests__/ProtocolParameters.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, vi, beforeEach, afterEach } from 'vitest' import { screen } from '@testing-library/react' @@ -6,6 +5,7 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { ProtocolParameters } from '..' +import type { ComponentProps } from 'react' import type { RunTimeParameter } from '@opentrons/shared-data' import type * as Components from '@opentrons/components' @@ -80,14 +80,14 @@ const mockRunTimeParameter: RunTimeParameter[] = [ }, ] -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('ProtocolParameters', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/Desktop/ProtocolDetails/__tests__/ProtocolDetails.test.tsx b/app/src/organisms/Desktop/ProtocolDetails/__tests__/ProtocolDetails.test.tsx index f613c108b77..e9a75149199 100644 --- a/app/src/organisms/Desktop/ProtocolDetails/__tests__/ProtocolDetails.test.tsx +++ b/app/src/organisms/Desktop/ProtocolDetails/__tests__/ProtocolDetails.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { act, screen, waitFor } from '@testing-library/react' import { MemoryRouter } from 'react-router-dom' import { describe, it, beforeEach, vi, expect, afterEach } from 'vitest' @@ -26,6 +25,7 @@ import { import { storedProtocolData } from '/app/redux/protocol-storage/__fixtures__' import { ProtocolDetails } from '..' +import type { ComponentProps } from 'react' import type { Mock } from 'vitest' import type { ProtocolAnalysisOutput } from '@opentrons/shared-data' @@ -37,7 +37,7 @@ vi.mock('/app/organisms/Desktop/ChooseRobotToRunProtocolSlideout') vi.mock('/app/organisms/Desktop/SendProtocolToFlexSlideout') const render = ( - props: Partial> = {} + props: Partial> = {} ) => { return renderWithProviders( diff --git a/app/src/organisms/Desktop/ProtocolDetails/__tests__/ProtocolLabwareDetails.test.tsx b/app/src/organisms/Desktop/ProtocolDetails/__tests__/ProtocolLabwareDetails.test.tsx index 93c215643cf..bc25bcb5569 100644 --- a/app/src/organisms/Desktop/ProtocolDetails/__tests__/ProtocolLabwareDetails.test.tsx +++ b/app/src/organisms/Desktop/ProtocolDetails/__tests__/ProtocolLabwareDetails.test.tsx @@ -1,10 +1,10 @@ -import type * as React from 'react' import { screen } from '@testing-library/react' import { describe, it, beforeEach, vi } from 'vitest' import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { ProtocolLabwareDetails } from '../ProtocolLabwareDetails' +import type { ComponentProps } from 'react' import type { LoadLabwareRunTimeCommand } from '@opentrons/shared-data' import type { InfoScreen } from '@opentrons/components' @@ -67,14 +67,14 @@ const mockRequiredLabwareDetails = [ } as LoadLabwareRunTimeCommand, ] -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('ProtocolLabwareDetails', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { requiredLabwareDetails: mockRequiredLabwareDetails, diff --git a/app/src/organisms/Desktop/ProtocolDetails/__tests__/ProtocolLiquidsDetails.test.tsx b/app/src/organisms/Desktop/ProtocolDetails/__tests__/ProtocolLiquidsDetails.test.tsx index 69e55cc1097..9a6f233b312 100644 --- a/app/src/organisms/Desktop/ProtocolDetails/__tests__/ProtocolLiquidsDetails.test.tsx +++ b/app/src/organisms/Desktop/ProtocolDetails/__tests__/ProtocolLiquidsDetails.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { screen } from '@testing-library/react' import { describe, it, beforeEach, vi } from 'vitest' import { parseLiquidsInLoadOrder } from '@opentrons/shared-data' @@ -7,6 +6,7 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { ProtocolLiquidsDetails } from '../ProtocolLiquidsDetails' +import type { ComponentProps } from 'react' import type * as SharedData from '@opentrons/shared-data' vi.mock('../../Desktop/Devices/ProtocolRun/SetupLiquids/SetupLiquidsList') @@ -18,14 +18,14 @@ vi.mock('@opentrons/shared-data', async importOriginal => { } }) -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('ProtocolLiquidsDetails', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { commands: [], diff --git a/app/src/organisms/Desktop/ProtocolDetails/__tests__/RobotConfigurationDetails.test.tsx b/app/src/organisms/Desktop/ProtocolDetails/__tests__/RobotConfigurationDetails.test.tsx index b823732ce95..65ce7d6d24d 100644 --- a/app/src/organisms/Desktop/ProtocolDetails/__tests__/RobotConfigurationDetails.test.tsx +++ b/app/src/organisms/Desktop/ProtocolDetails/__tests__/RobotConfigurationDetails.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, expect, afterEach, vi } from 'vitest' import { screen } from '@testing-library/react' @@ -7,6 +6,8 @@ import { OT2_STANDARD_MODEL, FLEX_STANDARD_MODEL } from '@opentrons/shared-data' import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { RobotConfigurationDetails } from '../RobotConfigurationDetails' + +import type { ComponentProps } from 'react' import type { LoadModuleRunTimeCommand } from '@opentrons/shared-data' const mockRequiredModuleDetails = [ @@ -57,16 +58,14 @@ const mockRequiredModuleDetails = [ } as LoadModuleRunTimeCommand, ] -const render = ( - props: React.ComponentProps -) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('RobotConfigurationDetails', () => { - let props: React.ComponentProps + let props: ComponentProps afterEach(() => { vi.clearAllMocks() diff --git a/app/src/organisms/Desktop/ProtocolsLanding/ConfirmDeleteProtocolModal.tsx b/app/src/organisms/Desktop/ProtocolsLanding/ConfirmDeleteProtocolModal.tsx index 14d75238bcc..439d48a9f0d 100644 --- a/app/src/organisms/Desktop/ProtocolsLanding/ConfirmDeleteProtocolModal.tsx +++ b/app/src/organisms/Desktop/ProtocolsLanding/ConfirmDeleteProtocolModal.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useTranslation } from 'react-i18next' import { AlertPrimaryButton, @@ -14,9 +13,11 @@ import { TYPOGRAPHY, } from '@opentrons/components' +import type { MouseEventHandler } from 'react' + interface ConfirmDeleteProtocolModalProps { - cancelDeleteProtocol: React.MouseEventHandler | undefined - handleClickDelete: React.MouseEventHandler + cancelDeleteProtocol: MouseEventHandler | undefined + handleClickDelete: MouseEventHandler } export function ConfirmDeleteProtocolModal( diff --git a/app/src/organisms/Desktop/ProtocolsLanding/ProtocolOverflowMenu.tsx b/app/src/organisms/Desktop/ProtocolsLanding/ProtocolOverflowMenu.tsx index 0bcc71f8cc0..eacddbdaca3 100644 --- a/app/src/organisms/Desktop/ProtocolsLanding/ProtocolOverflowMenu.tsx +++ b/app/src/organisms/Desktop/ProtocolsLanding/ProtocolOverflowMenu.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { css } from 'styled-components' import { createPortal } from 'react-dom' import { useTranslation } from 'react-i18next' @@ -35,6 +34,7 @@ import { } from '/app/redux/protocol-storage' import { ConfirmDeleteProtocolModal } from './ConfirmDeleteProtocolModal' +import type { MouseEvent, MouseEventHandler } from 'react' import type { StyleProps } from '@opentrons/components' import type { StoredProtocolData } from '/app/redux/protocol-storage' import type { Dispatch } from '/app/redux/types' @@ -77,13 +77,13 @@ export function ProtocolOverflowMenu( const robotType = mostRecentAnalysis != null ? mostRecentAnalysis?.robotType ?? null : null - const handleClickShowInFolder: React.MouseEventHandler = e => { + const handleClickShowInFolder: MouseEventHandler = e => { e.preventDefault() e.stopPropagation() dispatch(viewProtocolSourceFolder(protocolKey)) setShowOverflowMenu(currentShowOverflowMenu => !currentShowOverflowMenu) } - const handleClickRun: React.MouseEventHandler = e => { + const handleClickRun: MouseEventHandler = e => { e.preventDefault() e.stopPropagation() trackEvent({ @@ -93,25 +93,25 @@ export function ProtocolOverflowMenu( handleRunProtocol(storedProtocolData) setShowOverflowMenu(currentShowOverflowMenu => !currentShowOverflowMenu) } - const handleClickSendToOT3: React.MouseEventHandler = e => { + const handleClickSendToOT3: MouseEventHandler = e => { e.preventDefault() e.stopPropagation() handleSendProtocolToFlex(storedProtocolData) setShowOverflowMenu(currentShowOverflowMenu => !currentShowOverflowMenu) } - const handleClickDelete: React.MouseEventHandler = e => { + const handleClickDelete: MouseEventHandler = e => { e.preventDefault() e.stopPropagation() confirmDeleteProtocol() setShowOverflowMenu(currentShowOverflowMenu => !currentShowOverflowMenu) } - const handleClickReanalyze: React.MouseEventHandler = e => { + const handleClickReanalyze: MouseEventHandler = e => { e.preventDefault() e.stopPropagation() dispatch(analyzeProtocol(protocolKey)) setShowOverflowMenu(currentShowOverflowMenu => !currentShowOverflowMenu) } - const handleClickTimeline: React.MouseEventHandler = e => { + const handleClickTimeline: MouseEventHandler = e => { e.preventDefault() navigate(`/protocols/${protocolKey}/timeline`) setShowOverflowMenu(prevShowOverflowMenu => !prevShowOverflowMenu) @@ -121,7 +121,7 @@ export function ProtocolOverflowMenu( { + onClick={(e: MouseEvent) => { e.stopPropagation() }} > @@ -195,7 +195,7 @@ export function ProtocolOverflowMenu( {showDeleteConfirmation ? createPortal( { + cancelDeleteProtocol={(e: MouseEvent) => { e.preventDefault() e.stopPropagation() cancelDeleteProtocol() diff --git a/app/src/organisms/Desktop/ProtocolsLanding/__tests__/ConfirmDeleteProtocolModal.test.tsx b/app/src/organisms/Desktop/ProtocolsLanding/__tests__/ConfirmDeleteProtocolModal.test.tsx index dd19a80d133..8d040851a56 100644 --- a/app/src/organisms/Desktop/ProtocolsLanding/__tests__/ConfirmDeleteProtocolModal.test.tsx +++ b/app/src/organisms/Desktop/ProtocolsLanding/__tests__/ConfirmDeleteProtocolModal.test.tsx @@ -1,20 +1,19 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, vi, expect, beforeEach, afterEach } from 'vitest' import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { ConfirmDeleteProtocolModal } from '../ConfirmDeleteProtocolModal' -const render = ( - props: React.ComponentProps -) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('ConfirmDeleteProtocolModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/Desktop/ProtocolsLanding/__tests__/ProtocolList.test.tsx b/app/src/organisms/Desktop/ProtocolsLanding/__tests__/ProtocolList.test.tsx index 59271bc279c..6f3190712c4 100644 --- a/app/src/organisms/Desktop/ProtocolsLanding/__tests__/ProtocolList.test.tsx +++ b/app/src/organisms/Desktop/ProtocolsLanding/__tests__/ProtocolList.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { BrowserRouter } from 'react-router-dom' import { when } from 'vitest-when' import { fireEvent, screen } from '@testing-library/react' @@ -16,13 +15,15 @@ import { useSortedProtocols } from '../hooks' import { EmptyStateLinks } from '../EmptyStateLinks' import { ProtocolCard } from '../ProtocolCard' +import type { ComponentProps } from 'react' + vi.mock('../hooks') vi.mock('/app/redux/protocol-storage') vi.mock('/app/redux/config') vi.mock('../EmptyStateLinks') vi.mock('../ProtocolCard') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders( @@ -34,7 +35,7 @@ const render = (props: React.ComponentProps) => { } describe('ProtocolList', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/Desktop/ProtocolsLanding/__tests__/hooks.test.tsx b/app/src/organisms/Desktop/ProtocolsLanding/__tests__/hooks.test.tsx index 5d1485fe795..0c10c8fb1ef 100644 --- a/app/src/organisms/Desktop/ProtocolsLanding/__tests__/hooks.test.tsx +++ b/app/src/organisms/Desktop/ProtocolsLanding/__tests__/hooks.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { Provider } from 'react-redux' import { createStore } from 'redux' import { renderHook } from '@testing-library/react' @@ -8,6 +7,7 @@ import { FLEX_ROBOT_TYPE, OT2_ROBOT_TYPE } from '@opentrons/shared-data' import { useSortedProtocols } from '../hooks' +import type { FunctionComponent, ReactNode } from 'react' import type { Store } from 'redux' import type { ProtocolAnalysisOutput } from '@opentrons/shared-data' import type { StoredProtocolData } from '/app/redux/protocol-storage' @@ -294,7 +294,7 @@ describe('useSortedProtocols', () => { }) it('should return an object with protocols sorted alphabetically', () => { - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) => {children} @@ -318,7 +318,7 @@ describe('useSortedProtocols', () => { }) it('should return an object with protocols sorted reverse alphabetically', () => { - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) => {children} @@ -342,7 +342,7 @@ describe('useSortedProtocols', () => { }) it('should return an object with protocols sorted by most recent modified data', () => { - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) => {children} @@ -366,7 +366,7 @@ describe('useSortedProtocols', () => { }) it('should return an object with protocols sorted by oldest modified data', () => { - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) => {children} @@ -390,7 +390,7 @@ describe('useSortedProtocols', () => { }) it('should return an object with protocols sorted by flex then ot-2', () => { - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) => {children} @@ -413,7 +413,7 @@ describe('useSortedProtocols', () => { ) }) it('should return an object with protocols sorted by ot-2 then flex', () => { - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) => {children} diff --git a/app/src/organisms/Desktop/RobotSettingsCalibration/CalibrationDataDownload.tsx b/app/src/organisms/Desktop/RobotSettingsCalibration/CalibrationDataDownload.tsx index 83aeddf3e35..47058491684 100644 --- a/app/src/organisms/Desktop/RobotSettingsCalibration/CalibrationDataDownload.tsx +++ b/app/src/organisms/Desktop/RobotSettingsCalibration/CalibrationDataDownload.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { saveAs } from 'file-saver' import { useTranslation, Trans } from 'react-i18next' @@ -32,6 +31,8 @@ import { import { useRobot, useIsFlex } from '/app/redux-resources/robots' import { useIsEstopNotDisengaged } from '/app/resources/devices/hooks/useIsEstopNotDisengaged' +import type { MouseEventHandler } from 'react' + // TODO(bc, 2022-02-08): replace with support article when available const FLEX_CALIBRATION_SUPPORT_URL = 'https://support.opentrons.com' @@ -70,7 +71,7 @@ export function CalibrationDataDownload({ tipLengthCalibrations != null && tipLengthCalibrations.length > 0 - const onClickSaveAs: React.MouseEventHandler = e => { + const onClickSaveAs: MouseEventHandler = e => { e.preventDefault() doTrackEvent({ name: ANALYTICS_CALIBRATION_DATA_DOWNLOADED, diff --git a/app/src/organisms/Desktop/RobotSettingsCalibration/CalibrationDetails/__tests__/ModuleCalibrationItems.test.tsx b/app/src/organisms/Desktop/RobotSettingsCalibration/CalibrationDetails/__tests__/ModuleCalibrationItems.test.tsx index 8cb0dd62dc6..ee0529a1c4e 100644 --- a/app/src/organisms/Desktop/RobotSettingsCalibration/CalibrationDetails/__tests__/ModuleCalibrationItems.test.tsx +++ b/app/src/organisms/Desktop/RobotSettingsCalibration/CalibrationDetails/__tests__/ModuleCalibrationItems.test.tsx @@ -1,6 +1,6 @@ -import type * as React from 'react' import { screen } from '@testing-library/react' import { describe, it, expect, vi, beforeEach } from 'vitest' +import { ABSORBANCE_READER_TYPE } from '@opentrons/shared-data' import { i18n } from '/app/i18n' import { renderWithProviders } from '/app/__testing-utils__' import { mockFetchModulesSuccessActionPayloadModules } from '/app/redux/modules/__fixtures__' @@ -8,8 +8,8 @@ import { ModuleCalibrationOverflowMenu } from '../ModuleCalibrationOverflowMenu' import { formatLastCalibrated } from '../utils' import { ModuleCalibrationItems } from '../ModuleCalibrationItems' +import type { ComponentProps } from 'react' import type { AttachedModule } from '@opentrons/api-client' -import { ABSORBANCE_READER_TYPE } from '@opentrons/shared-data' vi.mock('../ModuleCalibrationOverflowMenu') @@ -55,7 +55,7 @@ const mockCalibratedModule = { const ROBOT_NAME = 'mockRobot' const render = ( - props: React.ComponentProps + props: ComponentProps ): ReturnType => { return renderWithProviders(, { i18nInstance: i18n, @@ -63,7 +63,7 @@ const render = ( } describe('ModuleCalibrationItems', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/Desktop/RobotSettingsCalibration/CalibrationDetails/__tests__/ModuleCalibrationOverflowMenu.test.tsx b/app/src/organisms/Desktop/RobotSettingsCalibration/CalibrationDetails/__tests__/ModuleCalibrationOverflowMenu.test.tsx index 47b5dbec249..2807269794b 100644 --- a/app/src/organisms/Desktop/RobotSettingsCalibration/CalibrationDetails/__tests__/ModuleCalibrationOverflowMenu.test.tsx +++ b/app/src/organisms/Desktop/RobotSettingsCalibration/CalibrationDetails/__tests__/ModuleCalibrationOverflowMenu.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen, waitFor } from '@testing-library/react' import { when } from 'vitest-when' import { describe, it, expect, vi, beforeEach } from 'vitest' @@ -11,6 +10,7 @@ import { useIsEstopNotDisengaged } from '/app/resources/devices/hooks/useIsEstop import { ModuleCalibrationOverflowMenu } from '../ModuleCalibrationOverflowMenu' +import type { ComponentProps } from 'react' import type { Mount } from '@opentrons/components' vi.mock('@opentrons/react-api-client') @@ -87,7 +87,7 @@ const mockTCHeating = { } as any const render = ( - props: React.ComponentProps + props: ComponentProps ) => { return renderWithProviders(, { i18nInstance: i18n, @@ -97,7 +97,7 @@ const render = ( const ROBOT_NAME = 'mockRobot' describe('ModuleCalibrationOverflowMenu', () => { - let props: React.ComponentProps + let props: ComponentProps let mockChainLiveCommands = vi.fn() beforeEach(() => { diff --git a/app/src/organisms/Desktop/RobotSettingsCalibration/CalibrationDetails/__tests__/OverflowMenu.test.tsx b/app/src/organisms/Desktop/RobotSettingsCalibration/CalibrationDetails/__tests__/OverflowMenu.test.tsx index a0d2ff20096..cf106ccc6b3 100644 --- a/app/src/organisms/Desktop/RobotSettingsCalibration/CalibrationDetails/__tests__/OverflowMenu.test.tsx +++ b/app/src/organisms/Desktop/RobotSettingsCalibration/CalibrationDetails/__tests__/OverflowMenu.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { when } from 'vitest-when' import '@testing-library/jest-dom/vitest' @@ -26,10 +25,11 @@ import { renderWithProviders } from '/app/__testing-utils__' import { useIsEstopNotDisengaged } from '/app/resources/devices' import { OverflowMenu } from '../OverflowMenu' +import type { ComponentProps } from 'react' import type { Mount } from '@opentrons/components' const render = ( - props: React.ComponentProps + props: ComponentProps ): ReturnType => { return renderWithProviders(, { i18nInstance: i18n, @@ -81,7 +81,7 @@ const RUN_STATUSES = { const mockUpdateRobotStatus = vi.fn() describe('OverflowMenu', () => { - let props: React.ComponentProps + let props: ComponentProps const mockDeleteCalibration = vi.fn() beforeEach(() => { diff --git a/app/src/organisms/Desktop/RobotSettingsCalibration/CalibrationDetails/__tests__/PipetteOffsetCalibrationItems.test.tsx b/app/src/organisms/Desktop/RobotSettingsCalibration/CalibrationDetails/__tests__/PipetteOffsetCalibrationItems.test.tsx index 2a6cf82726f..bca259d41c5 100644 --- a/app/src/organisms/Desktop/RobotSettingsCalibration/CalibrationDetails/__tests__/PipetteOffsetCalibrationItems.test.tsx +++ b/app/src/organisms/Desktop/RobotSettingsCalibration/CalibrationDetails/__tests__/PipetteOffsetCalibrationItems.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { when } from 'vitest-when' import { screen } from '@testing-library/react' import { describe, it, expect, vi, beforeEach } from 'vitest' @@ -19,11 +18,12 @@ import { PipetteOffsetCalibrationItems } from '../PipetteOffsetCalibrationItems' import { OverflowMenu } from '../OverflowMenu' import { formatLastCalibrated } from '../utils' +import type { ComponentProps } from 'react' import type { Mount } from '@opentrons/components' import type { AttachedPipettesByMount } from '/app/redux/pipettes/types' const render = ( - props: React.ComponentProps + props: ComponentProps ): ReturnType => { return renderWithProviders(, { i18nInstance: i18n, @@ -73,7 +73,7 @@ const mockAttachedPipettes: AttachedPipettesByMount = { const mockUpdateRobotStatus = vi.fn() describe('PipetteOffsetCalibrationItems', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { vi.mocked(useAttachedPipettesFromInstrumentsQuery).mockReturnValue({ diff --git a/app/src/organisms/Desktop/RobotSettingsCalibration/CalibrationDetails/__tests__/TipLengthCalibrationItems.test.tsx b/app/src/organisms/Desktop/RobotSettingsCalibration/CalibrationDetails/__tests__/TipLengthCalibrationItems.test.tsx index 014ec28ee2c..19270615a06 100644 --- a/app/src/organisms/Desktop/RobotSettingsCalibration/CalibrationDetails/__tests__/TipLengthCalibrationItems.test.tsx +++ b/app/src/organisms/Desktop/RobotSettingsCalibration/CalibrationDetails/__tests__/TipLengthCalibrationItems.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { screen } from '@testing-library/react' import { describe, it, expect, vi, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' @@ -6,6 +5,8 @@ import { i18n } from '/app/i18n' import { renderWithProviders } from '/app/__testing-utils__' import { TipLengthCalibrationItems } from '../TipLengthCalibrationItems' import { OverflowMenu } from '../OverflowMenu' + +import type { ComponentProps } from 'react' import type { Mount } from '@opentrons/components' vi.mock('/app/redux/custom-labware/selectors') @@ -54,14 +55,14 @@ const mockTipLengthCalibrations = [ const mockUpdateRobotStatus = vi.fn() const render = ( - props: React.ComponentProps + props: ComponentProps ): ReturnType => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('TipLengthCalibrationItems', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { vi.mocked(OverflowMenu).mockReturnValue(
        mock overflow menu
        ) diff --git a/app/src/organisms/Desktop/RobotSettingsCalibration/__tests__/CalibrationHealthCheck.test.tsx b/app/src/organisms/Desktop/RobotSettingsCalibration/__tests__/CalibrationHealthCheck.test.tsx index ee965c9d042..c434f6c1392 100644 --- a/app/src/organisms/Desktop/RobotSettingsCalibration/__tests__/CalibrationHealthCheck.test.tsx +++ b/app/src/organisms/Desktop/RobotSettingsCalibration/__tests__/CalibrationHealthCheck.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import userEvent from '@testing-library/user-event' import { fireEvent, screen, waitFor } from '@testing-library/react' import { describe, it, expect, vi, beforeEach } from 'vitest' @@ -20,14 +19,13 @@ import { } from '/app/redux/calibration/tip-length/__fixtures__' import { mockAttachedPipette } from '/app/redux/pipettes/__fixtures__' import { useRunStatuses } from '/app/resources/runs' - import { useAttachedPipettes, useAttachedPipetteCalibrations, } from '/app/resources/instruments' - import { CalibrationHealthCheck } from '../CalibrationHealthCheck' +import type { ComponentProps } from 'react' import type { AttachedPipettesByMount, PipetteCalibrationsByMount, @@ -66,7 +64,7 @@ let mockTrackEvent: any const mockDispatchRequests = vi.fn() const render = ( - props?: Partial> + props?: Partial> ) => { return renderWithProviders( > + props?: Partial> ) => { return renderWithProviders( , diff --git a/app/src/organisms/Desktop/RobotSettingsCalibration/__tests__/RobotSettingsGripperCalibration.test.tsx b/app/src/organisms/Desktop/RobotSettingsCalibration/__tests__/RobotSettingsGripperCalibration.test.tsx index e4a4d48eea1..ff0570443d1 100644 --- a/app/src/organisms/Desktop/RobotSettingsCalibration/__tests__/RobotSettingsGripperCalibration.test.tsx +++ b/app/src/organisms/Desktop/RobotSettingsCalibration/__tests__/RobotSettingsGripperCalibration.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { when } from 'vitest-when' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, vi, beforeEach } from 'vitest' @@ -10,6 +9,7 @@ import { formatLastCalibrated } from '../CalibrationDetails/utils' import { useIsEstopNotDisengaged } from '/app/resources/devices/hooks/useIsEstopNotDisengaged' import { RobotSettingsGripperCalibration } from '../RobotSettingsGripperCalibration' +import type { ComponentProps } from 'react' import type { GripperData } from '@opentrons/api-client' vi.mock('/app/organisms/GripperWizardFlows') @@ -35,7 +35,7 @@ const mockNotCalibratedGripper = { const ROBOT_NAME = 'mockRobot' const render = ( - props: React.ComponentProps + props: ComponentProps ) => { return renderWithProviders(, { i18nInstance: i18n, @@ -43,7 +43,7 @@ const render = ( } describe('RobotSettingsGripperCalibration', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { vi.mocked(formatLastCalibrated).mockReturnValue('last calibrated 1/2/3') vi.mocked(GripperWizardFlows).mockReturnValue(<>Mock Wizard Flow) diff --git a/app/src/organisms/Desktop/RobotSettingsCalibration/__tests__/RobotSettingsModuleCalibration.test.tsx b/app/src/organisms/Desktop/RobotSettingsCalibration/__tests__/RobotSettingsModuleCalibration.test.tsx index 95b71a450af..63d5014da79 100644 --- a/app/src/organisms/Desktop/RobotSettingsCalibration/__tests__/RobotSettingsModuleCalibration.test.tsx +++ b/app/src/organisms/Desktop/RobotSettingsCalibration/__tests__/RobotSettingsModuleCalibration.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { screen } from '@testing-library/react' import { describe, it, vi, beforeEach } from 'vitest' import { i18n } from '/app/i18n' @@ -7,10 +6,12 @@ import { mockFetchModulesSuccessActionPayloadModules } from '/app/redux/modules/ import { RobotSettingsModuleCalibration } from '../RobotSettingsModuleCalibration' import { ModuleCalibrationItems } from '../CalibrationDetails/ModuleCalibrationItems' +import type { ComponentProps } from 'react' + vi.mock('../CalibrationDetails/ModuleCalibrationItems') const render = ( - props: React.ComponentProps + props: ComponentProps ) => { return renderWithProviders(, { i18nInstance: i18n, @@ -20,7 +21,7 @@ const render = ( const ROBOT_NAME = 'mockRobot' describe('RobotSettingsModuleCalibration', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/Desktop/RobotSettingsCalibration/__tests__/RobotSettingsPipetteOffsetCalibration.test.tsx b/app/src/organisms/Desktop/RobotSettingsCalibration/__tests__/RobotSettingsPipetteOffsetCalibration.test.tsx index 0f628dddfef..6b883499831 100644 --- a/app/src/organisms/Desktop/RobotSettingsCalibration/__tests__/RobotSettingsPipetteOffsetCalibration.test.tsx +++ b/app/src/organisms/Desktop/RobotSettingsCalibration/__tests__/RobotSettingsPipetteOffsetCalibration.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { when } from 'vitest-when' import { describe, it, vi, beforeEach } from 'vitest' import { screen } from '@testing-library/react' @@ -18,6 +17,7 @@ import { useIsFlex } from '/app/redux-resources/robots' import { RobotSettingsPipetteOffsetCalibration } from '../RobotSettingsPipetteOffsetCalibration' import { PipetteOffsetCalibrationItems } from '../CalibrationDetails/PipetteOffsetCalibrationItems' +import type { ComponentProps } from 'react' import type { FormattedPipetteOffsetCalibration } from '..' vi.mock('/app/organisms/Desktop/Devices/hooks') @@ -29,9 +29,7 @@ const mockFormattedPipetteOffsetCalibrations: FormattedPipetteOffsetCalibration[ const mockUpdateRobotStatus = vi.fn() const render = ( - props?: Partial< - React.ComponentProps - > + props?: Partial> ) => { return renderWithProviders( ) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('InterventionTicks', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { vi.mocked(Tick).mockImplementation(({ index }) => (
        MOCK TICK at index: {index}
        diff --git a/app/src/organisms/Desktop/RunProgressMeter/__tests__/RunProgressMeter.test.tsx b/app/src/organisms/Desktop/RunProgressMeter/__tests__/RunProgressMeter.test.tsx index 928bd2572a9..469c056c087 100644 --- a/app/src/organisms/Desktop/RunProgressMeter/__tests__/RunProgressMeter.test.tsx +++ b/app/src/organisms/Desktop/RunProgressMeter/__tests__/RunProgressMeter.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { when } from 'vitest-when' import { screen } from '@testing-library/react' import { describe, it, expect, vi, beforeEach } from 'vitest' @@ -37,6 +36,7 @@ import { RunProgressMeter } from '..' import { renderWithProviders } from '/app/__testing-utils__' import { useRunningStepCounts } from '/app/resources/protocols/hooks' +import type { ComponentProps } from 'react' import type { RunCommandSummary } from '@opentrons/api-client' import type * as ApiClient from '@opentrons/react-api-client' @@ -55,7 +55,7 @@ vi.mock('../../Devices/hooks') vi.mock('/app/resources/protocols/hooks') vi.mock('/app/redux-resources/robots') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] @@ -65,7 +65,7 @@ const NON_DETERMINISTIC_RUN_ID = 'nonDeterministicID' const ROBOT_NAME = 'otie' describe('RunProgressMeter', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { vi.mocked(ProgressBar).mockReturnValue(
        MOCK PROGRESS BAR
        ) vi.mocked(InterventionModal).mockReturnValue( diff --git a/app/src/organisms/Desktop/RunProgressMeter/hooks/useRunProgressCopy.tsx b/app/src/organisms/Desktop/RunProgressMeter/hooks/useRunProgressCopy.tsx index 65e2f27d6b3..aaa90997167 100644 --- a/app/src/organisms/Desktop/RunProgressMeter/hooks/useRunProgressCopy.tsx +++ b/app/src/organisms/Desktop/RunProgressMeter/hooks/useRunProgressCopy.tsx @@ -4,7 +4,6 @@ import { RUN_STATUS_BLOCKED_BY_OPEN_DOOR, RUN_STATUS_IDLE, } from '@opentrons/api-client' -import type * as React from 'react' import { useTranslation } from 'react-i18next' import { getCommandTextData } from '/app/local-resources/commands' @@ -13,6 +12,7 @@ import { LegacyStyledText } from '@opentrons/components' import { CommandText } from '/app/molecules/Command' import { TERMINAL_RUN_STATUSES } from '../constants' +import type { ReactNode } from 'react' import type { CommandDetail, RunStatus } from '@opentrons/api-client' import type { CompletedProtocolAnalysis, @@ -21,7 +21,7 @@ import type { } from '@opentrons/shared-data' interface UseRunProgressResult { - currentStepContents: React.ReactNode + currentStepContents: ReactNode stepCountStr: string | null progressPercentage: number } diff --git a/app/src/organisms/Desktop/RunProgressMeter/index.tsx b/app/src/organisms/Desktop/RunProgressMeter/index.tsx index fb158f5d686..ecf38cd31f6 100644 --- a/app/src/organisms/Desktop/RunProgressMeter/index.tsx +++ b/app/src/organisms/Desktop/RunProgressMeter/index.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { createPortal } from 'react-dom' import { useTranslation } from 'react-i18next' import { css } from 'styled-components' @@ -49,6 +48,8 @@ import { useRobotType } from '/app/redux-resources/robots' import { useRunningStepCounts } from '/app/resources/protocols/hooks' import { useRunProgressCopy } from './hooks' +import type { MouseEventHandler } from 'react' + interface RunProgressMeterProps { runId: string robotName: string @@ -92,7 +93,7 @@ export function RunProgressMeter(props: RunProgressMeterProps): JSX.Element { const { downloadRunLog } = useDownloadRunLog(robotName, runId) - const onDownloadClick: React.MouseEventHandler = e => { + const onDownloadClick: MouseEventHandler = e => { if (downloadIsDisabled) return false e.preventDefault() e.stopPropagation() diff --git a/app/src/organisms/Desktop/SendProtocolToFlexSlideout/__tests__/SendProtocolToFlexSlideout.test.tsx b/app/src/organisms/Desktop/SendProtocolToFlexSlideout/__tests__/SendProtocolToFlexSlideout.test.tsx index 5ed8f96fb1a..08e60f84729 100644 --- a/app/src/organisms/Desktop/SendProtocolToFlexSlideout/__tests__/SendProtocolToFlexSlideout.test.tsx +++ b/app/src/organisms/Desktop/SendProtocolToFlexSlideout/__tests__/SendProtocolToFlexSlideout.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, vi, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' @@ -36,6 +35,7 @@ import { storedProtocolData as storedProtocolDataFixture } from '/app/redux/prot import { SendProtocolToFlexSlideout } from '..' import { useNotifyAllRunsQuery } from '/app/resources/runs' +import type { ComponentProps } from 'react' import type * as ApiClient from '@opentrons/react-api-client' vi.mock('@opentrons/react-api-client', async importOriginal => { @@ -53,9 +53,7 @@ vi.mock('/app/redux/custom-labware') vi.mock('/app/redux/protocol-storage/selectors') vi.mock('/app/resources/runs') -const render = ( - props: React.ComponentProps -) => { +const render = (props: ComponentProps) => { return renderWithProviders( diff --git a/app/src/organisms/Desktop/SystemLanguagePreferenceModal/__tests__/SystemLanguagePreferenceModal.test.tsx b/app/src/organisms/Desktop/SystemLanguagePreferenceModal/__tests__/SystemLanguagePreferenceModal.test.tsx index 104085fcb15..af4c4feb5d0 100644 --- a/app/src/organisms/Desktop/SystemLanguagePreferenceModal/__tests__/SystemLanguagePreferenceModal.test.tsx +++ b/app/src/organisms/Desktop/SystemLanguagePreferenceModal/__tests__/SystemLanguagePreferenceModal.test.tsx @@ -5,6 +5,10 @@ import { describe, it, vi, afterEach, beforeEach, expect } from 'vitest' import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' +import { + ANALYTICS_LANGUAGE_UPDATED_DESKTOP_APP_MODAL, + useTrackEvent, +} from '/app/redux/analytics' import { getAppLanguage, getStoredSystemLanguage, @@ -16,6 +20,7 @@ import { SystemLanguagePreferenceModal } from '..' vi.mock('react-router-dom') vi.mock('/app/redux/config') vi.mock('/app/redux/shell') +vi.mock('/app/redux/analytics') const render = () => { return renderWithProviders(, { @@ -24,6 +29,7 @@ const render = () => { } const mockNavigate = vi.fn() +const mockTrackEvent = vi.fn() const MOCK_DEFAULT_LANGUAGE = 'en-US' @@ -33,6 +39,7 @@ describe('SystemLanguagePreferenceModal', () => { vi.mocked(getSystemLanguage).mockReturnValue(MOCK_DEFAULT_LANGUAGE) vi.mocked(getStoredSystemLanguage).mockReturnValue(MOCK_DEFAULT_LANGUAGE) vi.mocked(useNavigate).mockReturnValue(mockNavigate) + vi.mocked(useTrackEvent).mockReturnValue(mockTrackEvent) }) afterEach(() => { vi.resetAllMocks() @@ -68,6 +75,14 @@ describe('SystemLanguagePreferenceModal', () => { 'language.systemLanguage', MOCK_DEFAULT_LANGUAGE ) + expect(mockTrackEvent).toBeCalledWith({ + name: ANALYTICS_LANGUAGE_UPDATED_DESKTOP_APP_MODAL, + properties: { + language: MOCK_DEFAULT_LANGUAGE, + systemLanguage: MOCK_DEFAULT_LANGUAGE, + modalType: 'appBootModal', + }, + }) }) it('should default to English (US) if system language is unsupported', () => { @@ -90,6 +105,14 @@ describe('SystemLanguagePreferenceModal', () => { MOCK_DEFAULT_LANGUAGE ) expect(updateConfigValue).toBeCalledWith('language.systemLanguage', 'es-MX') + expect(mockTrackEvent).toBeCalledWith({ + name: ANALYTICS_LANGUAGE_UPDATED_DESKTOP_APP_MODAL, + properties: { + language: MOCK_DEFAULT_LANGUAGE, + systemLanguage: 'es-MX', + modalType: 'appBootModal', + }, + }) }) it('should set a supported app language when system language is an unsupported locale of the same language', () => { @@ -112,6 +135,14 @@ describe('SystemLanguagePreferenceModal', () => { MOCK_DEFAULT_LANGUAGE ) expect(updateConfigValue).toBeCalledWith('language.systemLanguage', 'en-GB') + expect(mockTrackEvent).toBeCalledWith({ + name: ANALYTICS_LANGUAGE_UPDATED_DESKTOP_APP_MODAL, + properties: { + language: MOCK_DEFAULT_LANGUAGE, + systemLanguage: 'en-GB', + modalType: 'appBootModal', + }, + }) }) it('should render the correct header, description, and buttons when system language changes', () => { @@ -139,6 +170,14 @@ describe('SystemLanguagePreferenceModal', () => { 'language.systemLanguage', 'zh-CN' ) + expect(mockTrackEvent).toBeCalledWith({ + name: ANALYTICS_LANGUAGE_UPDATED_DESKTOP_APP_MODAL, + properties: { + language: 'zh-CN', + systemLanguage: 'zh-CN', + modalType: 'systemLanguageUpdateModal', + }, + }) fireEvent.click(secondaryButton) expect(updateConfigValue).toHaveBeenNthCalledWith( 3, @@ -168,6 +207,14 @@ describe('SystemLanguagePreferenceModal', () => { 'language.systemLanguage', 'zh-Hant' ) + expect(mockTrackEvent).toBeCalledWith({ + name: ANALYTICS_LANGUAGE_UPDATED_DESKTOP_APP_MODAL, + properties: { + language: 'zh-CN', + systemLanguage: 'zh-Hant', + modalType: 'systemLanguageUpdateModal', + }, + }) fireEvent.click(secondaryButton) expect(updateConfigValue).toHaveBeenNthCalledWith( 3, diff --git a/app/src/organisms/Desktop/SystemLanguagePreferenceModal/index.tsx b/app/src/organisms/Desktop/SystemLanguagePreferenceModal/index.tsx index d3b04f19061..f135c0fe10a 100644 --- a/app/src/organisms/Desktop/SystemLanguagePreferenceModal/index.tsx +++ b/app/src/organisms/Desktop/SystemLanguagePreferenceModal/index.tsx @@ -16,6 +16,10 @@ import { } from '@opentrons/components' import { LANGUAGES } from '/app/i18n' +import { + ANALYTICS_LANGUAGE_UPDATED_DESKTOP_APP_MODAL, + useTrackEvent, +} from '/app/redux/analytics' import { getAppLanguage, getStoredSystemLanguage, @@ -32,7 +36,7 @@ type ArrayElement< export function SystemLanguagePreferenceModal(): JSX.Element | null { const { i18n, t } = useTranslation(['app_settings', 'shared', 'branded']) - + const trackEvent = useTrackEvent() const [currentOption, setCurrentOption] = useState( LANGUAGES[0] ) @@ -66,6 +70,16 @@ export function SystemLanguagePreferenceModal(): JSX.Element | null { const handlePrimaryClick = (): void => { dispatch(updateConfigValue('language.appLanguage', currentOption.value)) dispatch(updateConfigValue('language.systemLanguage', systemLanguage)) + trackEvent({ + name: ANALYTICS_LANGUAGE_UPDATED_DESKTOP_APP_MODAL, + properties: { + language: currentOption.value, + systemLanguage, + modalType: showUpdateModal + ? 'systemLanguageUpdateModal' + : 'appBootModal', + }, + }) } const handleDropdownClick = (value: string): void => { diff --git a/app/src/organisms/Desktop/UpdateAppModal/__tests__/UpdateAppModal.test.tsx b/app/src/organisms/Desktop/UpdateAppModal/__tests__/UpdateAppModal.test.tsx index 3131bee25a3..4469abc159a 100644 --- a/app/src/organisms/Desktop/UpdateAppModal/__tests__/UpdateAppModal.test.tsx +++ b/app/src/organisms/Desktop/UpdateAppModal/__tests__/UpdateAppModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { screen, fireEvent } from '@testing-library/react' import { describe, it, expect, vi, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' @@ -9,10 +8,11 @@ import { renderWithProviders } from '/app/__testing-utils__' import { useRemoveActiveAppUpdateToast } from '../../Alerts' import { UpdateAppModal, RELEASE_NOTES_URL_BASE } from '..' +import type { ComponentProps } from 'react' +import type * as Dom from 'react-router-dom' import type { State } from '/app/redux/types' import type { ShellUpdateState } from '/app/redux/shell/types' import type * as ShellState from '/app/redux/shell' -import type * as Dom from 'react-router-dom' import type { UpdateAppModalProps } from '..' vi.mock('/app/redux/shell/update', async importOriginal => { @@ -35,7 +35,7 @@ vi.mock('../../Alerts') const getShellUpdateState = Shell.getShellUpdateState -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, initialState: { @@ -45,7 +45,7 @@ const render = (props: React.ComponentProps) => { } describe('UpdateAppModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/Desktop/UpdateRobotBanner/__tests__/UpdateRobotBanner.test.tsx b/app/src/organisms/Desktop/UpdateRobotBanner/__tests__/UpdateRobotBanner.test.tsx index e7d90f70ea3..e1b67d7c9dc 100644 --- a/app/src/organisms/Desktop/UpdateRobotBanner/__tests__/UpdateRobotBanner.test.tsx +++ b/app/src/organisms/Desktop/UpdateRobotBanner/__tests__/UpdateRobotBanner.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, expect, vi, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' import { fireEvent, screen } from '@testing-library/react' @@ -12,19 +11,21 @@ import { import { handleUpdateBuildroot } from '../../Devices/RobotSettings/UpdateBuildroot' import { UpdateRobotBanner } from '..' +import type { ComponentProps } from 'react' + vi.mock('/app/redux/robot-update') vi.mock('../../Devices/RobotSettings/UpdateBuildroot') const getUpdateDisplayInfo = Buildroot.getRobotUpdateDisplayInfo -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('UpdateRobotBanner', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/Desktop/UpdateRobotBanner/index.tsx b/app/src/organisms/Desktop/UpdateRobotBanner/index.tsx index e5d7d2d0e85..390f4bc3ac1 100644 --- a/app/src/organisms/Desktop/UpdateRobotBanner/index.tsx +++ b/app/src/organisms/Desktop/UpdateRobotBanner/index.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useSelector } from 'react-redux' import { useTranslation } from 'react-i18next' import { @@ -13,6 +12,7 @@ import { import { getRobotUpdateDisplayInfo } from '/app/redux/robot-update' import { handleUpdateBuildroot } from '../Devices/RobotSettings/UpdateBuildroot' +import type { MouseEvent } from 'react' import type { StyleProps } from '@opentrons/components' import type { State } from '/app/redux/types' import type { DiscoveredRobot } from '/app/redux/discovery/types' @@ -35,7 +35,7 @@ export function UpdateRobotBanner( robot !== null && robot.healthStatus === 'ok' ? ( { + onClick={(e: MouseEvent) => { e.stopPropagation() }} flexDirection={DIRECTION_COLUMN} diff --git a/app/src/organisms/DeviceDetailsDeckConfiguration/__tests__/AddFixtureModal.test.tsx b/app/src/organisms/DeviceDetailsDeckConfiguration/__tests__/AddFixtureModal.test.tsx index 450a64cc0e6..955c9e0f86b 100644 --- a/app/src/organisms/DeviceDetailsDeckConfiguration/__tests__/AddFixtureModal.test.tsx +++ b/app/src/organisms/DeviceDetailsDeckConfiguration/__tests__/AddFixtureModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, beforeEach, vi, expect, afterEach } from 'vitest' @@ -16,6 +15,7 @@ import { i18n } from '/app/i18n' import { AddFixtureModal } from '../AddFixtureModal' import { useNotifyDeckConfigurationQuery } from '/app/resources/deck_configuration' +import type { ComponentProps } from 'react' import type { UseQueryResult } from 'react-query' import type { DeckConfiguration } from '@opentrons/shared-data' import type { Modules } from '@opentrons/api-client' @@ -26,14 +26,14 @@ vi.mock('/app/resources/deck_configuration') const mockCloseModal = vi.fn() const mockUpdateDeckConfiguration = vi.fn() -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('Touchscreen AddFixtureModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { @@ -88,7 +88,7 @@ describe('Touchscreen AddFixtureModal', () => { }) describe('Desktop AddFixtureModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/DeviceDetailsDeckConfiguration/__tests__/DeckConfigurationDiscardChangesModal.test.tsx b/app/src/organisms/DeviceDetailsDeckConfiguration/__tests__/DeckConfigurationDiscardChangesModal.test.tsx index fd0e56ffa4d..b0b213170dc 100644 --- a/app/src/organisms/DeviceDetailsDeckConfiguration/__tests__/DeckConfigurationDiscardChangesModal.test.tsx +++ b/app/src/organisms/DeviceDetailsDeckConfiguration/__tests__/DeckConfigurationDiscardChangesModal.test.tsx @@ -1,10 +1,11 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, beforeEach, vi, expect } from 'vitest' import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { DeckConfigurationDiscardChangesModal } from '../DeckConfigurationDiscardChangesModal' + +import type { ComponentProps } from 'react' import type { NavigateFunction } from 'react-router-dom' const mockFunc = vi.fn() @@ -19,7 +20,7 @@ vi.mock('react-router-dom', async importOriginal => { }) const render = ( - props: React.ComponentProps + props: ComponentProps ) => { return renderWithProviders( , @@ -30,7 +31,7 @@ const render = ( } describe('DeckConfigurationDiscardChangesModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/DeviceDetailsDeckConfiguration/__tests__/DeckFixtureSetupInstructionsModal.test.tsx b/app/src/organisms/DeviceDetailsDeckConfiguration/__tests__/DeckFixtureSetupInstructionsModal.test.tsx index ddc9ff33194..bfd218f5e97 100644 --- a/app/src/organisms/DeviceDetailsDeckConfiguration/__tests__/DeckFixtureSetupInstructionsModal.test.tsx +++ b/app/src/organisms/DeviceDetailsDeckConfiguration/__tests__/DeckFixtureSetupInstructionsModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, beforeEach, vi, expect } from 'vitest' @@ -6,12 +5,14 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { DeckFixtureSetupInstructionsModal } from '../DeckFixtureSetupInstructionsModal' +import type { ComponentProps } from 'react' + const mockFunc = vi.fn() const PNG_FILE_NAME = '/app/src/assets/images/on-device-display/deck_fixture_setup_qrcode.png' const render = ( - props: React.ComponentProps + props: ComponentProps ) => { return renderWithProviders(, { i18nInstance: i18n, @@ -19,7 +20,7 @@ const render = ( } describe('Touchscreen DeckFixtureSetupInstructionsModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { @@ -49,7 +50,7 @@ describe('Touchscreen DeckFixtureSetupInstructionsModal', () => { }) describe('Desktop DeckFixtureSetupInstructionsModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/DeviceDetailsDeckConfiguration/__tests__/DeviceDetailsDeckConfiguration.test.tsx b/app/src/organisms/DeviceDetailsDeckConfiguration/__tests__/DeviceDetailsDeckConfiguration.test.tsx index 16ef3db90a7..409f0d3f452 100644 --- a/app/src/organisms/DeviceDetailsDeckConfiguration/__tests__/DeviceDetailsDeckConfiguration.test.tsx +++ b/app/src/organisms/DeviceDetailsDeckConfiguration/__tests__/DeviceDetailsDeckConfiguration.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { when } from 'vitest-when' import { describe, it, beforeEach, vi, afterEach } from 'vitest' @@ -23,6 +22,7 @@ import { useNotifyDeckConfigurationQuery, } from '/app/resources/deck_configuration' +import type { ComponentProps } from 'react' import type { UseQueryResult } from 'react-query' import type { MaintenanceRun } from '@opentrons/api-client' import type { DeckConfiguration } from '@opentrons/shared-data' @@ -62,7 +62,7 @@ const mockCurrnetMaintenanceRun = { } as MaintenanceRun const render = ( - props: React.ComponentProps + props: ComponentProps ) => { return renderWithProviders(, { i18nInstance: i18n, @@ -70,7 +70,7 @@ const render = ( } describe('DeviceDetailsDeckConfiguration', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/DropTipWizardFlows/__tests__/DropTipWizard.test.tsx b/app/src/organisms/DropTipWizardFlows/__tests__/DropTipWizard.test.tsx index d1108fc3c18..9ea6a6f2363 100644 --- a/app/src/organisms/DropTipWizardFlows/__tests__/DropTipWizard.test.tsx +++ b/app/src/organisms/DropTipWizardFlows/__tests__/DropTipWizard.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, describe, it, expect, beforeEach } from 'vitest' import { screen } from '@testing-library/react' @@ -31,6 +30,8 @@ import { CONFIRM_POSITION, } from '../constants' +import type { ComponentProps } from 'react' + vi.mock('/app/molecules/InProgressModal') vi.mock('../ExitConfirmation') vi.mock('../steps') @@ -38,7 +39,7 @@ vi.mock('../ErrorInfo') vi.mock('../DropTipWizardHeader') const renderDropTipWizardContainer = ( - props: React.ComponentProps + props: ComponentProps ) => { return renderWithProviders(, { i18nInstance: i18n, @@ -46,7 +47,7 @@ const renderDropTipWizardContainer = ( } describe('DropTipWizardContainer', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = mockDropTipWizardContainerProps @@ -75,7 +76,7 @@ describe('DropTipWizardContainer', () => { }) const renderDropTipWizardContent = ( - props: React.ComponentProps + props: ComponentProps ) => { return renderWithProviders(, { i18nInstance: i18n, @@ -83,7 +84,7 @@ const renderDropTipWizardContent = ( } describe('DropTipWizardContent', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = mockDropTipWizardContainerProps diff --git a/app/src/organisms/DropTipWizardFlows/__tests__/DropTipWizardHeader.test.tsx b/app/src/organisms/DropTipWizardFlows/__tests__/DropTipWizardHeader.test.tsx index c5720adf4ab..74bb70f6a8e 100644 --- a/app/src/organisms/DropTipWizardFlows/__tests__/DropTipWizardHeader.test.tsx +++ b/app/src/organisms/DropTipWizardFlows/__tests__/DropTipWizardHeader.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { beforeEach, describe, expect, it, vi } from 'vitest' import { screen } from '@testing-library/react' @@ -10,17 +9,18 @@ import { DropTipWizardHeader, } from '../DropTipWizardHeader' +import type { ComponentProps } from 'react' import type { Mock } from 'vitest' import type { UseWizardExitHeaderProps } from '../DropTipWizardHeader' -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('DropTipWizardHeader', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = mockDropTipWizardContainerProps diff --git a/app/src/organisms/EmergencyStop/__tests__/EstopMissingModal.test.tsx b/app/src/organisms/EmergencyStop/__tests__/EstopMissingModal.test.tsx index c2ce7cea0e1..c71c0a146ee 100644 --- a/app/src/organisms/EmergencyStop/__tests__/EstopMissingModal.test.tsx +++ b/app/src/organisms/EmergencyStop/__tests__/EstopMissingModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import '@testing-library/jest-dom/vitest' import { describe, it, vi, beforeEach, expect } from 'vitest' @@ -8,16 +7,18 @@ import { i18n } from '/app/i18n' import { getIsOnDevice } from '/app/redux/config' import { EstopMissingModal } from '../EstopMissingModal' +import type { ComponentProps } from 'react' + vi.mock('/app/redux/config') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('EstopMissingModal - Touchscreen', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { @@ -40,7 +41,7 @@ describe('EstopMissingModal - Touchscreen', () => { }) describe('EstopMissingModal - Desktop', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/EmergencyStop/__tests__/EstopPressedModal.test.tsx b/app/src/organisms/EmergencyStop/__tests__/EstopPressedModal.test.tsx index 067211c4c06..6d259bd6acb 100644 --- a/app/src/organisms/EmergencyStop/__tests__/EstopPressedModal.test.tsx +++ b/app/src/organisms/EmergencyStop/__tests__/EstopPressedModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import '@testing-library/jest-dom/vitest' import { describe, it, vi, beforeEach, expect } from 'vitest' @@ -10,18 +9,20 @@ import { getIsOnDevice } from '/app/redux/config' import { EstopPressedModal } from '../EstopPressedModal' import { usePlacePlateReaderLid } from '/app/resources/modules' +import type { ComponentProps } from 'react' + vi.mock('@opentrons/react-api-client') vi.mock('/app/redux/config') vi.mock('/app/resources/modules') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('EstopPressedModal - Touchscreen', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { @@ -85,7 +86,7 @@ describe('EstopPressedModal - Touchscreen', () => { }) describe('EstopPressedModal - Desktop', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/EmergencyStop/__tests__/EstopTakeover.test.tsx b/app/src/organisms/EmergencyStop/__tests__/EstopTakeover.test.tsx index 3ff0503dc69..4ffd822fb80 100644 --- a/app/src/organisms/EmergencyStop/__tests__/EstopTakeover.test.tsx +++ b/app/src/organisms/EmergencyStop/__tests__/EstopTakeover.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, beforeEach, expect, vi } from 'vitest' import { screen } from '@testing-library/react' import '@testing-library/jest-dom/vitest' @@ -19,6 +18,8 @@ import { getLocalRobot } from '/app/redux/discovery' import { mockConnectedRobot } from '/app/redux/discovery/__fixtures__' import { EstopTakeover } from '../EstopTakeover' +import type { ComponentProps } from 'react' + vi.mock('@opentrons/react-api-client') vi.mock('../EstopMissingModal') vi.mock('../EstopPressedModal') @@ -33,14 +34,14 @@ const mockPressed = { }, } -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('EstopTakeover', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/IgnoreErrorSkipStep.tsx b/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/IgnoreErrorSkipStep.tsx index 16cb755d4da..2f8f7016773 100644 --- a/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/IgnoreErrorSkipStep.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/IgnoreErrorSkipStep.tsx @@ -27,6 +27,7 @@ import { SkipStepInfo, } from '../shared' +import type { ChangeEvent } from 'react' import type { RecoveryContentProps } from '../types' export function IgnoreErrorSkipStep(props: RecoveryContentProps): JSX.Element { @@ -143,7 +144,7 @@ export function IgnoreErrorStepHome({ > ) => { + onChange={(e: ChangeEvent) => { setSelectedOption(e.currentTarget.value as IgnoreOption) }} options={IGNORE_OPTIONS_IN_ORDER.map(option => { diff --git a/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/CancelRun.test.tsx b/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/CancelRun.test.tsx index cbf8126e353..06923d65492 100644 --- a/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/CancelRun.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/CancelRun.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, describe, it, expect, beforeEach } from 'vitest' import { screen, waitFor } from '@testing-library/react' @@ -9,11 +8,13 @@ import { CancelRun } from '../CancelRun' import { RECOVERY_MAP } from '../../constants' import { SelectRecoveryOption } from '../SelectRecoveryOption' import { clickButtonLabeled } from '../../__tests__/util' + +import type { ComponentProps } from 'react' import type { Mock } from 'vitest' vi.mock('../SelectRecoveryOption') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] @@ -21,7 +22,7 @@ const render = (props: React.ComponentProps) => { describe('RecoveryFooterButtons', () => { const { CANCEL_RUN, ROBOT_CANCELING, DROP_TIP_FLOWS } = RECOVERY_MAP - let props: React.ComponentProps + let props: ComponentProps let mockGoBackPrevStep: Mock let mockhandleMotionRouting: Mock let mockProceedToRouteAndStep: Mock diff --git a/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/FillWellAndSkip.test.tsx b/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/FillWellAndSkip.test.tsx index 3c7675ec21c..6f0145a9ef3 100644 --- a/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/FillWellAndSkip.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/FillWellAndSkip.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, vi, expect, beforeEach } from 'vitest' import { screen, waitFor } from '@testing-library/react' @@ -11,6 +10,7 @@ import { CancelRun } from '../CancelRun' import { SelectRecoveryOption } from '../SelectRecoveryOption' import { clickButtonLabeled } from '../../__tests__/util' +import type { ComponentProps } from 'react' import type { Mock } from 'vitest' vi.mock('../../shared', async () => { @@ -32,28 +32,26 @@ vi.mock('../CancelRun') vi.mock('../SelectRecoveryOption') vi.mock('/app/molecules/Command') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } -const renderFillWell = (props: React.ComponentProps) => { +const renderFillWell = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } -const renderSkipToNextStep = ( - props: React.ComponentProps -) => { +const renderSkipToNextStep = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('FillWellAndSkip', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { @@ -118,7 +116,7 @@ describe('FillWellAndSkip', () => { }) describe('FillWell', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { @@ -136,7 +134,7 @@ describe('FillWell', () => { }) describe('SkipToNextStep', () => { - let props: React.ComponentProps + let props: ComponentProps let mockhandleMotionRouting: Mock let mockGoBackPrevStep: Mock let mockProceedToRouteAndStep: Mock diff --git a/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/HomeAndRetry.test.tsx b/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/HomeAndRetry.test.tsx index 3286041b7fb..aae543bc559 100644 --- a/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/HomeAndRetry.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/HomeAndRetry.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, vi, beforeEach, afterEach } from 'vitest' import { screen } from '@testing-library/react' @@ -10,17 +9,19 @@ import { SelectRecoveryOption } from '../SelectRecoveryOption' import { HomeAndRetry } from '../HomeAndRetry' import { TipSelection } from '../../shared/TipSelection' +import type { ComponentProps } from 'react' + vi.mock('../SelectRecoveryOption') vi.mock('../../shared/TipSelection') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('HomeAndRetry', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { ...mockRecoveryContentProps, diff --git a/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/IgnoreErrorSkipStep.test.tsx b/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/IgnoreErrorSkipStep.test.tsx index 547334f77c4..a1655ae57b2 100644 --- a/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/IgnoreErrorSkipStep.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/IgnoreErrorSkipStep.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, vi, expect, beforeEach } from 'vitest' import { screen, fireEvent, waitFor } from '@testing-library/react' @@ -15,6 +14,7 @@ import { SelectRecoveryOption } from '../SelectRecoveryOption' import { clickButtonLabeled } from '../../__tests__/util' import { SkipStepInfo } from '/app/organisms/ErrorRecoveryFlows/shared' +import type { ComponentProps } from 'react' import type { Mock } from 'vitest' vi.mock('/app/organisms/ErrorRecoveryFlows/shared', async () => { @@ -31,14 +31,14 @@ vi.mock('/app/organisms/ErrorRecoveryFlows/shared', async () => { }) vi.mock('../SelectRecoveryOption') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } const renderIgnoreErrorStepHome = ( - props: React.ComponentProps + props: ComponentProps ) => { return renderWithProviders(, { i18nInstance: i18n, @@ -46,7 +46,7 @@ const renderIgnoreErrorStepHome = ( } describe('IgnoreErrorSkipStep', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { @@ -98,7 +98,7 @@ describe('IgnoreErrorSkipStep', () => { }) describe('IgnoreErrorStepHome', () => { - let props: React.ComponentProps + let props: ComponentProps let mockIgnoreErrorKindThisRun: Mock let mockProceedToRouteAndStep: Mock let mockGoBackPrevStep: Mock @@ -184,7 +184,7 @@ describe('IgnoreErrorStepHome', () => { }) describe('IgnoreOptions', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/ManageTips.test.tsx b/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/ManageTips.test.tsx index 941b19081c7..b047f7a463b 100644 --- a/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/ManageTips.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/ManageTips.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, vi, expect, beforeEach } from 'vitest' import { screen, @@ -18,6 +17,7 @@ import { DT_ROUTES } from '/app/organisms/DropTipWizardFlows/constants' import { SelectRecoveryOption } from '../SelectRecoveryOption' import { clickButtonLabeled } from '../../__tests__/util' +import type { ComponentProps } from 'react' import type { Mock } from 'vitest' import type { PipetteModelSpecs } from '@opentrons/shared-data' @@ -34,14 +34,14 @@ const MOCK_ACTUAL_PIPETTE = { }, } as PipetteModelSpecs -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('ManageTips', () => { - let props: React.ComponentProps + let props: ComponentProps let mockProceedNextStep: Mock let mockProceedToRouteAndStep: Mock let mockhandleMotionRouting: Mock diff --git a/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/ManualMoveLwAndSkip.test.tsx b/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/ManualMoveLwAndSkip.test.tsx index 48f8615cf81..8cc5285e31a 100644 --- a/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/ManualMoveLwAndSkip.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/ManualMoveLwAndSkip.test.tsx @@ -6,7 +6,7 @@ import { i18n } from '/app/i18n' import { ManualMoveLwAndSkip } from '../ManualMoveLwAndSkip' import { RECOVERY_MAP } from '../../constants' -import type * as React from 'react' +import type { ComponentProps } from 'react' vi.mock('../../shared', () => ({ GripperIsHoldingLabware: vi.fn(() => ( @@ -23,7 +23,7 @@ vi.mock('../SelectRecoveryOption', () => ({ })) describe('ManualMoveLwAndSkip', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { @@ -34,7 +34,7 @@ describe('ManualMoveLwAndSkip', () => { } as any }) - const render = (props: React.ComponentProps) => { + const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] diff --git a/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/ManualReplaceLwAndRetry.test.tsx b/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/ManualReplaceLwAndRetry.test.tsx index fb47ccb5f2f..0d25fcda029 100644 --- a/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/ManualReplaceLwAndRetry.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/ManualReplaceLwAndRetry.test.tsx @@ -6,7 +6,7 @@ import { i18n } from '/app/i18n' import { ManualReplaceLwAndRetry } from '../ManualReplaceLwAndRetry' import { RECOVERY_MAP } from '../../constants' -import type * as React from 'react' +import type { ComponentProps } from 'react' vi.mock('../../shared', () => ({ GripperIsHoldingLabware: vi.fn(() => ( @@ -23,7 +23,7 @@ vi.mock('../SelectRecoveryOption', () => ({ })) describe('ManualReplaceLwAndRetry', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { @@ -35,9 +35,7 @@ describe('ManualReplaceLwAndRetry', () => { } as any }) - const render = ( - props: React.ComponentProps - ) => { + const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] diff --git a/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/RetryNewTips.test.tsx b/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/RetryNewTips.test.tsx index dcee4c10c56..cfd55c45d77 100644 --- a/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/RetryNewTips.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/RetryNewTips.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, vi, expect, beforeEach, afterEach } from 'vitest' import { screen, waitFor } from '@testing-library/react' @@ -10,6 +9,7 @@ import { RECOVERY_MAP } from '../../constants' import { SelectRecoveryOption } from '../SelectRecoveryOption' import { clickButtonLabeled } from '../../__tests__/util' +import type { ComponentProps } from 'react' import type { Mock } from 'vitest' vi.mock('/app/molecules/Command') @@ -23,14 +23,14 @@ vi.mock('../../shared', async () => { } }) -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } const renderRetryWithNewTips = ( - props: React.ComponentProps + props: ComponentProps ) => { return renderWithProviders(, { i18nInstance: i18n, @@ -38,7 +38,7 @@ const renderRetryWithNewTips = ( } describe('RetryNewTips', () => { - let props: React.ComponentProps + let props: ComponentProps let mockProceedToRouteAndStep: Mock beforeEach(() => { @@ -121,7 +121,7 @@ describe('RetryNewTips', () => { }) describe('RetryWithNewTips', () => { - let props: React.ComponentProps + let props: ComponentProps let mockhandleMotionRouting: Mock let mockRetryFailedCommand: Mock let mockResumeRun: Mock diff --git a/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/RetrySameTips.test.tsx b/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/RetrySameTips.test.tsx index 4514c9cc350..7457b50f824 100644 --- a/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/RetrySameTips.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/RetrySameTips.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, vi, expect, beforeEach, afterEach } from 'vitest' import { screen, waitFor } from '@testing-library/react' @@ -10,19 +9,20 @@ import { RECOVERY_MAP } from '../../constants' import { SelectRecoveryOption } from '../SelectRecoveryOption' import { clickButtonLabeled } from '../../__tests__/util' +import type { ComponentProps } from 'react' import type { Mock } from 'vitest' vi.mock('/app/molecules/Command') vi.mock('../SelectRecoveryOption') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } const renderRetrySameTipsInfo = ( - props: React.ComponentProps + props: ComponentProps ) => { return renderWithProviders(, { i18nInstance: i18n, @@ -30,7 +30,7 @@ const renderRetrySameTipsInfo = ( } describe('RetrySameTips', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { @@ -72,7 +72,7 @@ describe('RetrySameTips', () => { }) describe('RetrySameTipsInfo', () => { - let props: React.ComponentProps + let props: ComponentProps let mockhandleMotionRouting: Mock let mockRetryFailedCommand: Mock let mockResumeRun: Mock diff --git a/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/RetryStep.test.tsx b/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/RetryStep.test.tsx index ec39f5b7c18..f972275c224 100644 --- a/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/RetryStep.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/RetryStep.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, vi, beforeEach, afterEach } from 'vitest' import { screen } from '@testing-library/react' @@ -9,17 +8,19 @@ import { RetryStep } from '../RetryStep' import { RECOVERY_MAP } from '../../constants' import { SelectRecoveryOption } from '../SelectRecoveryOption' +import type { ComponentProps } from 'react' + vi.mock('/app/molecules/Command') vi.mock('../SelectRecoveryOption') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('RetryStep', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/SelectRecoveryOptions.test.tsx b/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/SelectRecoveryOptions.test.tsx index 62fe8eea3c8..caa67196866 100644 --- a/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/SelectRecoveryOptions.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/SelectRecoveryOptions.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, describe, it, expect, beforeEach } from 'vitest' import { screen, fireEvent } from '@testing-library/react' import { when } from 'vitest-when' @@ -23,10 +22,11 @@ import { import { RECOVERY_MAP, ERROR_KINDS } from '../../constants' import { clickButtonLabeled } from '../../__tests__/util' +import type { ComponentProps } from 'react' import type { Mock } from 'vitest' const renderSelectRecoveryOption = ( - props: React.ComponentProps + props: ComponentProps ) => { return renderWithProviders( , @@ -37,7 +37,7 @@ const renderSelectRecoveryOption = ( } const renderRecoveryOptions = ( - props: React.ComponentProps + props: ComponentProps ) => { return renderWithProviders(, { i18nInstance: i18n, @@ -45,7 +45,7 @@ const renderRecoveryOptions = ( } describe('SelectRecoveryOption', () => { const { RETRY_STEP, RETRY_NEW_TIPS } = RECOVERY_MAP - let props: React.ComponentProps + let props: ComponentProps let mockProceedToRouteAndStep: Mock let mockSetSelectedRecoveryOption: Mock let mockGetRecoveryOptionCopy: Mock @@ -253,7 +253,7 @@ describe('SelectRecoveryOption', () => { }) }) describe('RecoveryOptions', () => { - let props: React.ComponentProps + let props: ComponentProps let mockSetSelectedRoute: Mock let mockGetRecoveryOptionCopy: Mock diff --git a/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/SkipStepNewTips.test.tsx b/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/SkipStepNewTips.test.tsx index 09afa086dca..a492184cbc7 100644 --- a/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/SkipStepNewTips.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/SkipStepNewTips.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, vi, expect, beforeEach } from 'vitest' import { screen } from '@testing-library/react' @@ -9,6 +8,7 @@ import { SkipStepNewTips } from '../SkipStepNewTips' import { RECOVERY_MAP } from '../../constants' import { SelectRecoveryOption } from '../SelectRecoveryOption' +import type { ComponentProps } from 'react' import type { Mock } from 'vitest' vi.mock('/app/molecules/Command') @@ -23,14 +23,14 @@ vi.mock('../../shared', async () => { } }) -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('SkipStepNewTips', () => { - let props: React.ComponentProps + let props: ComponentProps let mockProceedToRouteAndStep: Mock beforeEach(() => { diff --git a/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/SkipStepSameTips.test.tsx b/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/SkipStepSameTips.test.tsx index 157825b3322..eb716694d68 100644 --- a/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/SkipStepSameTips.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/RecoveryOptions/__tests__/SkipStepSameTips.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, vi, beforeEach } from 'vitest' import { screen } from '@testing-library/react' @@ -10,18 +9,20 @@ import { RECOVERY_MAP } from '../../constants' import { SelectRecoveryOption } from '../SelectRecoveryOption' import { SkipStepInfo } from '/app/organisms/ErrorRecoveryFlows/shared' +import type { ComponentProps } from 'react' + vi.mock('/app/molecules/Command') vi.mock('/app/organisms/ErrorRecoveryFlows/shared') vi.mock('../SelectRecoveryOption') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('SkipStepSameTips', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ErrorRecoveryFlows/__tests__/ErrorRecoveryFlows.test.tsx b/app/src/organisms/ErrorRecoveryFlows/__tests__/ErrorRecoveryFlows.test.tsx index 2e425b73495..53bc8c15a8b 100644 --- a/app/src/organisms/ErrorRecoveryFlows/__tests__/ErrorRecoveryFlows.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/__tests__/ErrorRecoveryFlows.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, describe, expect, it, beforeEach } from 'vitest' import { screen, renderHook } from '@testing-library/react' @@ -24,6 +23,7 @@ import { useERWizard, ErrorRecoveryWizard } from '../ErrorRecoveryWizard' import { useRecoverySplash, RecoverySplash } from '../RecoverySplash' import { useRunLoadedLabwareDefinitionsByUri } from '/app/resources/runs' +import type { ComponentProps } from 'react' import type { RunStatus } from '@opentrons/api-client' vi.mock('../ErrorRecoveryWizard') @@ -128,14 +128,14 @@ describe('useErrorRecoveryFlows', () => { }) }) -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('ErrorRecoveryFlows', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ErrorRecoveryFlows/__tests__/ErrorRecoveryWizard.test.tsx b/app/src/organisms/ErrorRecoveryFlows/__tests__/ErrorRecoveryWizard.test.tsx index d97072e45f3..1f358fc574c 100644 --- a/app/src/organisms/ErrorRecoveryFlows/__tests__/ErrorRecoveryWizard.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/__tests__/ErrorRecoveryWizard.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, describe, it, expect, beforeEach } from 'vitest' import { renderHook, act, screen } from '@testing-library/react' @@ -35,6 +34,8 @@ import { RecoveryDoorOpenSpecial, } from '../shared' +import type { ComponentProps } from 'react' + vi.mock('../RecoveryOptions') vi.mock('../RecoveryInProgress') vi.mock('../RecoveryError') @@ -96,7 +97,7 @@ describe('useERWizard', () => { }) const renderRecoveryComponent = ( - props: React.ComponentProps + props: ComponentProps ) => { return renderWithProviders(, { i18nInstance: i18n, @@ -104,7 +105,7 @@ const renderRecoveryComponent = ( } describe('ErrorRecoveryComponent', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = mockRecoveryContentProps @@ -158,7 +159,7 @@ describe('ErrorRecoveryComponent', () => { }) const renderRecoveryContent = ( - props: React.ComponentProps + props: ComponentProps ) => { return renderWithProviders(, { i18nInstance: i18n, @@ -192,7 +193,7 @@ describe('ErrorRecoveryContent', () => { HOME_AND_RETRY, } = RECOVERY_MAP - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = mockRecoveryContentProps diff --git a/app/src/organisms/ErrorRecoveryFlows/__tests__/RecoveryDoorOpen.test.tsx b/app/src/organisms/ErrorRecoveryFlows/__tests__/RecoveryDoorOpen.test.tsx index a9fc92e1b84..57b0eff70a9 100644 --- a/app/src/organisms/ErrorRecoveryFlows/__tests__/RecoveryDoorOpen.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/__tests__/RecoveryDoorOpen.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, beforeEach, vi, expect } from 'vitest' import { screen } from '@testing-library/react' @@ -10,16 +9,17 @@ import { i18n } from '/app/i18n' import { RecoveryDoorOpen } from '../RecoveryDoorOpen' import { clickButtonLabeled } from './util' +import type { ComponentProps } from 'react' import type { Mock } from 'vitest' -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('RecoveryDoorOpen', () => { - let props: React.ComponentProps + let props: ComponentProps let mockResumeRecovery: Mock let mockProceedToRouteAndStep: Mock diff --git a/app/src/organisms/ErrorRecoveryFlows/__tests__/RecoveryError.test.tsx b/app/src/organisms/ErrorRecoveryFlows/__tests__/RecoveryError.test.tsx index f46f3f949ba..9d19b32d788 100644 --- a/app/src/organisms/ErrorRecoveryFlows/__tests__/RecoveryError.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/__tests__/RecoveryError.test.tsx @@ -1,5 +1,4 @@ /* eslint-disable testing-library/prefer-presence-queries */ -import type * as React from 'react' import { describe, it, vi, expect, beforeEach } from 'vitest' import { screen, fireEvent, waitFor } from '@testing-library/react' @@ -9,9 +8,10 @@ import { i18n } from '/app/i18n' import { RecoveryError } from '../RecoveryError' import { RECOVERY_MAP } from '../constants' +import type { ComponentProps } from 'react' import type { Mock } from 'vitest' -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] @@ -20,7 +20,7 @@ const render = (props: React.ComponentProps) => { const { ERROR_WHILE_RECOVERING } = RECOVERY_MAP describe('RecoveryError', () => { - let props: React.ComponentProps + let props: ComponentProps let proceedToRouteAndStepMock: Mock let getRecoverOptionCopyMock: Mock let handleMotionRoutingMock: Mock diff --git a/app/src/organisms/ErrorRecoveryFlows/__tests__/RecoveryInProgress.test.tsx b/app/src/organisms/ErrorRecoveryFlows/__tests__/RecoveryInProgress.test.tsx index 2dfa5711644..b9c6149a696 100644 --- a/app/src/organisms/ErrorRecoveryFlows/__tests__/RecoveryInProgress.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/__tests__/RecoveryInProgress.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { beforeEach, describe, it, vi, afterEach, expect } from 'vitest' import { act, renderHook, screen } from '@testing-library/react' @@ -12,7 +11,9 @@ import { } from '../RecoveryInProgress' import { RECOVERY_MAP } from '../constants' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] @@ -28,7 +29,7 @@ describe('RecoveryInProgress', () => { ROBOT_SKIPPING_STEP, ROBOT_RELEASING_LABWARE, } = RECOVERY_MAP - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ErrorRecoveryFlows/__tests__/RecoverySplash.test.tsx b/app/src/organisms/ErrorRecoveryFlows/__tests__/RecoverySplash.test.tsx index 901ab22e158..17b7f9fd24d 100644 --- a/app/src/organisms/ErrorRecoveryFlows/__tests__/RecoverySplash.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/__tests__/RecoverySplash.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { MemoryRouter } from 'react-router-dom' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { fireEvent, screen, waitFor, renderHook } from '@testing-library/react' @@ -21,6 +20,7 @@ import { StepInfo } from '../shared' import { useToaster } from '../../ToasterOven' import { clickButtonLabeled } from './util' +import type { ComponentProps, FunctionComponent, ReactNode } from 'react' import type { Store } from 'redux' vi.mock('/app/redux/config') @@ -30,7 +30,7 @@ vi.mock('../../ToasterOven') const store: Store = createStore(vi.fn(), {}) describe('useRunPausedSplash', () => { - let wrapper: React.FunctionComponent<{ children: React.ReactNode }> + let wrapper: FunctionComponent<{ children: ReactNode }> beforeEach(() => { vi.mocked(getIsOnDevice).mockReturnValue(true) const queryClient = new QueryClient() @@ -65,7 +65,7 @@ describe('useRunPausedSplash', () => { }) }) -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders( @@ -77,7 +77,7 @@ const render = (props: React.ComponentProps) => { } describe('RecoverySplash', () => { - let props: React.ComponentProps + let props: ComponentProps const mockToggleERWiz = vi.fn(() => Promise.resolve()) const mockProceedToRouteAndStep = vi.fn() const mockHandleMotionRouting = vi.fn(() => Promise.resolve()) diff --git a/app/src/organisms/ErrorRecoveryFlows/__tests__/RecoveryTakeover.test.tsx b/app/src/organisms/ErrorRecoveryFlows/__tests__/RecoveryTakeover.test.tsx index 1eec7782713..6a71c84ba3c 100644 --- a/app/src/organisms/ErrorRecoveryFlows/__tests__/RecoveryTakeover.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/__tests__/RecoveryTakeover.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, vi, expect, beforeEach } from 'vitest' import { screen } from '@testing-library/react' @@ -14,18 +13,19 @@ import { RecoveryTakeover, RecoveryTakeoverDesktop } from '../RecoveryTakeover' import { useUpdateClientDataRecovery } from '/app/resources/client_data' import { clickButtonLabeled } from './util' +import type { ComponentProps } from 'react' import type { Mock } from 'vitest' vi.mock('/app/resources/client_data') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('RecoveryTakeover', () => { - let props: React.ComponentProps + let props: ComponentProps let mockClearClientData: Mock beforeEach(() => { @@ -91,7 +91,7 @@ describe('RecoveryTakeover', () => { }) describe('RecoveryTakeoverDesktop', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ErrorRecoveryFlows/hooks/__tests__/useRecoveryOptionCopy.test.tsx b/app/src/organisms/ErrorRecoveryFlows/hooks/__tests__/useRecoveryOptionCopy.test.tsx index 11e8a574246..0ec262c3f41 100644 --- a/app/src/organisms/ErrorRecoveryFlows/hooks/__tests__/useRecoveryOptionCopy.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/hooks/__tests__/useRecoveryOptionCopy.test.tsx @@ -1,5 +1,3 @@ -import type * as React from 'react' - import { describe, it } from 'vitest' import { screen } from '@testing-library/react' @@ -10,6 +8,8 @@ import type { ErrorKind, RecoveryRoute } from '../../types' import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' +import type { ComponentProps } from 'react' + function MockRenderCmpt({ route, errorKind, @@ -26,7 +26,7 @@ function MockRenderCmpt({ ) } -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] diff --git a/app/src/organisms/ErrorRecoveryFlows/hooks/__tests__/useRecoveryToasts.test.tsx b/app/src/organisms/ErrorRecoveryFlows/hooks/__tests__/useRecoveryToasts.test.tsx index 085551f42e7..1ce852e86aa 100644 --- a/app/src/organisms/ErrorRecoveryFlows/hooks/__tests__/useRecoveryToasts.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/hooks/__tests__/useRecoveryToasts.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, describe, it, expect, beforeEach } from 'vitest' import { I18nextProvider } from 'react-i18next' import { i18n } from '/app/i18n' @@ -16,6 +15,7 @@ import { RECOVERY_MAP } from '../../constants' import { useToaster } from '../../../ToasterOven' import { useCommandTextString } from '/app/local-resources/commands' +import type { ReactElement } from 'react' import type { Mock } from 'vitest' import type { BuildToast } from '../useRecoveryToasts' @@ -42,7 +42,7 @@ const DEFAULT_PROPS: BuildToast = { } // Utility function for rendering with I18nextProvider -const renderWithI18n = (component: React.ReactElement) => { +const renderWithI18n = (component: ReactElement) => { return render({component}) } diff --git a/app/src/organisms/ErrorRecoveryFlows/shared/LeftColumnLabwareInfo.tsx b/app/src/organisms/ErrorRecoveryFlows/shared/LeftColumnLabwareInfo.tsx index 87cdac57255..c6fa3623cf4 100644 --- a/app/src/organisms/ErrorRecoveryFlows/shared/LeftColumnLabwareInfo.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/shared/LeftColumnLabwareInfo.tsx @@ -1,11 +1,11 @@ import { InterventionContent } from '/app/molecules/InterventionModal/InterventionContent' -import type * as React from 'react' +import type { ComponentProps } from 'react' import type { RecoveryContentProps } from '../types' type LeftColumnLabwareInfoProps = RecoveryContentProps & { title: string - type: React.ComponentProps['infoProps']['type'] + type: ComponentProps['infoProps']['type'] /* Renders a warning InlineNotification if provided. */ bannerText?: string } @@ -24,7 +24,7 @@ export function LeftColumnLabwareInfo({ } = failedLabwareUtils const { displayNameNewLoc, displayNameCurrentLoc } = failedLabwareLocations - const buildNewLocation = (): React.ComponentProps< + const buildNewLocation = (): ComponentProps< typeof InterventionContent >['infoProps']['newLocationProps'] => displayNameNewLoc != null diff --git a/app/src/organisms/ErrorRecoveryFlows/shared/RecoveryContentWrapper.tsx b/app/src/organisms/ErrorRecoveryFlows/shared/RecoveryContentWrapper.tsx index 9274079897f..d7c2abd900f 100644 --- a/app/src/organisms/ErrorRecoveryFlows/shared/RecoveryContentWrapper.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/shared/RecoveryContentWrapper.tsx @@ -1,7 +1,6 @@ // TODO: replace this by making these props true of interventionmodal content wrappers // once error recovery uses interventionmodal consistently -import type * as React from 'react' import { css } from 'styled-components' import { DIRECTION_COLUMN, @@ -18,19 +17,21 @@ import { } from '/app/molecules/InterventionModal' import { RecoveryFooterButtons } from './RecoveryFooterButtons' +import type { ComponentProps, ReactNode } from 'react' + interface SingleColumnContentWrapperProps { - children: React.ReactNode - footerDetails?: React.ComponentProps + children: ReactNode + footerDetails?: ComponentProps } interface TwoColumnContentWrapperProps { - children: [React.ReactNode, React.ReactNode] - footerDetails?: React.ComponentProps + children: [ReactNode, ReactNode] + footerDetails?: ComponentProps } interface OneOrTwoColumnContentWrapperProps { - children: [React.ReactNode, React.ReactNode] - footerDetails?: React.ComponentProps + children: [ReactNode, ReactNode] + footerDetails?: ComponentProps } // For flex-direction: column recovery content with one column only. export function RecoverySingleColumnContentWrapper({ diff --git a/app/src/organisms/ErrorRecoveryFlows/shared/RecoveryInterventionModal.tsx b/app/src/organisms/ErrorRecoveryFlows/shared/RecoveryInterventionModal.tsx index 82974023805..73ac8497deb 100644 --- a/app/src/organisms/ErrorRecoveryFlows/shared/RecoveryInterventionModal.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/shared/RecoveryInterventionModal.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { createPortal } from 'react-dom' import { css } from 'styled-components' @@ -13,11 +12,12 @@ import { import { InterventionModal } from '/app/molecules/InterventionModal' import { getModalPortalEl, getTopPortalEl } from '/app/App/portal' +import type { ComponentProps } from 'react' import type { ModalType } from '/app/molecules/InterventionModal' import type { DesktopSizeType } from '../types' export type RecoveryInterventionModalProps = Omit< - React.ComponentProps, + ComponentProps, 'type' > & { /* If on desktop, specifies the hard-coded dimensions height of the modal. */ diff --git a/app/src/organisms/ErrorRecoveryFlows/shared/StepInfo.tsx b/app/src/organisms/ErrorRecoveryFlows/shared/StepInfo.tsx index bbc12ce0429..ba68ee88507 100644 --- a/app/src/organisms/ErrorRecoveryFlows/shared/StepInfo.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/shared/StepInfo.tsx @@ -1,11 +1,10 @@ -import type * as React from 'react' - import { useTranslation } from 'react-i18next' import { Flex, DISPLAY_INLINE, StyledText } from '@opentrons/components' import { CommandText } from '/app/molecules/Command' +import type { ComponentProps } from 'react' import type { StyleProps } from '@opentrons/components' import type { RecoveryContentProps } from '../types' @@ -15,8 +14,8 @@ interface StepInfoProps extends StyleProps { robotType: RecoveryContentProps['robotType'] protocolAnalysis: RecoveryContentProps['protocolAnalysis'] allRunDefs: RecoveryContentProps['allRunDefs'] - desktopStyle?: React.ComponentProps['desktopStyle'] - oddStyle?: React.ComponentProps['oddStyle'] + desktopStyle?: ComponentProps['desktopStyle'] + oddStyle?: ComponentProps['oddStyle'] } export function StepInfo({ diff --git a/app/src/organisms/ErrorRecoveryFlows/shared/TwoColLwInfoAndDeck.tsx b/app/src/organisms/ErrorRecoveryFlows/shared/TwoColLwInfoAndDeck.tsx index 9bf8f12bc22..ad7ac489d7c 100644 --- a/app/src/organisms/ErrorRecoveryFlows/shared/TwoColLwInfoAndDeck.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/shared/TwoColLwInfoAndDeck.tsx @@ -1,9 +1,9 @@ import { - Flex, - MoveLabwareOnDeck, COLORS, - Module, + Flex, LabwareRender, + Module, + MoveLabwareOnDeck, } from '@opentrons/components' import { inferModuleOrientationFromXCoordinate } from '@opentrons/shared-data' @@ -14,7 +14,7 @@ import { RecoveryFooterButtons } from './RecoveryFooterButtons' import { LeftColumnLabwareInfo } from './LeftColumnLabwareInfo' import { RECOVERY_MAP } from '../constants' -import type * as React from 'react' +import type { ComponentProps } from 'react' import type { RecoveryContentProps } from '../types' import type { InterventionContent } from '/app/molecules/InterventionModal/InterventionContent' @@ -100,7 +100,7 @@ export function TwoColLwInfoAndDeck( } } - const buildType = (): React.ComponentProps< + const buildType = (): ComponentProps< typeof InterventionContent >['infoProps']['type'] => { switch (selectedRecoveryOption) { diff --git a/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/ErrorDetailsModal.test.tsx b/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/ErrorDetailsModal.test.tsx index ce754df9cfa..da76c3e09d9 100644 --- a/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/ErrorDetailsModal.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/ErrorDetailsModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, beforeEach, expect, vi } from 'vitest' import { screen, act, renderHook } from '@testing-library/react' @@ -17,6 +16,8 @@ import { StallErrorBanner, } from '../ErrorDetailsModal' +import type { ComponentProps } from 'react' + vi.mock('react-dom', () => ({ ...vi.importActual('react-dom'), createPortal: vi.fn((element, container) => element), @@ -47,14 +48,14 @@ describe('useErrorDetailsModal', () => { }) }) -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('ErrorDetailsModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/GripperIsHoldingLabware.test.tsx b/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/GripperIsHoldingLabware.test.tsx index 95af112fa58..adedca04009 100644 --- a/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/GripperIsHoldingLabware.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/GripperIsHoldingLabware.test.tsx @@ -10,13 +10,12 @@ import { GripperIsHoldingLabware, HOLDING_LABWARE_OPTIONS, } from '../GripperIsHoldingLabware' +import { RECOVERY_MAP } from '/app/organisms/ErrorRecoveryFlows/constants' +import type { ComponentProps } from 'react' import type { Mock } from 'vitest' -import { RECOVERY_MAP } from '/app/organisms/ErrorRecoveryFlows/constants' -const render = ( - props: React.ComponentProps -) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] @@ -26,7 +25,7 @@ let mockProceedToRouteAndStep: Mock let mockProceedNextStep: Mock describe('GripperIsHoldingLabware', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { mockProceedToRouteAndStep = vi.fn(() => Promise.resolve()) mockProceedNextStep = vi.fn(() => Promise.resolve()) diff --git a/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/GripperReleaseLabware.test.tsx b/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/GripperReleaseLabware.test.tsx index 3bdd9f97819..91fdc3d6a9e 100644 --- a/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/GripperReleaseLabware.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/GripperReleaseLabware.test.tsx @@ -7,20 +7,21 @@ import { i18n } from '/app/i18n' import { mockRecoveryContentProps } from '/app/organisms/ErrorRecoveryFlows/__fixtures__' import { clickButtonLabeled } from '/app/organisms/ErrorRecoveryFlows/__tests__/util' +import type { ComponentProps } from 'react' import type { Mock } from 'vitest' vi.mock('/app/assets/videos/error-recovery/Gripper_Release.webm', () => ({ default: 'mocked-animation-path.webm', })) -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('GripperReleaseLabware', () => { - let props: React.ComponentProps + let props: ComponentProps let mockHandleMotionRouting: Mock beforeEach(() => { diff --git a/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/LeftColumnLabwareInfo.test.tsx b/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/LeftColumnLabwareInfo.test.tsx index f38e1e06922..c8ab8bc4ad6 100644 --- a/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/LeftColumnLabwareInfo.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/LeftColumnLabwareInfo.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, beforeEach, expect, vi } from 'vitest' import { screen } from '@testing-library/react' @@ -8,16 +7,18 @@ import { i18n } from '/app/i18n' import { LeftColumnLabwareInfo } from '../LeftColumnLabwareInfo' import { InterventionContent } from '/app/molecules/InterventionModal/InterventionContent' +import type { ComponentProps } from 'react' + vi.mock('/app/molecules/InterventionModal/InterventionContent') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('LeftColumnLabwareInfo', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/RecoveryDoorOpenSpecial.test.tsx b/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/RecoveryDoorOpenSpecial.test.tsx index 5cc4ae74b87..b54ccc649d7 100644 --- a/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/RecoveryDoorOpenSpecial.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/RecoveryDoorOpenSpecial.test.tsx @@ -11,11 +11,11 @@ import { i18n } from '/app/i18n' import { RecoveryDoorOpenSpecial } from '../RecoveryDoorOpenSpecial' import { RECOVERY_MAP } from '../../constants' -import type * as React from 'react' +import type { ComponentProps } from 'react' import { clickButtonLabeled } from '/app/organisms/ErrorRecoveryFlows/__tests__/util' describe('RecoveryDoorOpenSpecial', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { @@ -39,9 +39,7 @@ describe('RecoveryDoorOpenSpecial', () => { } as any }) - const render = ( - props: React.ComponentProps - ) => { + const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] diff --git a/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/RecoveryFooterButtons.test.tsx b/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/RecoveryFooterButtons.test.tsx index 6381d2b579a..6643dcf8021 100644 --- a/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/RecoveryFooterButtons.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/RecoveryFooterButtons.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, describe, it, expect, beforeEach } from 'vitest' import { screen, fireEvent } from '@testing-library/react' @@ -8,16 +7,17 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { RecoveryFooterButtons } from '../RecoveryFooterButtons' +import type { ComponentProps } from 'react' import type { Mock } from 'vitest' -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('RecoveryFooterButtons', () => { - let props: React.ComponentProps + let props: ComponentProps let mockPrimaryBtnOnClick: Mock let mockSecondaryBtnOnClick: Mock let mockTertiaryBtnOnClick: Mock diff --git a/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/RetryStepInfo.test.tsx b/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/RetryStepInfo.test.tsx index 94f77910657..810cf1c00f1 100644 --- a/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/RetryStepInfo.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/RetryStepInfo.test.tsx @@ -7,10 +7,11 @@ import { RetryStepInfo } from '../RetryStepInfo' import { ERROR_KINDS, RECOVERY_MAP } from '../../constants' import { clickButtonLabeled } from '/app/organisms/ErrorRecoveryFlows/__tests__/util' +import type { ComponentProps } from 'react' import type { Mock } from 'vitest' describe('RetryStepInfo', () => { - let props: React.ComponentProps + let props: ComponentProps let mockHandleMotionRouting: Mock let mockRetryFailedCommand: Mock let mockResumeRun: Mock @@ -33,7 +34,7 @@ describe('RetryStepInfo', () => { } as any }) - const render = (props: React.ComponentProps) => { + const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] diff --git a/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/SelectTips.test.tsx b/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/SelectTips.test.tsx index 08db6269c4d..425bf68b264 100644 --- a/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/SelectTips.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/SelectTips.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, vi, expect, beforeEach } from 'vitest' import { screen, fireEvent, waitFor } from '@testing-library/react' @@ -9,19 +8,20 @@ import { SelectTips } from '../SelectTips' import { RECOVERY_MAP } from '../../constants' import { TipSelectionModal } from '../TipSelectionModal' +import type { ComponentProps } from 'react' import type { Mock } from 'vitest' vi.mock('../TipSelectionModal') vi.mock('../TipSelection') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('SelectTips', () => { - let props: React.ComponentProps + let props: ComponentProps let mockGoBackPrevStep: Mock let mockhandleMotionRouting: Mock let mockProceedNextStep: Mock diff --git a/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/SkipStepInfo.test.tsx b/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/SkipStepInfo.test.tsx index 28ef4177648..0bd7b1a5a72 100644 --- a/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/SkipStepInfo.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/SkipStepInfo.test.tsx @@ -7,10 +7,11 @@ import { SkipStepInfo } from '../SkipStepInfo' import { RECOVERY_MAP } from '../../constants' import { clickButtonLabeled } from '/app/organisms/ErrorRecoveryFlows/__tests__/util' +import type { ComponentProps } from 'react' import type { Mock } from 'vitest' describe('SkipStepInfo', () => { - let props: React.ComponentProps + let props: ComponentProps let mockHandleMotionRouting: Mock let mockSkipFailedCommand: Mock @@ -32,7 +33,7 @@ describe('SkipStepInfo', () => { } as any }) - const render = (props: React.ComponentProps) => { + const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] diff --git a/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/StepInfo.test.tsx b/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/StepInfo.test.tsx index d6fbb50c345..aefd143aee1 100644 --- a/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/StepInfo.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/StepInfo.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, expect, beforeEach, vi } from 'vitest' import { screen } from '@testing-library/react' @@ -8,16 +7,18 @@ import { i18n } from '/app/i18n' import { StepInfo } from '../StepInfo' import { CommandText } from '/app/molecules/Command' +import type { ComponentProps } from 'react' + vi.mock('/app/molecules/Command') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('StepInfo', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/TipSelection.test.tsx b/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/TipSelection.test.tsx index 9df7f8e02ec..c6bee4f8d55 100644 --- a/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/TipSelection.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/TipSelection.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, vi, expect, beforeEach } from 'vitest' import { screen } from '@testing-library/react' @@ -8,16 +7,18 @@ import { i18n } from '/app/i18n' import { TipSelection } from '../TipSelection' import { WellSelection } from '../../../WellSelection' +import type { ComponentProps } from 'react' + vi.mock('../../../WellSelection') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('TipSelection', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { ...mockRecoveryContentProps, diff --git a/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/TipSelectionModal.test.tsx b/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/TipSelectionModal.test.tsx index fed5a44d4ce..32711ec9762 100644 --- a/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/TipSelectionModal.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/TipSelectionModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, vi, beforeEach, expect } from 'vitest' import { screen } from '@testing-library/react' @@ -8,16 +7,18 @@ import { i18n } from '/app/i18n' import { TipSelectionModal } from '../TipSelectionModal' import { TipSelection } from '../TipSelection' +import type { ComponentProps } from 'react' + vi.mock('../TipSelection') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('TipSelectionModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/TwoColLwInfoAndDeck.test.tsx b/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/TwoColLwInfoAndDeck.test.tsx index 0629038f800..e151cb11d7a 100644 --- a/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/TwoColLwInfoAndDeck.test.tsx +++ b/app/src/organisms/ErrorRecoveryFlows/shared/__tests__/TwoColLwInfoAndDeck.test.tsx @@ -11,7 +11,7 @@ import { RECOVERY_MAP } from '../../constants' import { LeftColumnLabwareInfo } from '../LeftColumnLabwareInfo' import { getSlotNameAndLwLocFrom } from '../../hooks/useDeckMapUtils' -import type * as React from 'react' +import type { ComponentProps } from 'react' import type { Mock } from 'vitest' vi.mock('@opentrons/components', async () => { @@ -26,14 +26,14 @@ vi.mock('../../hooks/useDeckMapUtils') let mockProceedNextStep: Mock -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('TwoColLwInfoAndDeck', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { mockProceedNextStep = vi.fn() diff --git a/app/src/organisms/FirmwareUpdateModal/__tests__/FirmwareUpdateModal.test.tsx b/app/src/organisms/FirmwareUpdateModal/__tests__/FirmwareUpdateModal.test.tsx index bb205f3f852..16aa35ec87d 100644 --- a/app/src/organisms/FirmwareUpdateModal/__tests__/FirmwareUpdateModal.test.tsx +++ b/app/src/organisms/FirmwareUpdateModal/__tests__/FirmwareUpdateModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { act, screen, waitFor } from '@testing-library/react' import { describe, it, vi, beforeEach, expect } from 'vitest' import '@testing-library/jest-dom/vitest' @@ -10,6 +9,8 @@ import { } from '@opentrons/react-api-client' import { i18n } from '/app/i18n' import { FirmwareUpdateModal } from '..' + +import type { ComponentProps } from 'react' import type { BadPipette, PipetteData, @@ -18,14 +19,14 @@ import type { vi.mock('@opentrons/react-api-client') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('FirmwareUpdateModal', () => { - let props: React.ComponentProps + let props: ComponentProps const refetch = vi.fn(() => Promise.resolve()) const updateSubsystem = vi.fn(() => Promise.resolve()) beforeEach(() => { diff --git a/app/src/organisms/FirmwareUpdateModal/__tests__/UpdateInProgressModal.test.tsx b/app/src/organisms/FirmwareUpdateModal/__tests__/UpdateInProgressModal.test.tsx index f2ce6047481..2e237468b3d 100644 --- a/app/src/organisms/FirmwareUpdateModal/__tests__/UpdateInProgressModal.test.tsx +++ b/app/src/organisms/FirmwareUpdateModal/__tests__/UpdateInProgressModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' import { screen } from '@testing-library/react' @@ -6,14 +5,16 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { UpdateInProgressModal } from '../UpdateInProgressModal' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('UpdateInProgressModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { subsystem: 'pipette_right', diff --git a/app/src/organisms/FirmwareUpdateModal/__tests__/UpdateNeededModal.test.tsx b/app/src/organisms/FirmwareUpdateModal/__tests__/UpdateNeededModal.test.tsx index 53c91223b47..eb8e1cdcc5b 100644 --- a/app/src/organisms/FirmwareUpdateModal/__tests__/UpdateNeededModal.test.tsx +++ b/app/src/organisms/FirmwareUpdateModal/__tests__/UpdateNeededModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, vi, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' import { renderWithProviders } from '/app/__testing-utils__' @@ -12,6 +11,7 @@ import { UpdateNeededModal } from '../UpdateNeededModal' import { UpdateInProgressModal } from '../UpdateInProgressModal' import { UpdateResultsModal } from '../UpdateResultsModal' +import type { ComponentProps } from 'react' import type { BadPipette, SubsystemUpdateProgressData, @@ -21,14 +21,14 @@ vi.mock('@opentrons/react-api-client') vi.mock('../UpdateInProgressModal') vi.mock('../UpdateResultsModal') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('UpdateNeededModal', () => { - let props: React.ComponentProps + let props: ComponentProps const refetch = vi.fn(() => Promise.resolve()) const updateSubsystem = vi.fn(() => Promise.resolve({ diff --git a/app/src/organisms/FirmwareUpdateModal/__tests__/UpdateResultsModal.test.tsx b/app/src/organisms/FirmwareUpdateModal/__tests__/UpdateResultsModal.test.tsx index 29c5233db45..5c4f3f02473 100644 --- a/app/src/organisms/FirmwareUpdateModal/__tests__/UpdateResultsModal.test.tsx +++ b/app/src/organisms/FirmwareUpdateModal/__tests__/UpdateResultsModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, vi, beforeEach, expect } from 'vitest' import '@testing-library/jest-dom/vitest' @@ -6,14 +5,16 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { UpdateResultsModal } from '../UpdateResultsModal' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('UpdateResultsModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { isSuccess: true, diff --git a/app/src/organisms/GripperWizardFlows/MovePin.tsx b/app/src/organisms/GripperWizardFlows/MovePin.tsx index 1cf5153eaa5..b4cb6ebcf25 100644 --- a/app/src/organisms/GripperWizardFlows/MovePin.tsx +++ b/app/src/organisms/GripperWizardFlows/MovePin.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useTranslation, Trans } from 'react-i18next' import { EXTENSION } from '@opentrons/shared-data' import { @@ -25,6 +24,7 @@ import movePinRearToStorage from '/app/assets/videos/gripper-wizards/PIN_FROM_RE import calibratingFrontJaw from '/app/assets/videos/gripper-wizards/CALIBRATING_FRONT_JAW.webm' import calibratingRearJaw from '/app/assets/videos/gripper-wizards/CALIBRATING_REAR_JAW.webm' +import type { ReactNode } from 'react' import type { Coordinates } from '@opentrons/shared-data' import type { CreateMaintenanceCommand } from '/app/resources/runs' import type { GripperWizardStepProps, MovePinStep } from './types' @@ -137,10 +137,10 @@ export const MovePin = (props: MovePinProps): JSX.Element | null => { [m in typeof movement]: { inProgressText: string header: string - body: React.ReactNode + body: ReactNode buttonText: string - prepImage: React.ReactNode - inProgressImage?: React.ReactNode + prepImage: ReactNode + inProgressImage?: ReactNode } } = { [MOVE_PIN_TO_FRONT_JAW]: { diff --git a/app/src/organisms/GripperWizardFlows/__tests__/BeforeBeginning.test.tsx b/app/src/organisms/GripperWizardFlows/__tests__/BeforeBeginning.test.tsx index 888e6ba30b2..da3b45eec62 100644 --- a/app/src/organisms/GripperWizardFlows/__tests__/BeforeBeginning.test.tsx +++ b/app/src/organisms/GripperWizardFlows/__tests__/BeforeBeginning.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen, waitFor } from '@testing-library/react' import { describe, it, vi, beforeEach, expect } from 'vitest' import { renderWithProviders } from '/app/__testing-utils__' @@ -8,15 +7,17 @@ import { RUN_ID_1 } from '/app/resources/runs/__fixtures__' import { BeforeBeginning } from '../BeforeBeginning' import { GRIPPER_FLOW_TYPES } from '../constants' +import type { ComponentProps } from 'react' + vi.mock('/app/molecules/InProgressModal/InProgressModal') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('BeforeBeginning', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { goBack: vi.fn(), diff --git a/app/src/organisms/GripperWizardFlows/__tests__/ExitConfirmation.test.tsx b/app/src/organisms/GripperWizardFlows/__tests__/ExitConfirmation.test.tsx index 4b20f234bfb..871a58d1ba9 100644 --- a/app/src/organisms/GripperWizardFlows/__tests__/ExitConfirmation.test.tsx +++ b/app/src/organisms/GripperWizardFlows/__tests__/ExitConfirmation.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, vi, expect } from 'vitest' import { renderWithProviders } from '/app/__testing-utils__' @@ -7,12 +6,14 @@ import { i18n } from '/app/i18n' import { ExitConfirmation } from '../ExitConfirmation' import { GRIPPER_FLOW_TYPES } from '../constants' +import type { ComponentProps } from 'react' + describe('ExitConfirmation', () => { const mockBack = vi.fn() const mockExit = vi.fn() const render = ( - props: Partial> = {} + props: Partial> = {} ) => { return renderWithProviders( { let mockChainRunCommands: any let mockSetErrorMessage: any - const render = ( - props: Partial> = {} - ) => { + const render = (props: Partial> = {}) => { return renderWithProviders( { @@ -25,9 +26,7 @@ describe('MovePin', () => { const mockSetFrontJawOffset = vi.fn() const mockRunId = 'fakeRunId' - const render = ( - props: Partial> = {} - ) => { + const render = (props: Partial> = {}) => { return renderWithProviders( { const mockProceed = vi.fn() - const render = ( - props: Partial> = {} - ) => { + const render = (props: Partial> = {}) => { return renderWithProviders( { let mockChainRunCommands: any let mockSetErrorMessage: any const render = ( - props: Partial> = {} + props: Partial> = {} ) => { return renderWithProviders( { when(useIsFlex).calledWith('otie').thenReturn(isFlex) - return ( - props: React.ComponentProps - ) => { + return (props: ComponentProps) => { return renderWithProviders( , { @@ -26,7 +25,7 @@ const getRenderer = (isFlex: boolean) => { } describe('IncompatibleModuleDesktopModalBody', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { modules: [], diff --git a/app/src/organisms/IncompatibleModule/__tests__/IncompatibleModuleODDModalBody.test.tsx b/app/src/organisms/IncompatibleModule/__tests__/IncompatibleModuleODDModalBody.test.tsx index e2d4e1a2af0..9c59e9a821a 100644 --- a/app/src/organisms/IncompatibleModule/__tests__/IncompatibleModuleODDModalBody.test.tsx +++ b/app/src/organisms/IncompatibleModule/__tests__/IncompatibleModuleODDModalBody.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { screen } from '@testing-library/react' import { describe, it, beforeEach, expect } from 'vitest' import '@testing-library/jest-dom/vitest' @@ -7,8 +6,10 @@ import { i18n } from '/app/i18n' import { IncompatibleModuleODDModalBody } from '../IncompatibleModuleODDModalBody' import * as Fixtures from '../__fixtures__' +import type { ComponentProps } from 'react' + const render = ( - props: React.ComponentProps + props: ComponentProps ) => { return renderWithProviders(, { i18nInstance: i18n, @@ -16,7 +17,7 @@ const render = ( } describe('IncompatibleModuleODDModalBody', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { modules: [], diff --git a/app/src/organisms/IncompatibleModule/__tests__/IncompatibleModuleTakeover.test.tsx b/app/src/organisms/IncompatibleModule/__tests__/IncompatibleModuleTakeover.test.tsx index d3da5d17958..24e35265621 100644 --- a/app/src/organisms/IncompatibleModule/__tests__/IncompatibleModuleTakeover.test.tsx +++ b/app/src/organisms/IncompatibleModule/__tests__/IncompatibleModuleTakeover.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { screen } from '@testing-library/react' import { describe, it, beforeEach, afterEach, expect, vi } from 'vitest' import { when } from 'vitest-when' @@ -18,6 +17,8 @@ import { } from '/app/App/portal' import * as Fixtures from '../__fixtures__' +import type { ComponentProps } from 'react' + vi.mock('../hooks') vi.mock('../IncompatibleModuleODDModalBody') vi.mock('../IncompatibleModuleDesktopModalBody') @@ -32,7 +33,7 @@ const getRenderer = (incompatibleModules: AttachedModule[]) => { vi.mocked(IncompatibleModuleDesktopModalBody).mockReturnValue(
        TEST ELEMENT DESKTOP
        ) - return (props: React.ComponentProps) => { + return (props: ComponentProps) => { const [rendered] = renderWithProviders( <> @@ -55,7 +56,7 @@ const getRenderer = (incompatibleModules: AttachedModule[]) => { } describe('IncompatibleModuleTakeover', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { isOnDevice: true } }) diff --git a/app/src/organisms/IncompatibleModule/hooks/__tests__/useIncompatibleModulesAttached.test.tsx b/app/src/organisms/IncompatibleModule/hooks/__tests__/useIncompatibleModulesAttached.test.tsx index 7e1a7342db1..c58d75c7b6d 100644 --- a/app/src/organisms/IncompatibleModule/hooks/__tests__/useIncompatibleModulesAttached.test.tsx +++ b/app/src/organisms/IncompatibleModule/hooks/__tests__/useIncompatibleModulesAttached.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { QueryClient, QueryClientProvider } from 'react-query' import { vi, it, expect, describe, beforeEach } from 'vitest' @@ -8,16 +7,17 @@ import { useIncompatibleModulesAttached } from '..' import * as Fixtures from '../__fixtures__' +import type { FunctionComponent, ReactNode } from 'react' import type { Modules } from '@opentrons/api-client' import type { UseQueryResult } from 'react-query' vi.mock('@opentrons/react-api-client') describe('useIncompatibleModulesAttached', () => { - let wrapper: React.FunctionComponent<{ children: React.ReactNode }> + let wrapper: FunctionComponent<{ children: ReactNode }> beforeEach(() => { const queryClient = new QueryClient() - const clientProvider: React.FunctionComponent<{ - children: React.ReactNode + const clientProvider: FunctionComponent<{ + children: ReactNode }> = ({ children }) => ( {children} ) diff --git a/app/src/organisms/InterventionModal/__tests__/InterventionCommandMesage.test.tsx b/app/src/organisms/InterventionModal/__tests__/InterventionCommandMesage.test.tsx index 6f3a688b808..a09994c929d 100644 --- a/app/src/organisms/InterventionModal/__tests__/InterventionCommandMesage.test.tsx +++ b/app/src/organisms/InterventionModal/__tests__/InterventionCommandMesage.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { screen } from '@testing-library/react' import { describe, it, expect } from 'vitest' import { renderWithProviders } from '/app/__testing-utils__' @@ -10,16 +9,16 @@ import { truncatedCommandMessage, } from '../__fixtures__' -const render = ( - props: React.ComponentProps -) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('InterventionCommandMessage', () => { - let props: React.ComponentProps + let props: ComponentProps it('truncates command text greater than 220 characters long', () => { props = { commandMessage: longCommandMessage } diff --git a/app/src/organisms/InterventionModal/__tests__/InterventionCommandMessage.test.tsx b/app/src/organisms/InterventionModal/__tests__/InterventionCommandMessage.test.tsx index 6f3a688b808..a09994c929d 100644 --- a/app/src/organisms/InterventionModal/__tests__/InterventionCommandMessage.test.tsx +++ b/app/src/organisms/InterventionModal/__tests__/InterventionCommandMessage.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { screen } from '@testing-library/react' import { describe, it, expect } from 'vitest' import { renderWithProviders } from '/app/__testing-utils__' @@ -10,16 +9,16 @@ import { truncatedCommandMessage, } from '../__fixtures__' -const render = ( - props: React.ComponentProps -) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('InterventionCommandMessage', () => { - let props: React.ComponentProps + let props: ComponentProps it('truncates command text greater than 220 characters long', () => { props = { commandMessage: longCommandMessage } diff --git a/app/src/organisms/InterventionModal/__tests__/InterventionModal.test.tsx b/app/src/organisms/InterventionModal/__tests__/InterventionModal.test.tsx index 59b8c659a1a..bb4799e1754 100644 --- a/app/src/organisms/InterventionModal/__tests__/InterventionModal.test.tsx +++ b/app/src/organisms/InterventionModal/__tests__/InterventionModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, renderHook, screen } from '@testing-library/react' import { describe, it, expect, vi, beforeEach } from 'vitest' @@ -18,6 +17,7 @@ import { import { InterventionModal, useInterventionModal } from '..' import { useIsFlex } from '/app/redux-resources/robots' +import type { ComponentProps } from 'react' import type { CompletedProtocolAnalysis } from '@opentrons/shared-data' import type { RunData } from '@opentrons/api-client' @@ -90,14 +90,14 @@ describe('useInterventionModal', () => { }) }) -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('InterventionModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { robotName: ROBOT_NAME, diff --git a/app/src/organisms/LegacyApplyHistoricOffsets/__tests__/ApplyHistoricOffsets.test.tsx b/app/src/organisms/LegacyApplyHistoricOffsets/__tests__/ApplyHistoricOffsets.test.tsx index db70b1c096d..fb39565b161 100644 --- a/app/src/organisms/LegacyApplyHistoricOffsets/__tests__/ApplyHistoricOffsets.test.tsx +++ b/app/src/organisms/LegacyApplyHistoricOffsets/__tests__/ApplyHistoricOffsets.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, vi } from 'vitest' @@ -10,6 +9,7 @@ import { getIsLabwareOffsetCodeSnippetsOn } from '/app/redux/config' import { getLabwareDefinitionsFromCommands } from '/app/local-resources/labware' import { LegacyApplyHistoricOffsets } from '..' +import type { ComponentProps } from 'react' import type { LabwareDefinition2 } from '@opentrons/shared-data' import type { OffsetCandidate } from '../hooks/useOffsetCandidatesForAnalysis' @@ -64,11 +64,9 @@ const mockFourthCandidate: OffsetCandidate = { describe('ApplyHistoricOffsets', () => { const mockSetShouldApplyOffsets = vi.fn() const render = ( - props?: Partial> + props?: Partial> ) => - renderWithProviders< - React.ComponentProps - >( + renderWithProviders>( - renderWithProviders>( + renderWithProviders>( { ) it('returns historical run details with newest first', async () => { - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) =>
        {children}
        const { result } = renderHook(useHistoricRunDetails, { wrapper }) @@ -57,7 +57,7 @@ describe('useHistoricRunDetails', () => { links: {}, }) ) - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) =>
        {children}
        const { result } = renderHook( diff --git a/app/src/organisms/LegacyApplyHistoricOffsets/hooks/__tests__/useOffsetCandidatesForAnalysis.test.tsx b/app/src/organisms/LegacyApplyHistoricOffsets/hooks/__tests__/useOffsetCandidatesForAnalysis.test.tsx index 832417cb9af..b4581abe15e 100644 --- a/app/src/organisms/LegacyApplyHistoricOffsets/hooks/__tests__/useOffsetCandidatesForAnalysis.test.tsx +++ b/app/src/organisms/LegacyApplyHistoricOffsets/hooks/__tests__/useOffsetCandidatesForAnalysis.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, expect, vi, beforeEach } from 'vitest' import { when } from 'vitest-when' import { renderHook, waitFor } from '@testing-library/react' @@ -13,6 +12,7 @@ import { getLabwareLocationCombos } from '../getLabwareLocationCombos' import { useOffsetCandidatesForAnalysis } from '../useOffsetCandidatesForAnalysis' import { storedProtocolData as storedProtocolDataFixture } from '/app/redux/protocol-storage/__fixtures__' +import type { FunctionComponent, ReactNode } from 'react' import type { LabwareDefinition2 } from '@opentrons/shared-data' import type { OffsetCandidate } from '../useOffsetCandidatesForAnalysis' @@ -102,7 +102,7 @@ describe('useOffsetCandidatesForAnalysis', () => { }) it('returns an empty array if robot ip but no analysis output', async () => { - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) =>
        {children}
        const { result } = renderHook( @@ -115,7 +115,7 @@ describe('useOffsetCandidatesForAnalysis', () => { }) it('returns an empty array if no robot ip', async () => { - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) =>
        {children}
        const { result } = renderHook( @@ -131,7 +131,7 @@ describe('useOffsetCandidatesForAnalysis', () => { }) }) it('returns candidates for each first match with newest first', async () => { - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) =>
        {children}
        const { result } = renderHook( diff --git a/app/src/organisms/LegacyLabwarePositionCheck/PrepareSpace.tsx b/app/src/organisms/LegacyLabwarePositionCheck/PrepareSpace.tsx index 8820acfef33..f77973cbc1f 100644 --- a/app/src/organisms/LegacyLabwarePositionCheck/PrepareSpace.tsx +++ b/app/src/organisms/LegacyLabwarePositionCheck/PrepareSpace.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import styled, { css } from 'styled-components' import { useTranslation } from 'react-i18next' import { useSelector } from 'react-redux' @@ -23,6 +22,7 @@ import { SmallButton } from '/app/atoms/buttons' import { NeedHelpLink } from '/app/molecules/OT2CalibrationNeedHelpLink' import { useNotifyDeckConfigurationQuery } from '/app/resources/deck_configuration' +import type { ReactNode } from 'react' import type { CompletedProtocolAnalysis, LabwareDefinition2, @@ -61,8 +61,8 @@ interface PrepareSpaceProps extends Omit { labwareDef: LabwareDefinition2 protocolData: CompletedProtocolAnalysis confirmPlacement: () => void - header: React.ReactNode - body: React.ReactNode + header: ReactNode + body: ReactNode robotType: RobotType } export const PrepareSpace = (props: PrepareSpaceProps): JSX.Element | null => { diff --git a/app/src/organisms/LegacyLabwarePositionCheck/TwoUpTileLayout.tsx b/app/src/organisms/LegacyLabwarePositionCheck/TwoUpTileLayout.tsx index 7c6cd309bb4..396d49d5150 100644 --- a/app/src/organisms/LegacyLabwarePositionCheck/TwoUpTileLayout.tsx +++ b/app/src/organisms/LegacyLabwarePositionCheck/TwoUpTileLayout.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import styled, { css } from 'styled-components' import { DIRECTION_COLUMN, @@ -12,6 +11,8 @@ import { DISPLAY_INLINE_BLOCK, } from '@opentrons/components' +import type { ReactNode } from 'react' + const Title = styled.h1` ${TYPOGRAPHY.h1Default}; margin-bottom: ${SPACING.spacing8}; @@ -36,11 +37,11 @@ export interface TwoUpTileLayoutProps { /** main header text on left half */ title: string /** paragraph text below title on left half */ - body: React.ReactNode + body: ReactNode /** entire contents of the right half */ - rightElement: React.ReactNode + rightElement: ReactNode /** footer underneath both halves of content */ - footer: React.ReactNode + footer: ReactNode } export function TwoUpTileLayout(props: TwoUpTileLayoutProps): JSX.Element { diff --git a/app/src/organisms/LegacyLabwarePositionCheck/__tests__/CheckItem.test.tsx b/app/src/organisms/LegacyLabwarePositionCheck/__tests__/CheckItem.test.tsx index 17442dfc42b..5c2907c5276 100644 --- a/app/src/organisms/LegacyLabwarePositionCheck/__tests__/CheckItem.test.tsx +++ b/app/src/organisms/LegacyLabwarePositionCheck/__tests__/CheckItem.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, vi, beforeEach, afterEach, expect } from 'vitest' @@ -15,6 +14,7 @@ import { CheckItem } from '../CheckItem' import { SECTIONS } from '../constants' import { mockCompletedAnalysis, mockExistingOffsets } from '../__fixtures__' +import type { ComponentProps } from 'react' import type { Mock } from 'vitest' vi.mock('/app/redux/config') @@ -23,14 +23,14 @@ vi.mock('../../Desktop/Devices/hooks') const mockStartPosition = { x: 10, y: 20, z: 30 } const mockEndPosition = { x: 9, y: 19, z: 29 } -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('CheckItem', () => { - let props: React.ComponentProps + let props: ComponentProps let mockChainRunCommands: Mock beforeEach(() => { diff --git a/app/src/organisms/LegacyLabwarePositionCheck/__tests__/ExitConfirmation.test.tsx b/app/src/organisms/LegacyLabwarePositionCheck/__tests__/ExitConfirmation.test.tsx index 6a93da71dc5..e710c991ccb 100644 --- a/app/src/organisms/LegacyLabwarePositionCheck/__tests__/ExitConfirmation.test.tsx +++ b/app/src/organisms/LegacyLabwarePositionCheck/__tests__/ExitConfirmation.test.tsx @@ -1,18 +1,19 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, beforeEach, afterEach, expect, vi } from 'vitest' import { ExitConfirmation } from '../ExitConfirmation' import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('ExitConfirmation', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/LegacyLabwarePositionCheck/__tests__/PickUpTip.test.tsx b/app/src/organisms/LegacyLabwarePositionCheck/__tests__/PickUpTip.test.tsx index c23e1c1af2c..286e6f5f095 100644 --- a/app/src/organisms/LegacyLabwarePositionCheck/__tests__/PickUpTip.test.tsx +++ b/app/src/organisms/LegacyLabwarePositionCheck/__tests__/PickUpTip.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen, waitFor } from '@testing-library/react' import { it, describe, beforeEach, vi, afterEach, expect } from 'vitest' import { FLEX_ROBOT_TYPE, HEATERSHAKER_MODULE_V1 } from '@opentrons/shared-data' @@ -8,23 +7,25 @@ import { getIsOnDevice } from '/app/redux/config' import { PickUpTip } from '../PickUpTip' import { SECTIONS } from '../constants' import { mockCompletedAnalysis, mockExistingOffsets } from '../__fixtures__' -import type { CommandData } from '@opentrons/api-client' import { nestedTextMatcher, renderWithProviders } from '/app/__testing-utils__' + +import type { ComponentProps } from 'react' import type { Mock } from 'vitest' +import type { CommandData } from '@opentrons/api-client' vi.mock('/app/resources/protocols') vi.mock('/app/redux/config') const mockStartPosition = { x: 10, y: 20, z: 30 } -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('PickUpTip', () => { - let props: React.ComponentProps + let props: ComponentProps let mockChainRunCommands: Mock beforeEach(() => { diff --git a/app/src/organisms/LegacyLabwarePositionCheck/__tests__/ResultsSummary.test.tsx b/app/src/organisms/LegacyLabwarePositionCheck/__tests__/ResultsSummary.test.tsx index 24101904de4..30a29496aaf 100644 --- a/app/src/organisms/LegacyLabwarePositionCheck/__tests__/ResultsSummary.test.tsx +++ b/app/src/organisms/LegacyLabwarePositionCheck/__tests__/ResultsSummary.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, beforeEach, afterEach, expect, vi } from 'vitest' import { fireEvent, screen } from '@testing-library/react' import { i18n } from '/app/i18n' @@ -13,16 +12,18 @@ import { mockWorkingOffsets, } from '../__fixtures__' +import type { ComponentProps } from 'react' + vi.mock('/app/redux/config') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('ResultsSummary', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/LegacyLabwarePositionCheck/__tests__/ReturnTip.test.tsx b/app/src/organisms/LegacyLabwarePositionCheck/__tests__/ReturnTip.test.tsx index 0af86097f9c..112be630a31 100644 --- a/app/src/organisms/LegacyLabwarePositionCheck/__tests__/ReturnTip.test.tsx +++ b/app/src/organisms/LegacyLabwarePositionCheck/__tests__/ReturnTip.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest' @@ -12,17 +11,19 @@ import { useProtocolMetadata } from '/app/resources/protocols' import { getIsOnDevice } from '/app/redux/config' import { ReturnTip } from '../ReturnTip' +import type { ComponentProps } from 'react' + vi.mock('/app/redux/config') vi.mock('/app/resources/protocols') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('ReturnTip', () => { - let props: React.ComponentProps + let props: ComponentProps let mockChainRunCommands beforeEach(() => { diff --git a/app/src/organisms/LegacyLabwarePositionCheck/__tests__/TipConfirmation.test.tsx b/app/src/organisms/LegacyLabwarePositionCheck/__tests__/TipConfirmation.test.tsx index 8f8878a7122..a262641fd84 100644 --- a/app/src/organisms/LegacyLabwarePositionCheck/__tests__/TipConfirmation.test.tsx +++ b/app/src/organisms/LegacyLabwarePositionCheck/__tests__/TipConfirmation.test.tsx @@ -1,18 +1,19 @@ -import type * as React from 'react' import { describe, it, beforeEach, afterEach, expect, vi } from 'vitest' import { fireEvent, screen } from '@testing-library/react' import { TipConfirmation } from '../TipConfirmation' import { i18n } from '/app/i18n' import { renderWithProviders } from '/app/__testing-utils__' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('TipConfirmation', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/LegacyLabwarePositionCheck/__tests__/useLaunchLPC.test.tsx b/app/src/organisms/LegacyLabwarePositionCheck/__tests__/useLaunchLPC.test.tsx index 070931ee998..83613b0d778 100644 --- a/app/src/organisms/LegacyLabwarePositionCheck/__tests__/useLaunchLPC.test.tsx +++ b/app/src/organisms/LegacyLabwarePositionCheck/__tests__/useLaunchLPC.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { Provider } from 'react-redux' import configureStore from 'redux-mock-store' import { when } from 'vitest-when' @@ -27,6 +26,7 @@ import { import { useLaunchLegacyLPC } from '../useLaunchLegacyLPC' import { LegacyLabwarePositionCheck } from '..' +import type { FunctionComponent, ReactNode } from 'react' import type { Mock } from 'vitest' import type { LabwareOffset } from '@opentrons/api-client' import type { LabwareDefinition2 } from '@opentrons/shared-data' @@ -57,7 +57,7 @@ const mockCurrentOffsets: LabwareOffset[] = [ const mockLabwareDef = fixtureTiprack300ul as LabwareDefinition2 describe('useLaunchLPC hook', () => { - let wrapper: React.FunctionComponent<{ children: React.ReactNode }> + let wrapper: FunctionComponent<{ children: ReactNode }> let mockCreateMaintenanceRun: Mock let mockCreateLabwareDefinition: Mock let mockDeleteMaintenanceRun: Mock diff --git a/app/src/organisms/LiquidsLabwareDetailsModal/LiquidDetailCard.tsx b/app/src/organisms/LiquidsLabwareDetailsModal/LiquidDetailCard.tsx index cb1591dc72f..7dc33069500 100644 --- a/app/src/organisms/LiquidsLabwareDetailsModal/LiquidDetailCard.tsx +++ b/app/src/organisms/LiquidsLabwareDetailsModal/LiquidDetailCard.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useSelector } from 'react-redux' import { css } from 'styled-components' import { @@ -27,6 +26,8 @@ import { import { getIsOnDevice } from '/app/redux/config' import { getWellRangeForLiquidLabwarePair } from '/app/transformations/analysis' +import type { Dispatch, SetStateAction } from 'react' + export const CARD_OUTLINE_BORDER_STYLE = css` border-style: ${BORDERS.styleSolid}; border-width: 1px; @@ -56,7 +57,7 @@ interface LiquidDetailCardProps { description: string | null displayColor: string volumeByWell: { [well: string]: number } - setSelectedValue: React.Dispatch> + setSelectedValue: Dispatch> selectedValue: string | undefined labwareWellOrdering: string[][] } diff --git a/app/src/organisms/LiquidsLabwareDetailsModal/__tests__/LiquidDetailCard.test.tsx b/app/src/organisms/LiquidsLabwareDetailsModal/__tests__/LiquidDetailCard.test.tsx index a96c8128897..522fae501b1 100644 --- a/app/src/organisms/LiquidsLabwareDetailsModal/__tests__/LiquidDetailCard.test.tsx +++ b/app/src/organisms/LiquidsLabwareDetailsModal/__tests__/LiquidDetailCard.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, beforeEach, vi, expect } from 'vitest' @@ -12,12 +11,14 @@ import { } from '/app/redux/analytics' import { getIsOnDevice } from '/app/redux/config' import { LiquidDetailCard } from '../LiquidDetailCard' + +import type { ComponentProps } from 'react' import type { Mock } from 'vitest' vi.mock('/app/redux/analytics') vi.mock('/app/redux/config') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] @@ -25,7 +26,7 @@ const render = (props: React.ComponentProps) => { let mockTrackEvent: Mock describe('LiquidDetailCard', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { mockTrackEvent = vi.fn() diff --git a/app/src/organisms/LiquidsLabwareDetailsModal/__tests__/LiquidsLabwareDetailsModal.test.tsx b/app/src/organisms/LiquidsLabwareDetailsModal/__tests__/LiquidsLabwareDetailsModal.test.tsx index 967a840ee75..e70756ed3f3 100644 --- a/app/src/organisms/LiquidsLabwareDetailsModal/__tests__/LiquidsLabwareDetailsModal.test.tsx +++ b/app/src/organisms/LiquidsLabwareDetailsModal/__tests__/LiquidsLabwareDetailsModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, beforeEach, vi, afterEach, expect } from 'vitest' import { screen } from '@testing-library/react' @@ -21,6 +20,7 @@ import { import { LiquidsLabwareDetailsModal } from '../LiquidsLabwareDetailsModal' import { LiquidDetailCard } from '../LiquidDetailCard' +import type { ComponentProps } from 'react' import type * as Components from '@opentrons/components' import type * as SharedData from '@opentrons/shared-data' @@ -44,16 +44,14 @@ vi.mock('/app/transformations/commands') vi.mock('/app/transformations/analysis') vi.mock('../LiquidDetailCard') -const render = ( - props: React.ComponentProps -) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('LiquidsLabwareDetailsModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { window.HTMLElement.prototype.scrollIntoView = function () {} props = { diff --git a/app/src/organisms/LocationConflictModal/__tests__/LocationConflictModal.test.tsx b/app/src/organisms/LocationConflictModal/__tests__/LocationConflictModal.test.tsx index 207caa02a1b..1d72ae1b858 100644 --- a/app/src/organisms/LocationConflictModal/__tests__/LocationConflictModal.test.tsx +++ b/app/src/organisms/LocationConflictModal/__tests__/LocationConflictModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { MemoryRouter } from 'react-router-dom' import { screen, fireEvent } from '@testing-library/react' import '@testing-library/jest-dom/vitest' @@ -21,6 +20,7 @@ import { useCloseCurrentRun } from '/app/resources/runs' import { LocationConflictModal } from '../LocationConflictModal' import { useNotifyDeckConfigurationQuery } from '/app/resources/deck_configuration' +import type { ComponentProps } from 'react' import type { UseQueryResult } from 'react-query' import type { DeckConfiguration } from '@opentrons/shared-data' @@ -33,7 +33,7 @@ const mockFixture = { cutoutFixtureId: STAGING_AREA_RIGHT_SLOT_FIXTURE, } -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders( @@ -45,7 +45,7 @@ const render = (props: React.ComponentProps) => { } describe('LocationConflictModal', () => { - let props: React.ComponentProps + let props: ComponentProps const mockUpdate = vi.fn() beforeEach(() => { props = { diff --git a/app/src/organisms/ModuleCard/Collapsible.tsx b/app/src/organisms/ModuleCard/Collapsible.tsx index cc15a88d4a0..00f032b52ef 100644 --- a/app/src/organisms/ModuleCard/Collapsible.tsx +++ b/app/src/organisms/ModuleCard/Collapsible.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { css } from 'styled-components' import { ALIGN_CENTER, @@ -13,13 +12,15 @@ import { } from '@opentrons/components' import type { IconName } from '@opentrons/components' +import type { ReactNode } from 'react' + interface CollapsibleProps { expanded: boolean - title: React.ReactNode + title: ReactNode expandedIcon?: IconName collapsedIcon?: IconName toggleExpanded: () => void - children: React.ReactNode + children: ReactNode } const EXPANDED_STYLE = css` diff --git a/app/src/organisms/ModuleCard/__tests__/AboutModuleSlideout.test.tsx b/app/src/organisms/ModuleCard/__tests__/AboutModuleSlideout.test.tsx index 35eb81ab169..e397eae0b50 100644 --- a/app/src/organisms/ModuleCard/__tests__/AboutModuleSlideout.test.tsx +++ b/app/src/organisms/ModuleCard/__tests__/AboutModuleSlideout.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' @@ -20,16 +19,18 @@ import { import { useCurrentRunStatus } from '/app/organisms/RunTimeControl' import { AboutModuleSlideout } from '../AboutModuleSlideout' +import type { ComponentProps } from 'react' + vi.mock('/app/organisms/RunTimeControl') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('AboutModuleSlideout', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { module: mockMagneticModule, diff --git a/app/src/organisms/ModuleCard/__tests__/Collapsible.test.tsx b/app/src/organisms/ModuleCard/__tests__/Collapsible.test.tsx index 3db479e3228..9ec5f2d0e1b 100644 --- a/app/src/organisms/ModuleCard/__tests__/Collapsible.test.tsx +++ b/app/src/organisms/ModuleCard/__tests__/Collapsible.test.tsx @@ -1,16 +1,17 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { renderWithProviders } from '/app/__testing-utils__' import { Collapsible } from '../Collapsible' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders()[0] } describe('Collapsible', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { expanded: false, diff --git a/app/src/organisms/ModuleCard/__tests__/ConfirmAttachmentModal.test.tsx b/app/src/organisms/ModuleCard/__tests__/ConfirmAttachmentModal.test.tsx index ccc81bcb167..6c4d41973da 100644 --- a/app/src/organisms/ModuleCard/__tests__/ConfirmAttachmentModal.test.tsx +++ b/app/src/organisms/ModuleCard/__tests__/ConfirmAttachmentModal.test.tsx @@ -1,18 +1,19 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { ConfirmAttachmentModal } from '../ConfirmAttachmentModal' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('ConfirmAttachmentBanner', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ModuleCard/__tests__/ErrorInfo.test.tsx b/app/src/organisms/ModuleCard/__tests__/ErrorInfo.test.tsx index bde80a0d7d2..2a93208d89e 100644 --- a/app/src/organisms/ModuleCard/__tests__/ErrorInfo.test.tsx +++ b/app/src/organisms/ModuleCard/__tests__/ErrorInfo.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { beforeEach, describe, expect, it } from 'vitest' import { renderWithProviders } from '/app/__testing-utils__' @@ -9,6 +8,8 @@ import { mockTemperatureModule, mockThermocycler, } from '/app/redux/modules/__fixtures__' + +import type { ComponentProps } from 'react' import type { HeaterShakerModule, ThermocyclerModule, @@ -71,14 +72,14 @@ const mockErrorHeaterShaker = { }, } as HeaterShakerModule -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('ErrorInfo', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { attachedModule: mockTemperatureModule, diff --git a/app/src/organisms/ModuleCard/__tests__/FirmwareUpdateFailedModal.test.tsx b/app/src/organisms/ModuleCard/__tests__/FirmwareUpdateFailedModal.test.tsx index 13395bcff69..f3eaa7dc0ed 100644 --- a/app/src/organisms/ModuleCard/__tests__/FirmwareUpdateFailedModal.test.tsx +++ b/app/src/organisms/ModuleCard/__tests__/FirmwareUpdateFailedModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { beforeEach, describe, expect, it, vi } from 'vitest' import { renderWithProviders } from '/app/__testing-utils__' @@ -6,16 +5,16 @@ import { i18n } from '/app/i18n' import { mockTemperatureModule } from '/app/redux/modules/__fixtures__' import { FirmwareUpdateFailedModal } from '../FirmwareUpdateFailedModal' -const render = ( - props: React.ComponentProps -) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('FirmwareUpdateFailedModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { onCloseClick: vi.fn(), diff --git a/app/src/organisms/ModuleCard/__tests__/HeaterShakerModuleData.test.tsx b/app/src/organisms/ModuleCard/__tests__/HeaterShakerModuleData.test.tsx index 348fdb614d4..dab6f1fc7ad 100644 --- a/app/src/organisms/ModuleCard/__tests__/HeaterShakerModuleData.test.tsx +++ b/app/src/organisms/ModuleCard/__tests__/HeaterShakerModuleData.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { screen } from '@testing-library/react' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { renderWithProviders } from '/app/__testing-utils__' @@ -6,16 +5,18 @@ import { i18n } from '/app/i18n' import { StatusLabel } from '/app/atoms/StatusLabel' import { HeaterShakerModuleData } from '../HeaterShakerModuleData' +import type { ComponentProps } from 'react' + vi.mock('/app/atoms/StatusLabel') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('HeaterShakerModuleData', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { moduleData: { diff --git a/app/src/organisms/ModuleCard/__tests__/HeaterShakerSlideout.test.tsx b/app/src/organisms/ModuleCard/__tests__/HeaterShakerSlideout.test.tsx index 883d5b6bb7c..b02e5205f42 100644 --- a/app/src/organisms/ModuleCard/__tests__/HeaterShakerSlideout.test.tsx +++ b/app/src/organisms/ModuleCard/__tests__/HeaterShakerSlideout.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' @@ -9,16 +8,18 @@ import { i18n } from '/app/i18n' import { mockHeaterShaker } from '/app/redux/modules/__fixtures__' import { HeaterShakerSlideout } from '../HeaterShakerSlideout' +import type { ComponentProps } from 'react' + vi.mock('@opentrons/react-api-client') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('HeaterShakerSlideout', () => { - let props: React.ComponentProps + let props: ComponentProps let mockCreateLiveCommand = vi.fn() beforeEach(() => { diff --git a/app/src/organisms/ModuleCard/__tests__/MagneticModuleData.test.tsx b/app/src/organisms/ModuleCard/__tests__/MagneticModuleData.test.tsx index b6534d233e3..0440b16b251 100644 --- a/app/src/organisms/ModuleCard/__tests__/MagneticModuleData.test.tsx +++ b/app/src/organisms/ModuleCard/__tests__/MagneticModuleData.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { screen } from '@testing-library/react' import { afterEach, beforeEach, describe, it, vi } from 'vitest' @@ -8,16 +7,18 @@ import { StatusLabel } from '/app/atoms/StatusLabel' import { MagneticModuleData } from '../MagneticModuleData' import { mockMagneticModule } from '/app/redux/modules/__fixtures__' +import type { ComponentProps } from 'react' + vi.mock('/app/atoms/StatusLabel') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('MagneticModuleData', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { moduleHeight: mockMagneticModule.data.height, diff --git a/app/src/organisms/ModuleCard/__tests__/MagneticModuleSlideout.test.tsx b/app/src/organisms/ModuleCard/__tests__/MagneticModuleSlideout.test.tsx index fa10546af90..c52817fb517 100644 --- a/app/src/organisms/ModuleCard/__tests__/MagneticModuleSlideout.test.tsx +++ b/app/src/organisms/ModuleCard/__tests__/MagneticModuleSlideout.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { COLORS } from '@opentrons/components' @@ -13,15 +12,17 @@ import { mockMagneticModuleGen2, } from '/app/redux/modules/__fixtures__' +import type { ComponentProps } from 'react' + vi.mock('@opentrons/react-api-client') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('MagneticModuleSlideout', () => { - let props: React.ComponentProps + let props: ComponentProps let mockCreateLiveCommand = vi.fn() beforeEach(() => { mockCreateLiveCommand = vi.fn() diff --git a/app/src/organisms/ModuleCard/__tests__/ModuleCard.test.tsx b/app/src/organisms/ModuleCard/__tests__/ModuleCard.test.tsx index d30a885b759..078dfe12ada 100644 --- a/app/src/organisms/ModuleCard/__tests__/ModuleCard.test.tsx +++ b/app/src/organisms/ModuleCard/__tests__/ModuleCard.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { when } from 'vitest-when' import { fireEvent, screen } from '@testing-library/react' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' @@ -29,12 +28,13 @@ import { FirmwareUpdateFailedModal } from '../FirmwareUpdateFailedModal' import { ErrorInfo } from '../ErrorInfo' import { ModuleCard } from '..' +import type { ComponentProps } from 'react' +import type { Mock } from 'vitest' import type { HeaterShakerModule, MagneticModule, ThermocyclerModule, } from '/app/redux/modules/types' -import type { Mock } from 'vitest' vi.mock('../ErrorInfo') vi.mock('../MagneticModuleData') @@ -175,14 +175,14 @@ const mockEatToast = vi.fn() const MOCK_LATEST_REQUEST_ID = '1234' -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('ModuleCard', () => { - let props: React.ComponentProps + let props: ComponentProps let mockHandleModuleApiRequests: Mock beforeEach(() => { diff --git a/app/src/organisms/ModuleCard/__tests__/ModuleOverflowMenu.test.tsx b/app/src/organisms/ModuleCard/__tests__/ModuleOverflowMenu.test.tsx index 75701934e36..6e54dee83f9 100644 --- a/app/src/organisms/ModuleCard/__tests__/ModuleOverflowMenu.test.tsx +++ b/app/src/organisms/ModuleCard/__tests__/ModuleOverflowMenu.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' @@ -16,13 +15,14 @@ import { useIsFlex } from '/app/redux-resources/robots' import { useCurrentRunId, useRunStatuses } from '/app/resources/runs' import { ModuleOverflowMenu } from '../ModuleOverflowMenu' +import type { ComponentProps } from 'react' import type { TemperatureStatus } from '@opentrons/api-client' vi.mock('/app/resources/legacy_sessions') vi.mock('/app/redux-resources/robots') vi.mock('/app/resources/runs') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] @@ -161,7 +161,7 @@ const mockThermocyclerGen2LidClosed = { } as any describe('ModuleOverflowMenu', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { vi.mocked(useIsLegacySessionInProgress).mockReturnValue(false) vi.mocked(useRunStatuses).mockReturnValue({ diff --git a/app/src/organisms/ModuleCard/__tests__/ModuleSetupModal.test.tsx b/app/src/organisms/ModuleCard/__tests__/ModuleSetupModal.test.tsx index 87f340b2845..1b3abfab5ce 100644 --- a/app/src/organisms/ModuleCard/__tests__/ModuleSetupModal.test.tsx +++ b/app/src/organisms/ModuleCard/__tests__/ModuleSetupModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { beforeEach, describe, expect, it, vi } from 'vitest' @@ -6,14 +5,16 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { ModuleSetupModal } from '../ModuleSetupModal' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('ModuleSetupModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { close: vi.fn(), moduleDisplayName: 'mockModuleDisplayName' } }) diff --git a/app/src/organisms/ModuleCard/__tests__/TemperatureModuleData.test.tsx b/app/src/organisms/ModuleCard/__tests__/TemperatureModuleData.test.tsx index 5b851ce5796..a9e2d88fb26 100644 --- a/app/src/organisms/ModuleCard/__tests__/TemperatureModuleData.test.tsx +++ b/app/src/organisms/ModuleCard/__tests__/TemperatureModuleData.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { screen } from '@testing-library/react' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' @@ -8,16 +7,18 @@ import { StatusLabel } from '/app/atoms/StatusLabel' import { TemperatureModuleData } from '../TemperatureModuleData' import { mockTemperatureModuleGen2 } from '/app/redux/modules/__fixtures__' +import type { ComponentProps } from 'react' + vi.mock('/app/atoms/StatusLabel') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('TemperatureModuleData', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { moduleStatus: mockTemperatureModuleGen2.data.status, diff --git a/app/src/organisms/ModuleCard/__tests__/TemperatureModuleSlideout.test.tsx b/app/src/organisms/ModuleCard/__tests__/TemperatureModuleSlideout.test.tsx index ce65306741d..12ecc39f2f1 100644 --- a/app/src/organisms/ModuleCard/__tests__/TemperatureModuleSlideout.test.tsx +++ b/app/src/organisms/ModuleCard/__tests__/TemperatureModuleSlideout.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' @@ -12,18 +11,18 @@ import { } from '/app/redux/modules/__fixtures__' import { TemperatureModuleSlideout } from '../TemperatureModuleSlideout' +import type { ComponentProps } from 'react' + vi.mock('@opentrons/react-api-client') -const render = ( - props: React.ComponentProps -) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('TemperatureModuleSlideout', () => { - let props: React.ComponentProps + let props: ComponentProps let mockCreateLiveCommand = vi.fn() beforeEach(() => { diff --git a/app/src/organisms/ModuleCard/__tests__/TestShakeSlideout.test.tsx b/app/src/organisms/ModuleCard/__tests__/TestShakeSlideout.test.tsx index f11816df8b6..865c656b1ed 100644 --- a/app/src/organisms/ModuleCard/__tests__/TestShakeSlideout.test.tsx +++ b/app/src/organisms/ModuleCard/__tests__/TestShakeSlideout.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen, waitFor } from '@testing-library/react' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' @@ -12,12 +11,14 @@ import { useLatchControls } from '../hooks' import { TestShakeSlideout } from '../TestShakeSlideout' import { ModuleSetupModal } from '../ModuleSetupModal' +import type { ComponentProps } from 'react' + vi.mock('/app/redux/config') vi.mock('@opentrons/react-api-client') vi.mock('../hooks') vi.mock('../ModuleSetupModal') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] @@ -90,7 +91,7 @@ const mockMovingHeaterShaker = { } as any describe('TestShakeSlideout', () => { - let props: React.ComponentProps + let props: ComponentProps let mockCreateLiveCommand = vi.fn() const mockToggleLatch = vi.fn() beforeEach(() => { diff --git a/app/src/organisms/ModuleCard/__tests__/ThermocyclerModuleData.test.tsx b/app/src/organisms/ModuleCard/__tests__/ThermocyclerModuleData.test.tsx index 0885c74bb5d..fc2346cf9ba 100644 --- a/app/src/organisms/ModuleCard/__tests__/ThermocyclerModuleData.test.tsx +++ b/app/src/organisms/ModuleCard/__tests__/ThermocyclerModuleData.test.tsx @@ -1,6 +1,4 @@ -import type * as React from 'react' import { screen } from '@testing-library/react' - import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { renderWithProviders } from '/app/__testing-utils__' @@ -11,9 +9,10 @@ import { } from '/app/redux/modules/__fixtures__' import { ThermocyclerModuleData } from '../ThermocyclerModuleData' +import type { ComponentProps } from 'react' import type { ThermocyclerData } from '/app/redux/modules/api-types' -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] @@ -49,7 +48,7 @@ const mockDataHeating = { } as ThermocyclerData describe('ThermocyclerModuleData', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { data: mockThermocycler.data, diff --git a/app/src/organisms/ModuleCard/__tests__/ThermocyclerModuleSlideout.test.tsx b/app/src/organisms/ModuleCard/__tests__/ThermocyclerModuleSlideout.test.tsx index d93a1b1f607..1557b821dd9 100644 --- a/app/src/organisms/ModuleCard/__tests__/ThermocyclerModuleSlideout.test.tsx +++ b/app/src/organisms/ModuleCard/__tests__/ThermocyclerModuleSlideout.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' @@ -9,18 +8,18 @@ import { i18n } from '/app/i18n' import { mockThermocycler } from '/app/redux/modules/__fixtures__' import { ThermocyclerModuleSlideout } from '../ThermocyclerModuleSlideout' +import type { ComponentProps } from 'react' + vi.mock('@opentrons/react-api-client') -const render = ( - props: React.ComponentProps -) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('ThermocyclerModuleSlideout', () => { - let props: React.ComponentProps + let props: ComponentProps let mockCreateLiveCommand = vi.fn() beforeEach(() => { mockCreateLiveCommand = vi.fn() diff --git a/app/src/organisms/ModuleCard/__tests__/hooks.test.tsx b/app/src/organisms/ModuleCard/__tests__/hooks.test.tsx index ce0f0450179..2fe0c5502ef 100644 --- a/app/src/organisms/ModuleCard/__tests__/hooks.test.tsx +++ b/app/src/organisms/ModuleCard/__tests__/hooks.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { Provider } from 'react-redux' import { when } from 'vitest-when' import { createStore } from 'redux' @@ -30,6 +29,7 @@ import { useIsHeaterShakerInProtocol, } from '../hooks' +import type { FunctionComponent, ReactNode } from 'react' import type { Store } from 'redux' import type { State } from '/app/redux/types' @@ -188,7 +188,7 @@ describe('useLatchControls', () => { }) it('should return latch is open and handle latch function and command to close latch', () => { - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) => ( @@ -212,7 +212,7 @@ describe('useLatchControls', () => { }) }) it('should return if latch is closed and handle latch function opens latch', () => { - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) => ( @@ -263,7 +263,7 @@ describe('useModuleOverflowMenu', () => { vi.restoreAllMocks() }) it('should return everything for menuItemsByModuleType and create deactive heater command', () => { - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) => ( @@ -304,7 +304,7 @@ describe('useModuleOverflowMenu', () => { const mockAboutClick = vi.fn() const mockTestShakeClick = vi.fn() const mockHandleWizard = vi.fn() - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) => ( @@ -336,7 +336,7 @@ describe('useModuleOverflowMenu', () => { it('should return only 1 menu button when module is a magnetic module and calls handleClick when module is disengaged', () => { const mockHandleClick = vi.fn() - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) => ( @@ -366,7 +366,7 @@ describe('useModuleOverflowMenu', () => { }) it('should render magnetic module and create disengage command', () => { - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) => ( @@ -404,7 +404,7 @@ describe('useModuleOverflowMenu', () => { it('should render temperature module and call handleClick when module is idle', () => { const mockHandleClick = vi.fn() - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) => ( @@ -433,7 +433,7 @@ describe('useModuleOverflowMenu', () => { }) it('should render temp module and create deactivate temp command', () => { - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) => ( @@ -470,7 +470,7 @@ describe('useModuleOverflowMenu', () => { it('should render TC module and call handleClick when module is idle', () => { const mockHandleClick = vi.fn() - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) => ( @@ -499,7 +499,7 @@ describe('useModuleOverflowMenu', () => { }) it('should render TC module and create open lid command', () => { - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) => ( @@ -537,7 +537,7 @@ describe('useModuleOverflowMenu', () => { }) it('should render TC module and create deactivate lid command', () => { - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) => ( @@ -575,7 +575,7 @@ describe('useModuleOverflowMenu', () => { }) it('should render TC module gen 2 and create a close lid command', () => { - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) => ( @@ -650,7 +650,7 @@ describe('useIsHeaterShakerInProtocol', () => { }) it('should return true when a heater shaker is in the protocol', () => { - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) => {children} const { result } = renderHook(useIsHeaterShakerInProtocol, { wrapper }) @@ -674,7 +674,7 @@ describe('useIsHeaterShakerInProtocol', () => { id, })), } as any) - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) => {children} const { result } = renderHook(useIsHeaterShakerInProtocol, { wrapper }) diff --git a/app/src/organisms/ODD/ChildNavigation/__tests__/ChildNavigation.test.tsx b/app/src/organisms/ODD/ChildNavigation/__tests__/ChildNavigation.test.tsx index 82a0dfb0b3c..44ff1414dd6 100644 --- a/app/src/organisms/ODD/ChildNavigation/__tests__/ChildNavigation.test.tsx +++ b/app/src/organisms/ODD/ChildNavigation/__tests__/ChildNavigation.test.tsx @@ -1,19 +1,20 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { vi, it, describe, expect, beforeEach } from 'vitest' import { renderWithProviders } from '/app/__testing-utils__' import { ChildNavigation } from '..' + +import type { ComponentProps } from 'react' import type { SmallButton } from '/app/atoms/buttons' -const render = (props: React.ComponentProps) => +const render = (props: ComponentProps) => renderWithProviders() const mockOnClickBack = vi.fn() const mockOnClickButton = vi.fn() const mockOnClickSecondaryButton = vi.fn() -const mockSecondaryButtonProps: React.ComponentProps = { +const mockSecondaryButtonProps: ComponentProps = { onClick: mockOnClickSecondaryButton, buttonText: 'Setup Instructions', buttonType: 'tertiaryLowLight', @@ -22,7 +23,7 @@ const mockSecondaryButtonProps: React.ComponentProps = { } describe('ChildNavigation', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/ChildNavigation/index.tsx b/app/src/organisms/ODD/ChildNavigation/index.tsx index ea6c72f293b..ff1ebed1c95 100644 --- a/app/src/organisms/ODD/ChildNavigation/index.tsx +++ b/app/src/organisms/ODD/ChildNavigation/index.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import styled from 'styled-components' import { @@ -21,6 +20,7 @@ import { ODD_FOCUS_VISIBLE } from '/app/atoms/buttons/constants' import { SmallButton } from '/app/atoms/buttons' import { InlineNotification } from '/app/atoms/InlineNotification' +import type { ComponentProps, MouseEventHandler, ReactNode } from 'react' import type { IconName, StyleProps } from '@opentrons/components' import type { InlineNotificationProps } from '/app/atoms/InlineNotification' import type { @@ -30,15 +30,15 @@ import type { interface ChildNavigationProps extends StyleProps { header: string - onClickBack?: React.MouseEventHandler - buttonText?: React.ReactNode + onClickBack?: MouseEventHandler + buttonText?: ReactNode inlineNotification?: InlineNotificationProps - onClickButton?: React.MouseEventHandler + onClickButton?: MouseEventHandler buttonType?: SmallButtonTypes buttonIsDisabled?: boolean iconName?: IconName iconPlacement?: IconPlacement - secondaryButtonProps?: React.ComponentProps + secondaryButtonProps?: ComponentProps ariaDisabled?: boolean } diff --git a/app/src/organisms/ODD/InstrumentInfo/__tests__/InstrumentInfo.test.tsx b/app/src/organisms/ODD/InstrumentInfo/__tests__/InstrumentInfo.test.tsx index a478716483d..ec8b55bb17a 100644 --- a/app/src/organisms/ODD/InstrumentInfo/__tests__/InstrumentInfo.test.tsx +++ b/app/src/organisms/ODD/InstrumentInfo/__tests__/InstrumentInfo.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, vi, beforeEach, expect } from 'vitest' import { renderWithProviders } from '/app/__testing-utils__' @@ -8,22 +7,23 @@ import { PipetteWizardFlows } from '/app/organisms/PipetteWizardFlows' import { GripperWizardFlows } from '/app/organisms/GripperWizardFlows' import { InstrumentInfo } from '..' +import type { ComponentProps } from 'react' +import type * as ReactRouterDom from 'react-router-dom' import type { GripperData } from '@opentrons/api-client' -import type * as Dom from 'react-router-dom' const mockNavigate = vi.fn() vi.mock('/app/organisms/PipetteWizardFlows') vi.mock('/app/organisms/GripperWizardFlows') vi.mock('react-router-dom', async importOriginal => { - const reactRouterDom = await importOriginal() + const reactRouterDom = await importOriginal() return { ...reactRouterDom, useNavigate: () => mockNavigate, } }) -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] @@ -65,7 +65,7 @@ const mockGripperDataWithCalData: GripperData = { } describe('InstrumentInfo', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { vi.mocked(PipetteWizardFlows).mockReturnValue(
        mock PipetteWizardFlows
        diff --git a/app/src/organisms/ODD/InstrumentMountItem/LabeledMount.tsx b/app/src/organisms/ODD/InstrumentMountItem/LabeledMount.tsx index 20fe3941604..c909e4768f0 100644 --- a/app/src/organisms/ODD/InstrumentMountItem/LabeledMount.tsx +++ b/app/src/organisms/ODD/InstrumentMountItem/LabeledMount.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useTranslation } from 'react-i18next' import styled from 'styled-components' import { @@ -15,6 +14,8 @@ import { TEXT_TRANSFORM_CAPITALIZE, TYPOGRAPHY, } from '@opentrons/components' + +import type { MouseEventHandler } from 'react' import type { Mount } from '/app/redux/pipettes/types' const MountButton = styled.button<{ isAttached: boolean }>` @@ -34,7 +35,7 @@ const MountButton = styled.button<{ isAttached: boolean }>` interface LabeledMountProps { mount: Mount | 'extension' instrumentName: string | null - handleClick: React.MouseEventHandler + handleClick: MouseEventHandler } export function LabeledMount(props: LabeledMountProps): JSX.Element { diff --git a/app/src/organisms/ODD/InstrumentMountItem/__tests__/ProtocolInstrumentMountItem.test.tsx b/app/src/organisms/ODD/InstrumentMountItem/__tests__/ProtocolInstrumentMountItem.test.tsx index 6c4c308b8d2..52c62382241 100644 --- a/app/src/organisms/ODD/InstrumentMountItem/__tests__/ProtocolInstrumentMountItem.test.tsx +++ b/app/src/organisms/ODD/InstrumentMountItem/__tests__/ProtocolInstrumentMountItem.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, vi, beforeEach } from 'vitest' import { renderWithProviders } from '/app/__testing-utils__' import { LEFT } from '@opentrons/shared-data' @@ -8,6 +7,8 @@ import { PipetteWizardFlows } from '/app/organisms/PipetteWizardFlows' import { GripperWizardFlows } from '/app/organisms/GripperWizardFlows' import { ProtocolInstrumentMountItem } from '..' +import type { ComponentProps } from 'react' + vi.mock('/app/organisms/PipetteWizardFlows') vi.mock('/app/organisms/GripperWizardFlows') vi.mock('../../TakeoverModal') @@ -51,16 +52,14 @@ const mockLeftPipetteData = { ok: true, } -const render = ( - props: React.ComponentProps -) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('ProtocolInstrumentMountItem', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { mount: LEFT, diff --git a/app/src/organisms/ODD/NameRobot/__tests__/ConfirmRobotName.test.tsx b/app/src/organisms/ODD/NameRobot/__tests__/ConfirmRobotName.test.tsx index d9e8521260e..21d34d3a59d 100644 --- a/app/src/organisms/ODD/NameRobot/__tests__/ConfirmRobotName.test.tsx +++ b/app/src/organisms/ODD/NameRobot/__tests__/ConfirmRobotName.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { MemoryRouter } from 'react-router-dom' import { fireEvent, screen } from '@testing-library/react' import { beforeEach, describe, expect, it, vi } from 'vitest' @@ -7,6 +6,7 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { ConfirmRobotName } from '../ConfirmRobotName' +import type { ComponentProps } from 'react' import type { NavigateFunction } from 'react-router-dom' const mockNavigate = vi.fn() @@ -19,7 +19,7 @@ vi.mock('react-router-dom', async importOriginal => { } }) -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders( @@ -31,7 +31,7 @@ const render = (props: React.ComponentProps) => { } describe('ConfirmRobotName', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { robotName: 'otie', diff --git a/app/src/organisms/ODD/Navigation/__tests__/Navigation.test.tsx b/app/src/organisms/ODD/Navigation/__tests__/Navigation.test.tsx index c86ba363d5c..1a212f83e46 100644 --- a/app/src/organisms/ODD/Navigation/__tests__/Navigation.test.tsx +++ b/app/src/organisms/ODD/Navigation/__tests__/Navigation.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { MemoryRouter } from 'react-router-dom' import { fireEvent, screen } from '@testing-library/react' import { beforeEach, describe, expect, it, vi } from 'vitest' @@ -12,6 +11,8 @@ import { NavigationMenu } from '../NavigationMenu' import { Navigation } from '..' import { useScrollPosition } from '/app/local-resources/dom-utils' +import type { ComponentProps } from 'react' + vi.mock('/app/resources/networking/hooks/useNetworkConnection') vi.mock('/app/redux/discovery') vi.mock('../NavigationMenu') @@ -19,7 +20,7 @@ vi.mock('/app/local-resources/dom-utils') mockConnectedRobot.name = '12345678901234567' -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders( @@ -29,7 +30,7 @@ const render = (props: React.ComponentProps) => { } describe('Navigation', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = {} vi.mocked(getLocalRobot).mockReturnValue(mockConnectedRobot) diff --git a/app/src/organisms/ODD/Navigation/__tests__/NavigationMenu.test.tsx b/app/src/organisms/ODD/Navigation/__tests__/NavigationMenu.test.tsx index b40122cdd6b..b4b70528cda 100644 --- a/app/src/organisms/ODD/Navigation/__tests__/NavigationMenu.test.tsx +++ b/app/src/organisms/ODD/Navigation/__tests__/NavigationMenu.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' @@ -9,6 +8,7 @@ import { useLights } from '/app/resources/devices' import { RestartRobotConfirmationModal } from '../RestartRobotConfirmationModal' import { NavigationMenu } from '../NavigationMenu' +import type { ComponentProps } from 'react' import type { NavigateFunction } from 'react-router-dom' vi.mock('/app/redux/robot-admin') @@ -27,14 +27,14 @@ vi.mock('react-router-dom', async importOriginal => { const mockToggleLights = vi.fn() -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('NavigationMenu', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { onClick: vi.fn(), diff --git a/app/src/organisms/ODD/Navigation/__tests__/RestartRobotConfirmationModal.test.tsx b/app/src/organisms/ODD/Navigation/__tests__/RestartRobotConfirmationModal.test.tsx index 8922a4225c2..5b3bc007567 100644 --- a/app/src/organisms/ODD/Navigation/__tests__/RestartRobotConfirmationModal.test.tsx +++ b/app/src/organisms/ODD/Navigation/__tests__/RestartRobotConfirmationModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { beforeEach, describe, expect, it, vi } from 'vitest' @@ -7,12 +6,14 @@ import { i18n } from '/app/i18n' import { restartRobot } from '/app/redux/robot-admin' import { RestartRobotConfirmationModal } from '../RestartRobotConfirmationModal' +import type { ComponentProps } from 'react' + vi.mock('/app/redux/robot-admin') const mockFunc = vi.fn() const render = ( - props: React.ComponentProps + props: ComponentProps ) => { return renderWithProviders(, { i18nInstance: i18n, @@ -20,7 +21,7 @@ const render = ( } describe('RestartRobotConfirmationModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/NetworkSettings/__tests__/AlternativeSecurityTypeModal.test.tsx b/app/src/organisms/ODD/NetworkSettings/__tests__/AlternativeSecurityTypeModal.test.tsx index a01af9bba66..2707b07a8f5 100644 --- a/app/src/organisms/ODD/NetworkSettings/__tests__/AlternativeSecurityTypeModal.test.tsx +++ b/app/src/organisms/ODD/NetworkSettings/__tests__/AlternativeSecurityTypeModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { beforeEach, describe, expect, it, vi } from 'vitest' @@ -6,6 +5,7 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { AlternativeSecurityTypeModal } from '../AlternativeSecurityTypeModal' +import type { ComponentProps } from 'react' import type { NavigateFunction } from 'react-router-dom' const mockFunc = vi.fn() @@ -18,16 +18,14 @@ vi.mock('react-router-dom', async importOriginal => { } }) -const render = ( - props: React.ComponentProps -) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('AlternativeSecurityTypeModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/NetworkSettings/__tests__/ConnectingNetwork.test.tsx b/app/src/organisms/ODD/NetworkSettings/__tests__/ConnectingNetwork.test.tsx index e040bee4572..29444afea6d 100644 --- a/app/src/organisms/ODD/NetworkSettings/__tests__/ConnectingNetwork.test.tsx +++ b/app/src/organisms/ODD/NetworkSettings/__tests__/ConnectingNetwork.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { MemoryRouter } from 'react-router-dom' import { screen } from '@testing-library/react' import { beforeEach, describe, expect, it } from 'vitest' @@ -7,7 +6,9 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { ConnectingNetwork } from '../ConnectingNetwork' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders( @@ -19,7 +20,7 @@ const render = (props: React.ComponentProps) => { } describe('ConnectingNetwork', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/NetworkSettings/__tests__/DisplayWifiList.test.tsx b/app/src/organisms/ODD/NetworkSettings/__tests__/DisplayWifiList.test.tsx index e1449be3b9d..11e0ef16a9b 100644 --- a/app/src/organisms/ODD/NetworkSettings/__tests__/DisplayWifiList.test.tsx +++ b/app/src/organisms/ODD/NetworkSettings/__tests__/DisplayWifiList.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' @@ -8,6 +7,7 @@ import * as Fixtures from '/app/redux/networking/__fixtures__' import { DisplaySearchNetwork } from '../DisplaySearchNetwork' import { DisplayWifiList } from '../DisplayWifiList' +import type { ComponentProps } from 'react' import type { NavigateFunction } from 'react-router-dom' const mockNavigate = vi.fn() @@ -31,14 +31,14 @@ vi.mock('react-router-dom', async importOriginal => { } }) -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('DisplayWifiList', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { list: mockWifiList, diff --git a/app/src/organisms/ODD/NetworkSettings/__tests__/FailedToConnect.test.tsx b/app/src/organisms/ODD/NetworkSettings/__tests__/FailedToConnect.test.tsx index 3dbf7bf1f46..74e11378af8 100644 --- a/app/src/organisms/ODD/NetworkSettings/__tests__/FailedToConnect.test.tsx +++ b/app/src/organisms/ODD/NetworkSettings/__tests__/FailedToConnect.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { MemoryRouter } from 'react-router-dom' import { fireEvent, screen } from '@testing-library/react' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' @@ -7,9 +6,10 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { FailedToConnect } from '../FailedToConnect' +import type { ComponentProps } from 'react' import type { RequestState } from '/app/redux/robot-api/types' -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders( @@ -33,7 +33,7 @@ const failureState = { } as RequestState describe('ConnectedResult', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/NetworkSettings/__tests__/SelectAuthenticationType.test.tsx b/app/src/organisms/ODD/NetworkSettings/__tests__/SelectAuthenticationType.test.tsx index bfce05cc22d..2520e944ad7 100644 --- a/app/src/organisms/ODD/NetworkSettings/__tests__/SelectAuthenticationType.test.tsx +++ b/app/src/organisms/ODD/NetworkSettings/__tests__/SelectAuthenticationType.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { MemoryRouter } from 'react-router-dom' import { afterEach, beforeEach, describe, it, vi } from 'vitest' @@ -11,6 +10,7 @@ import { AlternativeSecurityTypeModal } from '../AlternativeSecurityTypeModal' import { SelectAuthenticationType } from '../SelectAuthenticationType' import { SetWifiCred } from '../SetWifiCred' +import type { ComponentProps } from 'react' import type { NavigateFunction } from 'react-router-dom' const mockNavigate = vi.fn() @@ -36,9 +36,7 @@ const initialMockWifi = { type: INTERFACE_WIFI, } -const render = ( - props: React.ComponentProps -) => { +const render = (props: ComponentProps) => { return renderWithProviders( @@ -50,7 +48,7 @@ const render = ( } describe('SelectAuthenticationType', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { selectedAuthType: 'wpa-psk', diff --git a/app/src/organisms/ODD/NetworkSettings/__tests__/SetWifiCred.test.tsx b/app/src/organisms/ODD/NetworkSettings/__tests__/SetWifiCred.test.tsx index d1a25f069c9..85cc94d895e 100644 --- a/app/src/organisms/ODD/NetworkSettings/__tests__/SetWifiCred.test.tsx +++ b/app/src/organisms/ODD/NetworkSettings/__tests__/SetWifiCred.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { MemoryRouter } from 'react-router-dom' import { fireEvent, screen } from '@testing-library/react' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' @@ -7,11 +6,13 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { SetWifiCred } from '../SetWifiCred' +import type { ComponentProps } from 'react' + const mockSetPassword = vi.fn() vi.mock('/app/redux/discovery') vi.mock('/app/redux/robot-api') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders( @@ -23,7 +24,7 @@ const render = (props: React.ComponentProps) => { } describe('SetWifiCred', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { password: 'mock-password', diff --git a/app/src/organisms/ODD/NetworkSettings/__tests__/SetWifiSsid.test.tsx b/app/src/organisms/ODD/NetworkSettings/__tests__/SetWifiSsid.test.tsx index 11eab279c37..c5b0ff26ee5 100644 --- a/app/src/organisms/ODD/NetworkSettings/__tests__/SetWifiSsid.test.tsx +++ b/app/src/organisms/ODD/NetworkSettings/__tests__/SetWifiSsid.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { MemoryRouter } from 'react-router-dom' import { fireEvent, screen } from '@testing-library/react' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' @@ -7,8 +6,10 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { SetWifiSsid } from '../SetWifiSsid' +import type { ComponentProps } from 'react' + const mockSetSelectedSsid = vi.fn() -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders( @@ -20,7 +21,7 @@ const render = (props: React.ComponentProps) => { } describe('SetWifiSsid', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { setInputSsid: mockSetSelectedSsid, diff --git a/app/src/organisms/ODD/NetworkSettings/__tests__/WifiConnectionDetails.test.tsx b/app/src/organisms/ODD/NetworkSettings/__tests__/WifiConnectionDetails.test.tsx index efcee37e0c6..76e63934328 100644 --- a/app/src/organisms/ODD/NetworkSettings/__tests__/WifiConnectionDetails.test.tsx +++ b/app/src/organisms/ODD/NetworkSettings/__tests__/WifiConnectionDetails.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { MemoryRouter } from 'react-router-dom' import { fireEvent, screen } from '@testing-library/react' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' @@ -11,6 +10,7 @@ import * as Fixtures from '/app/redux/networking/__fixtures__' import { NetworkDetailsModal } from '../../RobotSettingsDashboard/NetworkSettings/NetworkDetailsModal' import { WifiConnectionDetails } from '../WifiConnectionDetails' +import type { ComponentProps } from 'react' import type { NavigateFunction } from 'react-router-dom' vi.mock('/app/resources/networking/hooks') @@ -27,7 +27,7 @@ vi.mock('react-router-dom', async importOriginal => { } }) -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders( @@ -51,7 +51,7 @@ const mockWifiList = [ ] describe('WifiConnectionDetails', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { ssid: 'mockWifi', diff --git a/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupDeckConfiguration/__tests__/ProtocolSetupDeckConfiguration.test.tsx b/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupDeckConfiguration/__tests__/ProtocolSetupDeckConfiguration.test.tsx index 84a7fd2eb87..21b26365d81 100644 --- a/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupDeckConfiguration/__tests__/ProtocolSetupDeckConfiguration.test.tsx +++ b/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupDeckConfiguration/__tests__/ProtocolSetupDeckConfiguration.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { when } from 'vitest-when' import { fireEvent, screen } from '@testing-library/react' import { describe, it, vi, beforeEach, afterEach } from 'vitest' @@ -15,6 +14,7 @@ import { useMostRecentCompletedAnalysis } from '/app/resources/runs' import { useNotifyDeckConfigurationQuery } from '/app/resources/deck_configuration' import { ProtocolSetupDeckConfiguration } from '..' +import type { ComponentProps } from 'react' import type { UseQueryResult } from 'react-query' import type { CompletedProtocolAnalysis, @@ -47,7 +47,7 @@ vi.mock('@opentrons/components', async importOriginal => { }) const render = ( - props: React.ComponentProps + props: ComponentProps ) => { return renderWithProviders(, { i18nInstance: i18n, @@ -55,7 +55,7 @@ const render = ( } describe('ProtocolSetupDeckConfiguration', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupInstruments/ProtocolSetupInstruments.tsx b/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupInstruments/ProtocolSetupInstruments.tsx index 1af859bc431..1826ea10339 100644 --- a/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupInstruments/ProtocolSetupInstruments.tsx +++ b/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupInstruments/ProtocolSetupInstruments.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import styled from 'styled-components' import { useTranslation } from 'react-i18next' import { @@ -16,15 +15,16 @@ import { PipetteRecalibrationODDWarning } from '/app/organisms/ODD/PipetteRecali import { getShowPipetteCalibrationWarning } from '/app/transformations/instruments' import { useMostRecentCompletedAnalysis } from '/app/resources/runs' import { ProtocolInstrumentMountItem } from '/app/organisms/ODD/InstrumentMountItem' +import { isGripperInCommands } from '/app/resources/protocols/utils' +import type { Dispatch, SetStateAction } from 'react' import type { GripperData, PipetteData } from '@opentrons/api-client' import type { GripperModel } from '@opentrons/shared-data' import type { SetupScreens } from '../types' -import { isGripperInCommands } from '/app/resources/protocols/utils' export interface ProtocolSetupInstrumentsProps { runId: string - setSetupScreen: React.Dispatch> + setSetupScreen: Dispatch> } export function ProtocolSetupInstruments({ diff --git a/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupLabware/__tests__/LabwareMapView.test.tsx b/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupLabware/__tests__/LabwareMapView.test.tsx index 860d927578e..3f387db51f6 100644 --- a/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupLabware/__tests__/LabwareMapView.test.tsx +++ b/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupLabware/__tests__/LabwareMapView.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { MemoryRouter } from 'react-router-dom' import { when } from 'vitest-when' import { describe, it, vi, beforeEach, afterEach, expect } from 'vitest' @@ -17,6 +16,7 @@ import { getStandardDeckViewLayerBlockList } from '/app/local-resources/deck_con import { mockProtocolModuleInfo } from '../__fixtures__' import { LabwareMapView } from '../LabwareMapView' +import type { ComponentProps } from 'react' import type { getSimplestDeckConfigForProtocol, CompletedProtocolAnalysis, @@ -50,7 +50,7 @@ vi.mock('@opentrons/components', async importOriginal => { } }) -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders( diff --git a/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupLiquids/__tests__/LiquidDetails.test.tsx b/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupLiquids/__tests__/LiquidDetails.test.tsx index 720b6db7545..9d05000cf8f 100644 --- a/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupLiquids/__tests__/LiquidDetails.test.tsx +++ b/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupLiquids/__tests__/LiquidDetails.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { screen, fireEvent } from '@testing-library/react' import { describe, it, beforeEach, vi } from 'vitest' @@ -13,20 +12,22 @@ import { MOCK_LABWARE_INFO_BY_LIQUID_ID, MOCK_PROTOCOL_ANALYSIS, } from '../fixtures' + +import type { ComponentProps } from 'react' import type { CompletedProtocolAnalysis } from '@opentrons/shared-data' vi.mock('/app/transformations/analysis') vi.mock('/app/transformations/commands') vi.mock('/app/organisms/LiquidsLabwareDetailsModal') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('LiquidDetails', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { commands: (MOCK_PROTOCOL_ANALYSIS as CompletedProtocolAnalysis).commands, diff --git a/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupLiquids/__tests__/ProtocolSetupLiquids.test.tsx b/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupLiquids/__tests__/ProtocolSetupLiquids.test.tsx index 487fbbd0bce..eed74fae79d 100644 --- a/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupLiquids/__tests__/ProtocolSetupLiquids.test.tsx +++ b/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupLiquids/__tests__/ProtocolSetupLiquids.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, beforeEach, vi } from 'vitest' import { screen, fireEvent } from '@testing-library/react' @@ -20,6 +19,7 @@ import { } from '../fixtures' import { ProtocolSetupLiquids } from '..' +import type { ComponentProps } from 'react' import type * as SharedData from '@opentrons/shared-data' vi.mock('/app/transformations/analysis') @@ -41,13 +41,13 @@ describe('ProtocolSetupLiquids', () => { isConfirmed = confirmed }) - const render = (props: React.ComponentProps) => { + const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { runId: RUN_ID_1, diff --git a/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupModulesAndDeck/__tests__/FixtureTable.test.tsx b/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupModulesAndDeck/__tests__/FixtureTable.test.tsx index e6ca8735d77..b5336d9c535 100644 --- a/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupModulesAndDeck/__tests__/FixtureTable.test.tsx +++ b/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupModulesAndDeck/__tests__/FixtureTable.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, beforeEach, afterEach, vi, expect } from 'vitest' @@ -18,6 +17,8 @@ import { FixtureTable } from '../FixtureTable' import { getLocalRobot } from '/app/redux/discovery' import { mockConnectedRobot } from '/app/redux/discovery/__fixtures__' +import type { ComponentProps } from 'react' + vi.mock('/app/redux/discovery') vi.mock('/app/resources/deck_configuration/hooks') vi.mock('/app/organisms/LocationConflictModal') @@ -26,14 +27,14 @@ const mockSetSetupScreen = vi.fn() const mockSetCutoutId = vi.fn() const mockSetProvidedFixtureOptions = vi.fn() -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('FixtureTable', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { mostRecentAnalysis: { commands: [], labware: [] } as any, diff --git a/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupModulesAndDeck/__tests__/ModulesAndDeckMapView.test.tsx b/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupModulesAndDeck/__tests__/ModulesAndDeckMapView.test.tsx index d31a0312d02..a06ad0118db 100644 --- a/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupModulesAndDeck/__tests__/ModulesAndDeckMapView.test.tsx +++ b/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupModulesAndDeck/__tests__/ModulesAndDeckMapView.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, vi, beforeEach, afterEach } from 'vitest' import { screen } from '@testing-library/react' @@ -12,6 +11,8 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { ModulesAndDeckMapView } from '../ModulesAndDeckMapView' +import type { ComponentProps } from 'react' + vi.mock('@opentrons/components/src/hardware-sim/BaseDeck') vi.mock('@opentrons/api-client') vi.mock('@opentrons/shared-data/js/helpers/getSimplestFlexDeckConfig') @@ -99,14 +100,14 @@ vi.mock('@opentrons/components', async importOriginal => { } }) -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('ModulesAndDeckMapView', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupModulesAndDeck/__tests__/SetupInstructionsModal.test.tsx b/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupModulesAndDeck/__tests__/SetupInstructionsModal.test.tsx index 8f6f4c01739..f4ac8d4fec1 100644 --- a/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupModulesAndDeck/__tests__/SetupInstructionsModal.test.tsx +++ b/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupModulesAndDeck/__tests__/SetupInstructionsModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, beforeEach, vi } from 'vitest' @@ -7,18 +6,20 @@ import { i18n } from '/app/i18n' import { SetupInstructionsModal } from '../SetupInstructionsModal' +import type { ComponentProps } from 'react' + const mockSetShowSetupInstructionsModal = vi.fn() const QR_CODE_IMAGE_FILE = '/app/src/assets/images/on-device-display/setup_instructions_qr_code.png' -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('SetupInstructionsModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupOffsets/index.tsx b/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupOffsets/index.tsx index 310c1dadbc4..85e9352d5fe 100644 --- a/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupOffsets/index.tsx +++ b/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupOffsets/index.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useTranslation } from 'react-i18next' import { Chip, @@ -24,9 +23,11 @@ import { } from '/app/resources/runs' import { getLatestCurrentOffsets } from '/app/transformations/runs' +import type { Dispatch, SetStateAction } from 'react' + export interface ProtocolSetupOffsetsProps { runId: string - setSetupScreen: React.Dispatch> + setSetupScreen: Dispatch> lpcDisabledReason: string | null launchLPC: () => void LPCWizard: JSX.Element | null diff --git a/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupParameters/ViewOnlyParameters.tsx b/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupParameters/ViewOnlyParameters.tsx index 1946d122848..7f5b73db3b0 100644 --- a/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupParameters/ViewOnlyParameters.tsx +++ b/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupParameters/ViewOnlyParameters.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useTranslation } from 'react-i18next' import { css } from 'styled-components' @@ -22,11 +21,12 @@ import { useMostRecentCompletedAnalysis } from '/app/resources/runs' import { ChildNavigation } from '/app/organisms/ODD/ChildNavigation' import { useToaster } from '/app/organisms/ToasterOven' +import type { Dispatch, SetStateAction } from 'react' import type { SetupScreens } from '../types' export interface ViewOnlyParametersProps { runId: string - setSetupScreen: React.Dispatch> + setSetupScreen: Dispatch> } export function ViewOnlyParameters({ diff --git a/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupParameters/__tests__/AnalysisFailedModal.test.tsx b/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupParameters/__tests__/AnalysisFailedModal.test.tsx index ac43f26d621..dec3fc608e2 100644 --- a/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupParameters/__tests__/AnalysisFailedModal.test.tsx +++ b/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupParameters/__tests__/AnalysisFailedModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, vi, beforeEach, expect } from 'vitest' import { when } from 'vitest-when' import { fireEvent, screen } from '@testing-library/react' @@ -7,6 +6,8 @@ import { useDismissCurrentRunMutation } from '@opentrons/react-api-client' import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { AnalysisFailedModal } from '../AnalysisFailedModal' + +import type { ComponentProps } from 'react' import type { NavigateFunction } from 'react-router-dom' const PROTOCOL_ID = 'mockProtocolId' @@ -26,14 +27,14 @@ vi.mock('react-router-dom', async importOriginal => { } }) -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('AnalysisFailedModal', () => { - let props: React.ComponentProps + let props: ComponentProps when(vi.mocked(useDismissCurrentRunMutation)) .calledWith() diff --git a/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupParameters/__tests__/ChooseCsvFile.test.tsx b/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupParameters/__tests__/ChooseCsvFile.test.tsx index 2f365fa5fbc..560f9f9490a 100644 --- a/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupParameters/__tests__/ChooseCsvFile.test.tsx +++ b/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupParameters/__tests__/ChooseCsvFile.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, beforeEach, vi, expect } from 'vitest' import { screen, fireEvent } from '@testing-library/react' import { when } from 'vitest-when' @@ -13,6 +12,7 @@ import { getShellUpdateDataFiles } from '/app/redux/shell' import { EmptyFile } from '../EmptyFile' import { ChooseCsvFile } from '../ChooseCsvFile' +import type { ComponentProps } from 'react' import type { CsvFileParameter } from '@opentrons/shared-data' vi.mock('@opentrons/react-api-client') @@ -47,14 +47,14 @@ const mockDataOnRobot = { }, } -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('ChooseCsvFile', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { protocolId: PROTOCOL_ID, diff --git a/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupParameters/__tests__/ChooseEnum.test.tsx b/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupParameters/__tests__/ChooseEnum.test.tsx index a65c760d544..613e17c9523 100644 --- a/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupParameters/__tests__/ChooseEnum.test.tsx +++ b/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupParameters/__tests__/ChooseEnum.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { it, describe, beforeEach, vi, expect } from 'vitest' import { fireEvent, screen } from '@testing-library/react' import '@testing-library/jest-dom/vitest' @@ -7,14 +6,16 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { ChooseEnum } from '../ChooseEnum' +import type { ComponentProps } from 'react' + vi.mocked('../../../../ToasterOven') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('ChooseEnum', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupParameters/__tests__/ChooseNumber.test.tsx b/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupParameters/__tests__/ChooseNumber.test.tsx index 611c0e124fc..89af3d22e4c 100644 --- a/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupParameters/__tests__/ChooseNumber.test.tsx +++ b/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupParameters/__tests__/ChooseNumber.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { it, describe, beforeEach, vi, expect } from 'vitest' import { fireEvent, screen } from '@testing-library/react' import '@testing-library/jest-dom/vitest' @@ -8,6 +7,7 @@ import { useToaster } from '/app/organisms/ToasterOven' import { mockRunTimeParameterData } from '../../__fixtures__' import { ChooseNumber } from '../ChooseNumber' +import type { ComponentProps } from 'react' import type { NumberParameter } from '@opentrons/shared-data' vi.mock('/app/organisms/ToasterOven') @@ -18,14 +18,14 @@ const mockFloatNumberParameterData = mockRunTimeParameterData[6] as NumberParame const mockSetParameter = vi.fn() const mockMakeSnackbar = vi.fn() -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('ChooseNumber', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupParameters/__tests__/ProtocolSetupParameters.test.tsx b/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupParameters/__tests__/ProtocolSetupParameters.test.tsx index 18a01391711..f32442f7fda 100644 --- a/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupParameters/__tests__/ProtocolSetupParameters.test.tsx +++ b/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupParameters/__tests__/ProtocolSetupParameters.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { when } from 'vitest-when' import { it, describe, beforeEach, vi, expect } from 'vitest' import { fireEvent, screen } from '@testing-library/react' @@ -19,6 +18,7 @@ import { mockRunTimeParameterData } from '../../__fixtures__' import { useToaster } from '/app/organisms/ToasterOven' import { ProtocolSetupParameters } from '..' +import type { ComponentProps } from 'react' import type { NavigateFunction } from 'react-router-dom' import type { HostConfig } from '@opentrons/api-client' import type { CompletedProtocolAnalysis } from '@opentrons/shared-data' @@ -51,16 +51,14 @@ const mockMostRecentAnalysis = ({ } as unknown) as CompletedProtocolAnalysis const mockMakeSnackbar = vi.fn() -const render = ( - props: React.ComponentProps -) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('ProtocolSetupParameters', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupParameters/__tests__/ResetValuesModal.test.tsx b/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupParameters/__tests__/ResetValuesModal.test.tsx index 4e263f9984b..d777a44da04 100644 --- a/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupParameters/__tests__/ResetValuesModal.test.tsx +++ b/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupParameters/__tests__/ResetValuesModal.test.tsx @@ -1,23 +1,24 @@ -import type * as React from 'react' import { describe, it, vi, beforeEach, expect } from 'vitest' import { fireEvent, screen } from '@testing-library/react' import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { ResetValuesModal } from '../ResetValuesModal' + +import type { ComponentProps } from 'react' import type { RunTimeParameter } from '@opentrons/shared-data' const mockGoBack = vi.fn() const mockSetRunTimeParametersOverrides = vi.fn() -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('ResetValuesModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupParameters/__tests__/ViewOnlyParameters.test.tsx b/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupParameters/__tests__/ViewOnlyParameters.test.tsx index aed74fea585..2c0827de156 100644 --- a/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupParameters/__tests__/ViewOnlyParameters.test.tsx +++ b/app/src/organisms/ODD/ProtocolSetup/ProtocolSetupParameters/__tests__/ViewOnlyParameters.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { when } from 'vitest-when' import { it, describe, beforeEach, vi, expect } from 'vitest' import { fireEvent, screen } from '@testing-library/react' @@ -9,17 +8,19 @@ import { useToaster } from '/app/organisms/ToasterOven' import { mockRunTimeParameterData } from '../../__fixtures__' import { ViewOnlyParameters } from '../ViewOnlyParameters' +import type { ComponentProps } from 'react' + vi.mock('/app/resources/runs') vi.mock('/app/organisms/ToasterOven') const RUN_ID = 'mockId' -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } const mockMakeSnackBar = vi.fn() describe('ViewOnlyParameters', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/QuickTransferFlow/CreateNewTransfer.tsx b/app/src/organisms/ODD/QuickTransferFlow/CreateNewTransfer.tsx index 10b036b9064..b74ecc7065e 100644 --- a/app/src/organisms/ODD/QuickTransferFlow/CreateNewTransfer.tsx +++ b/app/src/organisms/ODD/QuickTransferFlow/CreateNewTransfer.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useTranslation, Trans } from 'react-i18next' import { @@ -12,11 +11,13 @@ import { import { ChildNavigation } from '/app/organisms/ODD/ChildNavigation' import { useNotifyDeckConfigurationQuery } from '/app/resources/deck_configuration' + +import type { ComponentProps } from 'react' import type { SmallButton } from '/app/atoms/buttons' interface CreateNewTransferProps { onNext: () => void - exitButtonProps: React.ComponentProps + exitButtonProps: ComponentProps } export function CreateNewTransfer(props: CreateNewTransferProps): JSX.Element { diff --git a/app/src/organisms/ODD/QuickTransferFlow/__tests__/ConfirmExitModal.test.tsx b/app/src/organisms/ODD/QuickTransferFlow/__tests__/ConfirmExitModal.test.tsx index 4b50c31ca29..18fdc854a85 100644 --- a/app/src/organisms/ODD/QuickTransferFlow/__tests__/ConfirmExitModal.test.tsx +++ b/app/src/organisms/ODD/QuickTransferFlow/__tests__/ConfirmExitModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, afterEach, vi, beforeEach } from 'vitest' @@ -6,14 +5,16 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { ConfirmExitModal } from '../ConfirmExitModal' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('ConfirmExitModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/QuickTransferFlow/__tests__/CreateNewTransfer.test.tsx b/app/src/organisms/ODD/QuickTransferFlow/__tests__/CreateNewTransfer.test.tsx index 178086ae401..7d134e0e2be 100644 --- a/app/src/organisms/ODD/QuickTransferFlow/__tests__/CreateNewTransfer.test.tsx +++ b/app/src/organisms/ODD/QuickTransferFlow/__tests__/CreateNewTransfer.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, afterEach, vi, beforeEach } from 'vitest' import { DeckConfigurator } from '@opentrons/components' @@ -7,6 +6,7 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { CreateNewTransfer } from '../CreateNewTransfer' +import type { ComponentProps } from 'react' import type * as OpentronsComponents from '@opentrons/components' vi.mock('@opentrons/components', async importOriginal => { @@ -16,14 +16,14 @@ vi.mock('@opentrons/components', async importOriginal => { DeckConfigurator: vi.fn(), } }) -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('CreateNewTransfer', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/QuickTransferFlow/__tests__/NameQuickTransfer.test.tsx b/app/src/organisms/ODD/QuickTransferFlow/__tests__/NameQuickTransfer.test.tsx index 363c89cdc82..3b247ce2ef8 100644 --- a/app/src/organisms/ODD/QuickTransferFlow/__tests__/NameQuickTransfer.test.tsx +++ b/app/src/organisms/ODD/QuickTransferFlow/__tests__/NameQuickTransfer.test.tsx @@ -1,10 +1,11 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, afterEach, vi, beforeEach } from 'vitest' import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { NameQuickTransfer } from '../NameQuickTransfer' + +import type { ComponentProps } from 'react' import type { InputField } from '@opentrons/components' vi.mock('../utils') @@ -17,14 +18,14 @@ vi.mock('/app/atoms/InputField', async importOriginal => { } }) -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('NameQuickTransfer', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/QuickTransferFlow/__tests__/Overview.test.tsx b/app/src/organisms/ODD/QuickTransferFlow/__tests__/Overview.test.tsx index 242b0f58a92..192d378f97c 100644 --- a/app/src/organisms/ODD/QuickTransferFlow/__tests__/Overview.test.tsx +++ b/app/src/organisms/ODD/QuickTransferFlow/__tests__/Overview.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { screen } from '@testing-library/react' import { describe, it, afterEach, vi, beforeEach } from 'vitest' @@ -6,14 +5,16 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { Overview } from '../Overview' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('Overview', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/QuickTransferFlow/__tests__/QuickTransferAdvancedSettings/AirGap.test.tsx b/app/src/organisms/ODD/QuickTransferFlow/__tests__/QuickTransferAdvancedSettings/AirGap.test.tsx index a4cc4a2879a..f1e6245389f 100644 --- a/app/src/organisms/ODD/QuickTransferFlow/__tests__/QuickTransferAdvancedSettings/AirGap.test.tsx +++ b/app/src/organisms/ODD/QuickTransferFlow/__tests__/QuickTransferAdvancedSettings/AirGap.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, afterEach, vi, beforeEach } from 'vitest' @@ -8,6 +7,8 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { useTrackEventWithRobotSerial } from '/app/redux-resources/analytics' import { AirGap } from '../../QuickTransferAdvancedSettings/AirGap' + +import type { ComponentProps } from 'react' import type { QuickTransferSummaryState } from '../../types' vi.mock('/app/redux-resources/analytics') @@ -21,7 +22,7 @@ vi.mock('@opentrons/components', async importOriginal => { } }) -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) @@ -29,7 +30,7 @@ const render = (props: React.ComponentProps) => { let mockTrackEventWithRobotSerial: any describe('AirGap', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/QuickTransferFlow/__tests__/QuickTransferAdvancedSettings/BlowOut.test.tsx b/app/src/organisms/ODD/QuickTransferFlow/__tests__/QuickTransferAdvancedSettings/BlowOut.test.tsx index c75788ac8cd..6921e9daea7 100644 --- a/app/src/organisms/ODD/QuickTransferFlow/__tests__/QuickTransferAdvancedSettings/BlowOut.test.tsx +++ b/app/src/organisms/ODD/QuickTransferFlow/__tests__/QuickTransferAdvancedSettings/BlowOut.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, afterEach, vi, beforeEach } from 'vitest' @@ -7,13 +6,15 @@ import { i18n } from '/app/i18n' import { useNotifyDeckConfigurationQuery } from '/app/resources/deck_configuration' import { useTrackEventWithRobotSerial } from '/app/redux-resources/analytics' import { BlowOut } from '../../QuickTransferAdvancedSettings/BlowOut' + +import type { ComponentProps } from 'react' import type { QuickTransferSummaryState } from '../../types' vi.mock('/app/resources/deck_configuration') vi.mock('/app/redux-resources/analytics') vi.mock('../utils') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) @@ -21,7 +22,7 @@ const render = (props: React.ComponentProps) => { let mockTrackEventWithRobotSerial: any describe('BlowOut', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/QuickTransferFlow/__tests__/QuickTransferAdvancedSettings/Delay.test.tsx b/app/src/organisms/ODD/QuickTransferFlow/__tests__/QuickTransferAdvancedSettings/Delay.test.tsx index 957f3eb6e62..32b26e4712f 100644 --- a/app/src/organisms/ODD/QuickTransferFlow/__tests__/QuickTransferAdvancedSettings/Delay.test.tsx +++ b/app/src/organisms/ODD/QuickTransferFlow/__tests__/QuickTransferAdvancedSettings/Delay.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, afterEach, vi, beforeEach } from 'vitest' @@ -8,6 +7,8 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { useTrackEventWithRobotSerial } from '/app/redux-resources/analytics' import { Delay } from '../../QuickTransferAdvancedSettings/Delay' + +import type { ComponentProps } from 'react' import type { QuickTransferSummaryState } from '../../types' vi.mock('/app/redux-resources/analytics') @@ -21,7 +22,7 @@ vi.mock('@opentrons/components', async importOriginal => { } }) -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) @@ -29,7 +30,7 @@ const render = (props: React.ComponentProps) => { let mockTrackEventWithRobotSerial: any describe('Delay', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/QuickTransferFlow/__tests__/QuickTransferAdvancedSettings/FlowRate.test.tsx b/app/src/organisms/ODD/QuickTransferFlow/__tests__/QuickTransferAdvancedSettings/FlowRate.test.tsx index 4b01bb52ebe..413af34ce99 100644 --- a/app/src/organisms/ODD/QuickTransferFlow/__tests__/QuickTransferAdvancedSettings/FlowRate.test.tsx +++ b/app/src/organisms/ODD/QuickTransferFlow/__tests__/QuickTransferAdvancedSettings/FlowRate.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, afterEach, vi, beforeEach } from 'vitest' @@ -8,6 +7,8 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { useTrackEventWithRobotSerial } from '/app/redux-resources/analytics' import { FlowRateEntry } from '../../QuickTransferAdvancedSettings/FlowRate' + +import type { ComponentProps } from 'react' import type { QuickTransferSummaryState } from '../../types' vi.mock('/app/redux-resources/analytics') @@ -21,7 +22,7 @@ vi.mock('@opentrons/components', async importOriginal => { } }) -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) @@ -29,7 +30,7 @@ const render = (props: React.ComponentProps) => { let mockTrackEventWithRobotSerial: any describe('FlowRate', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/QuickTransferFlow/__tests__/QuickTransferAdvancedSettings/Mix.test.tsx b/app/src/organisms/ODD/QuickTransferFlow/__tests__/QuickTransferAdvancedSettings/Mix.test.tsx index c4d1c170be3..298bd040f1c 100644 --- a/app/src/organisms/ODD/QuickTransferFlow/__tests__/QuickTransferAdvancedSettings/Mix.test.tsx +++ b/app/src/organisms/ODD/QuickTransferFlow/__tests__/QuickTransferAdvancedSettings/Mix.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, afterEach, vi, beforeEach } from 'vitest' @@ -8,6 +7,8 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { useTrackEventWithRobotSerial } from '/app/redux-resources/analytics' import { Mix } from '../../QuickTransferAdvancedSettings/Mix' + +import type { ComponentProps } from 'react' import type { QuickTransferSummaryState } from '../../types' vi.mock('/app/redux-resources/analytics') @@ -21,7 +22,7 @@ vi.mock('@opentrons/components', async importOriginal => { } }) -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) @@ -29,7 +30,7 @@ const render = (props: React.ComponentProps) => { let mockTrackEventWithRobotSerial: any describe('Mix', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/QuickTransferFlow/__tests__/QuickTransferAdvancedSettings/PipettePath.test.tsx b/app/src/organisms/ODD/QuickTransferFlow/__tests__/QuickTransferAdvancedSettings/PipettePath.test.tsx index e62571bdc6a..536c14bbbfd 100644 --- a/app/src/organisms/ODD/QuickTransferFlow/__tests__/QuickTransferAdvancedSettings/PipettePath.test.tsx +++ b/app/src/organisms/ODD/QuickTransferFlow/__tests__/QuickTransferAdvancedSettings/PipettePath.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, afterEach, vi, beforeEach } from 'vitest' @@ -9,6 +8,8 @@ import { i18n } from '/app/i18n' import { useTrackEventWithRobotSerial } from '/app/redux-resources/analytics' import { PipettePath } from '../../QuickTransferAdvancedSettings/PipettePath' import { useBlowOutLocationOptions } from '../../QuickTransferAdvancedSettings/BlowOut' + +import type { ComponentProps } from 'react' import type { QuickTransferSummaryState } from '../../types' vi.mock('/app/redux-resources/analytics') @@ -23,7 +24,7 @@ vi.mock('@opentrons/components', async importOriginal => { } }) -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) @@ -31,7 +32,7 @@ const render = (props: React.ComponentProps) => { let mockTrackEventWithRobotSerial: any describe('PipettePath', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/QuickTransferFlow/__tests__/QuickTransferAdvancedSettings/QuickTransferAdvancedSettings.test.tsx b/app/src/organisms/ODD/QuickTransferFlow/__tests__/QuickTransferAdvancedSettings/QuickTransferAdvancedSettings.test.tsx index 64e400f5a10..aac998fc8dd 100644 --- a/app/src/organisms/ODD/QuickTransferFlow/__tests__/QuickTransferAdvancedSettings/QuickTransferAdvancedSettings.test.tsx +++ b/app/src/organisms/ODD/QuickTransferFlow/__tests__/QuickTransferAdvancedSettings/QuickTransferAdvancedSettings.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, afterEach, vi, beforeEach } from 'vitest' @@ -16,6 +15,8 @@ import { TouchTip } from '../../QuickTransferAdvancedSettings/TouchTip' import { AirGap } from '../../QuickTransferAdvancedSettings/AirGap' import { BlowOut } from '../../QuickTransferAdvancedSettings/BlowOut' +import type { ComponentProps } from 'react' + vi.mock('/app/redux-resources/analytics') vi.mock('/app/organisms/ToasterOven') vi.mock('../../QuickTransferAdvancedSettings/PipettePath') @@ -28,7 +29,7 @@ vi.mock('../../QuickTransferAdvancedSettings/AirGap') vi.mock('../../QuickTransferAdvancedSettings/BlowOut') const render = ( - props: React.ComponentProps + props: ComponentProps ): any => { return renderWithProviders(, { i18nInstance: i18n, @@ -38,7 +39,7 @@ let mockTrackEventWithRobotSerial: any let mockMakeSnackbar: any describe('QuickTransferAdvancedSettings', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/QuickTransferFlow/__tests__/QuickTransferAdvancedSettings/TipPosition.test.tsx b/app/src/organisms/ODD/QuickTransferFlow/__tests__/QuickTransferAdvancedSettings/TipPosition.test.tsx index dc109c2c302..02e5022785c 100644 --- a/app/src/organisms/ODD/QuickTransferFlow/__tests__/QuickTransferAdvancedSettings/TipPosition.test.tsx +++ b/app/src/organisms/ODD/QuickTransferFlow/__tests__/QuickTransferAdvancedSettings/TipPosition.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, afterEach, vi, beforeEach } from 'vitest' @@ -8,6 +7,8 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { useTrackEventWithRobotSerial } from '/app/redux-resources/analytics' import { TipPositionEntry } from '../../QuickTransferAdvancedSettings/TipPosition' + +import type { ComponentProps } from 'react' import type { QuickTransferSummaryState } from '../../types' vi.mock('/app/redux-resources/analytics') @@ -21,7 +22,7 @@ vi.mock('@opentrons/components', async importOriginal => { } }) -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) @@ -29,7 +30,7 @@ const render = (props: React.ComponentProps) => { let mockTrackEventWithRobotSerial: any describe('TipPosition', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/QuickTransferFlow/__tests__/QuickTransferAdvancedSettings/TouchTip.test.tsx b/app/src/organisms/ODD/QuickTransferFlow/__tests__/QuickTransferAdvancedSettings/TouchTip.test.tsx index cc30db0a54f..a5338c8aa71 100644 --- a/app/src/organisms/ODD/QuickTransferFlow/__tests__/QuickTransferAdvancedSettings/TouchTip.test.tsx +++ b/app/src/organisms/ODD/QuickTransferFlow/__tests__/QuickTransferAdvancedSettings/TouchTip.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, afterEach, vi, beforeEach } from 'vitest' @@ -8,6 +7,8 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { useTrackEventWithRobotSerial } from '/app/redux-resources/analytics' import { TouchTip } from '../../QuickTransferAdvancedSettings/TouchTip' + +import type { ComponentProps } from 'react' import type { QuickTransferSummaryState } from '../../types' vi.mock('/app/redux-resources/analytics') @@ -21,7 +22,7 @@ vi.mock('@opentrons/components', async importOriginal => { } }) -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) @@ -29,7 +30,7 @@ const render = (props: React.ComponentProps) => { let mockTrackEventWithRobotSerial: any describe('TouchTip', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/QuickTransferFlow/__tests__/SelectDestLabware.test.tsx b/app/src/organisms/ODD/QuickTransferFlow/__tests__/SelectDestLabware.test.tsx index 6448542c14e..38007f7cc58 100644 --- a/app/src/organisms/ODD/QuickTransferFlow/__tests__/SelectDestLabware.test.tsx +++ b/app/src/organisms/ODD/QuickTransferFlow/__tests__/SelectDestLabware.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, afterEach, vi, beforeEach } from 'vitest' @@ -6,15 +5,17 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { SelectDestLabware } from '../SelectDestLabware' +import type { ComponentProps } from 'react' + vi.mock('@opentrons/react-api-client') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('SelectDestLabware', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/QuickTransferFlow/__tests__/SelectPipette.test.tsx b/app/src/organisms/ODD/QuickTransferFlow/__tests__/SelectPipette.test.tsx index e32f7645593..b614041b127 100644 --- a/app/src/organisms/ODD/QuickTransferFlow/__tests__/SelectPipette.test.tsx +++ b/app/src/organisms/ODD/QuickTransferFlow/__tests__/SelectPipette.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, afterEach, vi, beforeEach } from 'vitest' import { useInstrumentsQuery } from '@opentrons/react-api-client' @@ -8,17 +7,19 @@ import { i18n } from '/app/i18n' import { useIsOEMMode } from '/app/resources/robot-settings/hooks' import { SelectPipette } from '../SelectPipette' +import type { ComponentProps } from 'react' + vi.mock('@opentrons/react-api-client') vi.mock('/app/resources/robot-settings/hooks') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('SelectPipette', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/QuickTransferFlow/__tests__/SelectSourceLabware.test.tsx b/app/src/organisms/ODD/QuickTransferFlow/__tests__/SelectSourceLabware.test.tsx index 73121ea7b2d..99e53fab15b 100644 --- a/app/src/organisms/ODD/QuickTransferFlow/__tests__/SelectSourceLabware.test.tsx +++ b/app/src/organisms/ODD/QuickTransferFlow/__tests__/SelectSourceLabware.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, afterEach, vi, beforeEach } from 'vitest' @@ -6,15 +5,17 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { SelectSourceLabware } from '../SelectSourceLabware' +import type { ComponentProps } from 'react' + vi.mock('@opentrons/react-api-client') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('SelectSourceLabware', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/QuickTransferFlow/__tests__/SelectTipRack.test.tsx b/app/src/organisms/ODD/QuickTransferFlow/__tests__/SelectTipRack.test.tsx index f4ee22bd2b9..1489e744ec6 100644 --- a/app/src/organisms/ODD/QuickTransferFlow/__tests__/SelectTipRack.test.tsx +++ b/app/src/organisms/ODD/QuickTransferFlow/__tests__/SelectTipRack.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, afterEach, vi, beforeEach } from 'vitest' @@ -6,15 +5,17 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { SelectTipRack } from '../SelectTipRack' +import type { ComponentProps } from 'react' + vi.mock('@opentrons/react-api-client') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('SelectTipRack', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/QuickTransferFlow/__tests__/SummaryAndSettings.test.tsx b/app/src/organisms/ODD/QuickTransferFlow/__tests__/SummaryAndSettings.test.tsx index 0f5f7c7742c..246fa343260 100644 --- a/app/src/organisms/ODD/QuickTransferFlow/__tests__/SummaryAndSettings.test.tsx +++ b/app/src/organisms/ODD/QuickTransferFlow/__tests__/SummaryAndSettings.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, afterEach, vi, beforeEach } from 'vitest' @@ -16,6 +15,8 @@ import { useTrackEventWithRobotSerial } from '/app/redux-resources/analytics' import { SummaryAndSettings } from '../SummaryAndSettings' import { NameQuickTransfer } from '../NameQuickTransfer' import { Overview } from '../Overview' + +import type { ComponentProps } from 'react' import type { NavigateFunction } from 'react-router-dom' const mockNavigate = vi.fn() @@ -41,7 +42,7 @@ vi.mock('../utils/createQuickTransferFile') vi.mock('@opentrons/react-api-client') vi.mock('/app/resources/deck_configuration') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) @@ -49,7 +50,7 @@ const render = (props: React.ComponentProps) => { let mockTrackEventWithRobotSerial: any describe('SummaryAndSettings', () => { - let props: React.ComponentProps + let props: ComponentProps const createProtocol = vi.fn() const createRun = vi.fn() diff --git a/app/src/organisms/ODD/QuickTransferFlow/__tests__/TipManagement/ChangeTip.test.tsx b/app/src/organisms/ODD/QuickTransferFlow/__tests__/TipManagement/ChangeTip.test.tsx index 213633678e5..cfe5b0a5086 100644 --- a/app/src/organisms/ODD/QuickTransferFlow/__tests__/TipManagement/ChangeTip.test.tsx +++ b/app/src/organisms/ODD/QuickTransferFlow/__tests__/TipManagement/ChangeTip.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, afterEach, vi, beforeEach } from 'vitest' @@ -8,9 +7,11 @@ import { ANALYTICS_QUICK_TRANSFER_SETTING_SAVED } from '/app/redux/analytics' import { useTrackEventWithRobotSerial } from '/app/redux-resources/analytics' import { ChangeTip } from '../../TipManagement/ChangeTip' +import type { ComponentProps } from 'react' + vi.mock('/app/redux-resources/analytics') -const render = (props: React.ComponentProps): any => { +const render = (props: ComponentProps): any => { return renderWithProviders(, { i18nInstance: i18n, }) @@ -19,7 +20,7 @@ const render = (props: React.ComponentProps): any => { let mockTrackEventWithRobotSerial: any describe('ChangeTip', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/QuickTransferFlow/__tests__/TipManagement/TipDropLocation.test.tsx b/app/src/organisms/ODD/QuickTransferFlow/__tests__/TipManagement/TipDropLocation.test.tsx index aed3d143b31..712e7e2217e 100644 --- a/app/src/organisms/ODD/QuickTransferFlow/__tests__/TipManagement/TipDropLocation.test.tsx +++ b/app/src/organisms/ODD/QuickTransferFlow/__tests__/TipManagement/TipDropLocation.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, afterEach, vi, beforeEach } from 'vitest' @@ -9,10 +8,12 @@ import { ANALYTICS_QUICK_TRANSFER_SETTING_SAVED } from '/app/redux/analytics' import { useTrackEventWithRobotSerial } from '/app/redux-resources/analytics' import { TipDropLocation } from '../../TipManagement/TipDropLocation' +import type { ComponentProps } from 'react' + vi.mock('/app/resources/deck_configuration') vi.mock('/app/redux-resources/analytics') -const render = (props: React.ComponentProps): any => { +const render = (props: ComponentProps): any => { return renderWithProviders(, { i18nInstance: i18n, }) @@ -20,7 +21,7 @@ const render = (props: React.ComponentProps): any => { let mockTrackEventWithRobotSerial: any describe('TipDropLocation', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/QuickTransferFlow/__tests__/TipManagement/TipManagement.test.tsx b/app/src/organisms/ODD/QuickTransferFlow/__tests__/TipManagement/TipManagement.test.tsx index 618153a8b53..61f38149a99 100644 --- a/app/src/organisms/ODD/QuickTransferFlow/__tests__/TipManagement/TipManagement.test.tsx +++ b/app/src/organisms/ODD/QuickTransferFlow/__tests__/TipManagement/TipManagement.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, afterEach, vi, beforeEach } from 'vitest' @@ -10,11 +9,13 @@ import { ChangeTip } from '../../TipManagement/ChangeTip' import { TipDropLocation } from '../../TipManagement/TipDropLocation' import { TipManagement } from '../../TipManagement/' +import type { ComponentProps } from 'react' + vi.mock('../../TipManagement/ChangeTip') vi.mock('../../TipManagement/TipDropLocation') vi.mock('/app/redux-resources/analytics') -const render = (props: React.ComponentProps): any => { +const render = (props: ComponentProps): any => { return renderWithProviders(, { i18nInstance: i18n, }) @@ -22,7 +23,7 @@ const render = (props: React.ComponentProps): any => { let mockTrackEventWithRobotSerial: any describe('TipManagement', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/QuickTransferFlow/__tests__/VolumeEntry.test.tsx b/app/src/organisms/ODD/QuickTransferFlow/__tests__/VolumeEntry.test.tsx index 8a14b9a5993..e96ea2515cd 100644 --- a/app/src/organisms/ODD/QuickTransferFlow/__tests__/VolumeEntry.test.tsx +++ b/app/src/organisms/ODD/QuickTransferFlow/__tests__/VolumeEntry.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, afterEach, vi, beforeEach } from 'vitest' @@ -10,6 +9,8 @@ import { NumericalKeyboard } from '/app/atoms/SoftwareKeyboard' import { getVolumeRange } from '../utils' import { VolumeEntry } from '../VolumeEntry' +import type { ComponentProps } from 'react' + vi.mock('/app/atoms/SoftwareKeyboard') vi.mock('../utils') @@ -21,14 +22,14 @@ vi.mock('@opentrons/components', async importOriginal => { } }) -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('VolumeEntry', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/RobotDashboard/__tests__/RecentRunProtocolCard.test.tsx b/app/src/organisms/ODD/RobotDashboard/__tests__/RecentRunProtocolCard.test.tsx index 10ee119176e..cb1b541b39b 100644 --- a/app/src/organisms/ODD/RobotDashboard/__tests__/RecentRunProtocolCard.test.tsx +++ b/app/src/organisms/ODD/RobotDashboard/__tests__/RecentRunProtocolCard.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { formatDistance } from 'date-fns' import { MemoryRouter } from 'react-router-dom' @@ -26,6 +25,7 @@ import { useCloneRun, useNotifyAllRunsQuery } from '/app/resources/runs' import { useRerunnableStatusText } from '../hooks' import { RecentRunProtocolCard } from '../' +import type { ComponentProps } from 'react' import type { NavigateFunction } from 'react-router-dom' import type { ProtocolHardware } from '/app/transformations/commands' @@ -103,7 +103,7 @@ const mockBadRunData = { const mockCloneRun = vi.fn() -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders( @@ -120,7 +120,7 @@ const mockTrackProtocolRunEvent = vi.fn( ) describe('RecentRunProtocolCard', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/RobotDashboard/__tests__/RecentRunProtocolCarousel.test.tsx b/app/src/organisms/ODD/RobotDashboard/__tests__/RecentRunProtocolCarousel.test.tsx index 277edf80d87..31026884d3c 100644 --- a/app/src/organisms/ODD/RobotDashboard/__tests__/RecentRunProtocolCarousel.test.tsx +++ b/app/src/organisms/ODD/RobotDashboard/__tests__/RecentRunProtocolCarousel.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { screen } from '@testing-library/react' import { beforeEach, describe, it, vi } from 'vitest' @@ -6,6 +5,7 @@ import { renderWithProviders } from '/app/__testing-utils__' import { useNotifyAllRunsQuery } from '/app/resources/runs' import { RecentRunProtocolCard, RecentRunProtocolCarousel } from '..' +import type { ComponentProps } from 'react' import type { RunData } from '@opentrons/api-client' vi.mock('@opentrons/react-api-client') @@ -30,14 +30,12 @@ const mockRun = { runTimeParameters: [], } -const render = ( - props: React.ComponentProps -) => { +const render = (props: ComponentProps) => { return renderWithProviders() } describe('RecentRunProtocolCarousel', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/RobotDashboard/hooks/__tests__/useHardwareStatusText.test.tsx b/app/src/organisms/ODD/RobotDashboard/hooks/__tests__/useHardwareStatusText.test.tsx index f209e69f5ec..996e00d56c7 100644 --- a/app/src/organisms/ODD/RobotDashboard/hooks/__tests__/useHardwareStatusText.test.tsx +++ b/app/src/organisms/ODD/RobotDashboard/hooks/__tests__/useHardwareStatusText.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { I18nextProvider } from 'react-i18next' import { renderHook } from '@testing-library/react' import { beforeEach, describe, expect, it, vi } from 'vitest' @@ -7,10 +6,12 @@ import { i18n } from '/app/i18n' import { useFeatureFlag } from '/app/redux/config' import { useHardwareStatusText } from '..' +import type { FunctionComponent, ReactNode } from 'react' + vi.mock('/app/redux/config') describe('useHardwareStatusText', () => { - let wrapper: React.FunctionComponent<{ children: React.ReactNode }> + let wrapper: FunctionComponent<{ children: ReactNode }> beforeEach(() => { wrapper = ({ children }) => ( {children} diff --git a/app/src/organisms/ODD/RobotSettingsDashboard/LanguageSetting.tsx b/app/src/organisms/ODD/RobotSettingsDashboard/LanguageSetting.tsx index 49f58e26993..50af850a44f 100644 --- a/app/src/organisms/ODD/RobotSettingsDashboard/LanguageSetting.tsx +++ b/app/src/organisms/ODD/RobotSettingsDashboard/LanguageSetting.tsx @@ -1,7 +1,8 @@ -import { Fragment } from 'react' +import { Fragment, useEffect } from 'react' import { useTranslation } from 'react-i18next' import { useDispatch, useSelector } from 'react-redux' import styled from 'styled-components' +import uuidv1 from 'uuid/v4' import { BORDERS, @@ -14,6 +15,8 @@ import { } from '@opentrons/components' import { LANGUAGES } from '/app/i18n' +import { ANALYTICS_LANGUAGE_UPDATED_ODD_SETTINGS } from '/app/redux/analytics' +import { useTrackEventWithRobotSerial } from '/app/redux-resources/analytics' import { ChildNavigation } from '/app/organisms/ODD/ChildNavigation' import { getAppLanguage, updateConfigValue } from '/app/redux/config' @@ -42,16 +45,31 @@ interface LanguageSettingProps { setCurrentOption: SetSettingOption } +const uuid: () => string = uuidv1 + export function LanguageSetting({ setCurrentOption, }: LanguageSettingProps): JSX.Element { const { t } = useTranslation('app_settings') const dispatch = useDispatch() + const { trackEventWithRobotSerial } = useTrackEventWithRobotSerial() + + let transactionId = '' + useEffect(() => { + transactionId = uuid() + }, []) const appLanguage = useSelector(getAppLanguage) const handleChange = (event: ChangeEvent): void => { dispatch(updateConfigValue('language.appLanguage', event.target.value)) + trackEventWithRobotSerial({ + name: ANALYTICS_LANGUAGE_UPDATED_ODD_SETTINGS, + properties: { + language: event.target.value, + transactionId, + }, + }) } return ( diff --git a/app/src/organisms/ODD/RobotSettingsDashboard/NetworkSettings/RobotSettingsSelectAuthenticationType.tsx b/app/src/organisms/ODD/RobotSettingsDashboard/NetworkSettings/RobotSettingsSelectAuthenticationType.tsx index f8ce5e6a205..8193a44b23b 100644 --- a/app/src/organisms/ODD/RobotSettingsDashboard/NetworkSettings/RobotSettingsSelectAuthenticationType.tsx +++ b/app/src/organisms/ODD/RobotSettingsDashboard/NetworkSettings/RobotSettingsSelectAuthenticationType.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useTranslation } from 'react-i18next' import { DIRECTION_COLUMN, Flex } from '@opentrons/components' @@ -6,6 +5,7 @@ import { DIRECTION_COLUMN, Flex } from '@opentrons/components' import { ChildNavigation } from '/app/organisms/ODD/ChildNavigation' import { SelectAuthenticationType } from '../../NetworkSettings' +import type { Dispatch, SetStateAction } from 'react' import type { WifiSecurityType } from '@opentrons/api-client' import type { SetSettingOption } from '../types' @@ -13,7 +13,7 @@ interface RobotSettingsSelectAuthenticationTypeProps { handleWifiConnect: () => void selectedAuthType: WifiSecurityType setCurrentOption: SetSettingOption - setSelectedAuthType: React.Dispatch> + setSelectedAuthType: Dispatch> } /** diff --git a/app/src/organisms/ODD/RobotSettingsDashboard/NetworkSettings/RobotSettingsSetWifiCred.tsx b/app/src/organisms/ODD/RobotSettingsDashboard/NetworkSettings/RobotSettingsSetWifiCred.tsx index 9204f22f5c4..aaafbf5d590 100644 --- a/app/src/organisms/ODD/RobotSettingsDashboard/NetworkSettings/RobotSettingsSetWifiCred.tsx +++ b/app/src/organisms/ODD/RobotSettingsDashboard/NetworkSettings/RobotSettingsSetWifiCred.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useTranslation } from 'react-i18next' import { DIRECTION_COLUMN, Flex } from '@opentrons/components' @@ -6,13 +5,14 @@ import { DIRECTION_COLUMN, Flex } from '@opentrons/components' import { ChildNavigation } from '/app/organisms/ODD/ChildNavigation' import { SetWifiCred } from '../../NetworkSettings/SetWifiCred' +import type { Dispatch, SetStateAction } from 'react' import type { SetSettingOption } from '../types' interface RobotSettingsSetWifiCredProps { handleConnect: () => void password: string setCurrentOption: SetSettingOption - setPassword: React.Dispatch> + setPassword: Dispatch> } /** diff --git a/app/src/organisms/ODD/RobotSettingsDashboard/NetworkSettings/RobotSettingsWifi.tsx b/app/src/organisms/ODD/RobotSettingsDashboard/NetworkSettings/RobotSettingsWifi.tsx index add3565fe74..67edb5249ff 100644 --- a/app/src/organisms/ODD/RobotSettingsDashboard/NetworkSettings/RobotSettingsWifi.tsx +++ b/app/src/organisms/ODD/RobotSettingsDashboard/NetworkSettings/RobotSettingsWifi.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useTranslation } from 'react-i18next' import { DIRECTION_COLUMN, Flex } from '@opentrons/components' @@ -6,11 +5,12 @@ import { DIRECTION_COLUMN, Flex } from '@opentrons/components' import { ChildNavigation } from '/app/organisms/ODD/ChildNavigation' import { WifiConnectionDetails } from './WifiConnectionDetails' +import type { Dispatch, SetStateAction } from 'react' import type { WifiSecurityType } from '@opentrons/api-client' import type { SetSettingOption } from '../types' interface RobotSettingsWifiProps { - setSelectedSsid: React.Dispatch> + setSelectedSsid: Dispatch> setCurrentOption: SetSettingOption activeSsid?: string connectedWifiAuthType?: WifiSecurityType diff --git a/app/src/organisms/ODD/RobotSettingsDashboard/NetworkSettings/__tests__/EthernetConnectionDetails.test.tsx b/app/src/organisms/ODD/RobotSettingsDashboard/NetworkSettings/__tests__/EthernetConnectionDetails.test.tsx index ddefd80196d..d034b6b6e7c 100644 --- a/app/src/organisms/ODD/RobotSettingsDashboard/NetworkSettings/__tests__/EthernetConnectionDetails.test.tsx +++ b/app/src/organisms/ODD/RobotSettingsDashboard/NetworkSettings/__tests__/EthernetConnectionDetails.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, vi, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' @@ -11,13 +10,13 @@ import { getLocalRobot } from '/app/redux/discovery' import { mockConnectedRobot } from '/app/redux/discovery/__fixtures__' import { EthernetConnectionDetails } from '../EthernetConnectionDetails' +import type { ComponentProps } from 'react' + vi.mock('/app/redux/discovery') vi.mock('/app/redux/discovery/selectors') vi.mock('/app/redux/networking/selectors') -const render = ( - props: React.ComponentProps -) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) @@ -31,7 +30,7 @@ const mockEthernet = { } describe('EthernetConnectionDetails', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { handleGoBack: vi.fn(), diff --git a/app/src/organisms/ODD/RobotSettingsDashboard/NetworkSettings/__tests__/NetworkDetailsModal.test.tsx b/app/src/organisms/ODD/RobotSettingsDashboard/NetworkSettings/__tests__/NetworkDetailsModal.test.tsx index 76b4c6f1be0..6b4048dbcfc 100644 --- a/app/src/organisms/ODD/RobotSettingsDashboard/NetworkSettings/__tests__/NetworkDetailsModal.test.tsx +++ b/app/src/organisms/ODD/RobotSettingsDashboard/NetworkSettings/__tests__/NetworkDetailsModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, vi, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' @@ -7,16 +6,18 @@ import { i18n } from '/app/i18n' import { renderWithProviders } from '/app/__testing-utils__' import { NetworkDetailsModal } from '../NetworkDetailsModal' +import type { ComponentProps } from 'react' + const mockFn = vi.fn() -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('NetworkDetailsModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/RobotSettingsDashboard/NetworkSettings/__tests__/NetworkSettings.test.tsx b/app/src/organisms/ODD/RobotSettingsDashboard/NetworkSettings/__tests__/NetworkSettings.test.tsx index 266778c0c81..37a5db9c3f2 100644 --- a/app/src/organisms/ODD/RobotSettingsDashboard/NetworkSettings/__tests__/NetworkSettings.test.tsx +++ b/app/src/organisms/ODD/RobotSettingsDashboard/NetworkSettings/__tests__/NetworkSettings.test.tsx @@ -1,5 +1,4 @@ /* eslint-disable testing-library/no-node-access */ -import type * as React from 'react' import { screen } from '@testing-library/react' import { describe, it, expect, vi, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' @@ -12,6 +11,7 @@ import { WifiConnectionDetails } from '../WifiConnectionDetails' import { EthernetConnectionDetails } from '../EthernetConnectionDetails' import { NetworkSettings } from '..' +import type { ComponentProps } from 'react' import type { DiscoveredRobot } from '/app/redux/discovery/types' import type { WifiNetwork } from '/app/redux/networking/types' @@ -22,14 +22,14 @@ vi.mock('../EthernetConnectionDetails') const mockSetCurrentOption = vi.fn() -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('NetworkSettings', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/RobotSettingsDashboard/NetworkSettings/__tests__/WifiConnectionDetails.test.tsx b/app/src/organisms/ODD/RobotSettingsDashboard/NetworkSettings/__tests__/WifiConnectionDetails.test.tsx index 9650a89b76c..c7311087fe4 100644 --- a/app/src/organisms/ODD/RobotSettingsDashboard/NetworkSettings/__tests__/WifiConnectionDetails.test.tsx +++ b/app/src/organisms/ODD/RobotSettingsDashboard/NetworkSettings/__tests__/WifiConnectionDetails.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { when } from 'vitest-when' import { describe, it, expect, vi, beforeEach } from 'vitest' @@ -10,6 +9,8 @@ import { getLocalRobot } from '/app/redux/discovery' import * as Networking from '/app/redux/networking' import { NetworkDetailsModal } from '../NetworkDetailsModal' import { WifiConnectionDetails } from '../WifiConnectionDetails' + +import type { ComponentProps } from 'react' import type * as Dom from 'react-router-dom' import type { State } from '/app/redux/types' @@ -36,14 +37,14 @@ const initialMockWifi = { type: Networking.INTERFACE_WIFI, } -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('WifiConnectionDetails', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { activeSsid: 'mock wifi ssid', diff --git a/app/src/organisms/ODD/RobotSettingsDashboard/NetworkSettings/index.tsx b/app/src/organisms/ODD/RobotSettingsDashboard/NetworkSettings/index.tsx index db73b89dae3..9afeeb15cc0 100644 --- a/app/src/organisms/ODD/RobotSettingsDashboard/NetworkSettings/index.tsx +++ b/app/src/organisms/ODD/RobotSettingsDashboard/NetworkSettings/index.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { css } from 'styled-components' import { useTranslation } from 'react-i18next' @@ -19,6 +18,7 @@ import { import { ChildNavigation } from '/app/organisms/ODD/ChildNavigation' +import type { ComponentProps } from 'react' import type { IconName, ChipType } from '@opentrons/components' import type { NetworkConnection } from '/app/resources/networking/hooks/useNetworkConnection' import type { SetSettingOption } from '../types' @@ -87,7 +87,7 @@ export function NetworkSettings({ ) } -interface NetworkSettingButtonProps extends React.ComponentProps { +interface NetworkSettingButtonProps extends ComponentProps { buttonTitle: string iconName: IconName chipType: ChipType diff --git a/app/src/organisms/ODD/RobotSettingsDashboard/RobotSettingButton.tsx b/app/src/organisms/ODD/RobotSettingsDashboard/RobotSettingButton.tsx index f777c9fcb77..1a47e3bbe4e 100644 --- a/app/src/organisms/ODD/RobotSettingsDashboard/RobotSettingButton.tsx +++ b/app/src/organisms/ODD/RobotSettingsDashboard/RobotSettingButton.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { css } from 'styled-components' import { @@ -20,6 +19,7 @@ import { TYPOGRAPHY, } from '@opentrons/components' +import type { MouseEventHandler, ReactNode } from 'react' import type { IconName } from '@opentrons/components' const SETTING_BUTTON_STYLE = css` @@ -36,10 +36,10 @@ const SETTING_BUTTON_STYLE = css` interface RobotSettingButtonProps { settingName: string - onClick: React.MouseEventHandler + onClick: MouseEventHandler iconName?: IconName settingInfo?: string - rightElement?: React.ReactNode + rightElement?: ReactNode dataTestId?: string } diff --git a/app/src/organisms/ODD/RobotSettingsDashboard/__tests__/DeviceReset.test.tsx b/app/src/organisms/ODD/RobotSettingsDashboard/__tests__/DeviceReset.test.tsx index 9f71205231e..3f273ab2df2 100644 --- a/app/src/organisms/ODD/RobotSettingsDashboard/__tests__/DeviceReset.test.tsx +++ b/app/src/organisms/ODD/RobotSettingsDashboard/__tests__/DeviceReset.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, vi, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' @@ -9,6 +8,7 @@ import { useDispatchApiRequest } from '/app/redux/robot-api' import { DeviceReset } from '../DeviceReset' +import type { ComponentProps } from 'react' import type { DispatchApiRequestType } from '/app/redux/robot-api' vi.mock('/app/redux/robot-admin') @@ -47,7 +47,7 @@ const mockResetConfigOptions = [ }, ] -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders( , @@ -56,7 +56,7 @@ const render = (props: React.ComponentProps) => { } describe('DeviceReset', () => { - let props: React.ComponentProps + let props: ComponentProps let dispatchApiRequest: DispatchApiRequestType beforeEach(() => { diff --git a/app/src/organisms/ODD/RobotSettingsDashboard/__tests__/LanguageSetting.test.tsx b/app/src/organisms/ODD/RobotSettingsDashboard/__tests__/LanguageSetting.test.tsx index 80d35ebea15..50ce6edc7e6 100644 --- a/app/src/organisms/ODD/RobotSettingsDashboard/__tests__/LanguageSetting.test.tsx +++ b/app/src/organisms/ODD/RobotSettingsDashboard/__tests__/LanguageSetting.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, vi, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' @@ -10,28 +9,37 @@ import { SIMPLIFIED_CHINESE_DISPLAY_NAME, SIMPLIFIED_CHINESE, } from '/app/i18n' +import { ANALYTICS_LANGUAGE_UPDATED_ODD_SETTINGS } from '/app/redux/analytics' +import { useTrackEventWithRobotSerial } from '/app/redux-resources/analytics' import { getAppLanguage, updateConfigValue } from '/app/redux/config' import { renderWithProviders } from '/app/__testing-utils__' import { LanguageSetting } from '../LanguageSetting' +import type { ComponentProps } from 'react' + vi.mock('/app/redux/config') +vi.mock('/app/redux-resources/analytics') const mockSetCurrentOption = vi.fn() +const mockTrackEvent = vi.fn() -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('LanguageSetting', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { setCurrentOption: mockSetCurrentOption, } vi.mocked(getAppLanguage).mockReturnValue(US_ENGLISH) + vi.mocked(useTrackEventWithRobotSerial).mockReturnValue({ + trackEventWithRobotSerial: mockTrackEvent, + }) }) it('should render text and buttons', () => { @@ -49,6 +57,13 @@ describe('LanguageSetting', () => { 'language.appLanguage', SIMPLIFIED_CHINESE ) + expect(mockTrackEvent).toHaveBeenCalledWith({ + name: ANALYTICS_LANGUAGE_UPDATED_ODD_SETTINGS, + properties: { + language: SIMPLIFIED_CHINESE, + transactionId: expect.anything(), + }, + }) }) it('should call mock function when tapping back button', () => { diff --git a/app/src/organisms/ODD/RobotSettingsDashboard/__tests__/Privacy.test.tsx b/app/src/organisms/ODD/RobotSettingsDashboard/__tests__/Privacy.test.tsx index 03f4a987462..d281ccecf6f 100644 --- a/app/src/organisms/ODD/RobotSettingsDashboard/__tests__/Privacy.test.tsx +++ b/app/src/organisms/ODD/RobotSettingsDashboard/__tests__/Privacy.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { vi, describe, beforeEach, afterEach, expect, it } from 'vitest' @@ -9,17 +8,19 @@ import { getRobotSettings } from '/app/redux/robot-settings' import { Privacy } from '../Privacy' +import type { ComponentProps } from 'react' + vi.mock('/app/redux/analytics') vi.mock('/app/redux/robot-settings') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('Privacy', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { robotName: 'Otie', diff --git a/app/src/organisms/ODD/RobotSettingsDashboard/__tests__/RobotSystemVersion.test.tsx b/app/src/organisms/ODD/RobotSettingsDashboard/__tests__/RobotSystemVersion.test.tsx index ad30e2539fa..955161149d8 100644 --- a/app/src/organisms/ODD/RobotSettingsDashboard/__tests__/RobotSystemVersion.test.tsx +++ b/app/src/organisms/ODD/RobotSettingsDashboard/__tests__/RobotSystemVersion.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { MemoryRouter } from 'react-router-dom' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, vi, beforeEach } from 'vitest' @@ -9,12 +8,14 @@ import { renderWithProviders } from '/app/__testing-utils__' import { RobotSystemVersion } from '../RobotSystemVersion' import { RobotSystemVersionModal } from '../RobotSystemVersionModal' +import type { ComponentProps } from 'react' + vi.mock('/app/redux/shell') vi.mock('../RobotSystemVersionModal') const mockBack = vi.fn() -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders( @@ -26,7 +27,7 @@ const render = (props: React.ComponentProps) => { } describe('RobotSystemVersion', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/RobotSettingsDashboard/__tests__/RobotSystemVersionModal.test.tsx b/app/src/organisms/ODD/RobotSettingsDashboard/__tests__/RobotSystemVersionModal.test.tsx index 0d7a125eb1f..0b8f891f1a5 100644 --- a/app/src/organisms/ODD/RobotSettingsDashboard/__tests__/RobotSystemVersionModal.test.tsx +++ b/app/src/organisms/ODD/RobotSettingsDashboard/__tests__/RobotSystemVersionModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, vi, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' @@ -6,6 +5,8 @@ import '@testing-library/jest-dom/vitest' import { i18n } from '/app/i18n' import { renderWithProviders } from '/app/__testing-utils__' import { RobotSystemVersionModal } from '../RobotSystemVersionModal' + +import type { ComponentProps } from 'react' import type * as Dom from 'react-router-dom' const mockFn = vi.fn() @@ -19,16 +20,14 @@ vi.mock('react-router-dom', async importOriginal => { } }) -const render = ( - props: React.ComponentProps -) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('RobotSystemVersionModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/RobotSettingsDashboard/__tests__/TextSize.test.tsx b/app/src/organisms/ODD/RobotSettingsDashboard/__tests__/TextSize.test.tsx index 703323c0d7e..3ca0124810a 100644 --- a/app/src/organisms/ODD/RobotSettingsDashboard/__tests__/TextSize.test.tsx +++ b/app/src/organisms/ODD/RobotSettingsDashboard/__tests__/TextSize.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, vi, beforeEach } from 'vitest' @@ -6,15 +5,17 @@ import { i18n } from '/app/i18n' import { renderWithProviders } from '/app/__testing-utils__' import { TextSize } from '../TextSize' +import type { ComponentProps } from 'react' + const mockFunc = vi.fn() -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('TextSize', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/RobotSettingsDashboard/__tests__/TouchScreenSleep.test.tsx b/app/src/organisms/ODD/RobotSettingsDashboard/__tests__/TouchScreenSleep.test.tsx index 990c6bcf436..6c75c584cfe 100644 --- a/app/src/organisms/ODD/RobotSettingsDashboard/__tests__/TouchScreenSleep.test.tsx +++ b/app/src/organisms/ODD/RobotSettingsDashboard/__tests__/TouchScreenSleep.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, vi, beforeEach } from 'vitest' import { i18n } from '/app/i18n' @@ -6,19 +5,21 @@ import { updateConfigValue } from '/app/redux/config' import { TouchScreenSleep } from '../TouchScreenSleep' import { renderWithProviders } from '/app/__testing-utils__' +import type { ComponentProps } from 'react' + vi.mock('/app/redux/config') // Note (kj:06/28/2023) this line is to avoid causing errors for scrollIntoView window.HTMLElement.prototype.scrollIntoView = vi.fn() -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('TouchScreenSleep', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/RobotSettingsDashboard/__tests__/TouchscreenBrightness.test.tsx b/app/src/organisms/ODD/RobotSettingsDashboard/__tests__/TouchscreenBrightness.test.tsx index 76993c42300..0dd4c87331d 100644 --- a/app/src/organisms/ODD/RobotSettingsDashboard/__tests__/TouchscreenBrightness.test.tsx +++ b/app/src/organisms/ODD/RobotSettingsDashboard/__tests__/TouchscreenBrightness.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, vi, beforeEach } from 'vitest' @@ -10,18 +9,20 @@ import { import { renderWithProviders } from '/app/__testing-utils__' import { TouchscreenBrightness } from '../TouchscreenBrightness' +import type { ComponentProps } from 'react' + vi.mock('/app/redux/config') const mockFunc = vi.fn() -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('TouchscreenBrightness', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/RobotSettingsDashboard/__tests__/UpdateChannel.test.tsx b/app/src/organisms/ODD/RobotSettingsDashboard/__tests__/UpdateChannel.test.tsx index c25e9582a4b..5cf5d34ffde 100644 --- a/app/src/organisms/ODD/RobotSettingsDashboard/__tests__/UpdateChannel.test.tsx +++ b/app/src/organisms/ODD/RobotSettingsDashboard/__tests__/UpdateChannel.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, vi, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' @@ -13,6 +12,8 @@ import { renderWithProviders } from '/app/__testing-utils__' import { UpdateChannel } from '../UpdateChannel' +import type { ComponentProps } from 'react' + vi.mock('/app/redux/config') const mockChannelOptions = [ @@ -26,14 +27,14 @@ const mockChannelOptions = [ const mockhandleBackPress = vi.fn() -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('UpdateChannel', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { handleBackPress: mockhandleBackPress, diff --git a/app/src/organisms/ODD/RobotSetupHeader/index.tsx b/app/src/organisms/ODD/RobotSetupHeader/index.tsx index 6b7a3fa1049..3e828ddb061 100644 --- a/app/src/organisms/ODD/RobotSetupHeader/index.tsx +++ b/app/src/organisms/ODD/RobotSetupHeader/index.tsx @@ -1,5 +1,3 @@ -import type * as React from 'react' - import { ALIGN_CENTER, Btn, @@ -17,14 +15,15 @@ import { import { SmallButton } from '/app/atoms/buttons' import { InlineNotification } from '/app/atoms/InlineNotification' +import type { MouseEventHandler, ReactNode } from 'react' import type { InlineNotificationProps } from '/app/atoms/InlineNotification' interface RobotSetupHeaderProps { header: string - buttonText?: React.ReactNode + buttonText?: ReactNode inlineNotification?: InlineNotificationProps - onClickBack?: React.MouseEventHandler - onClickButton?: React.MouseEventHandler + onClickBack?: MouseEventHandler + onClickButton?: MouseEventHandler } export function RobotSetupHeader({ diff --git a/app/src/organisms/ODD/RunningProtocol/__tests__/ConfirmCancelRunModal.test.tsx b/app/src/organisms/ODD/RunningProtocol/__tests__/ConfirmCancelRunModal.test.tsx index 69f610d3ef8..bef530f1458 100644 --- a/app/src/organisms/ODD/RunningProtocol/__tests__/ConfirmCancelRunModal.test.tsx +++ b/app/src/organisms/ODD/RunningProtocol/__tests__/ConfirmCancelRunModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { when } from 'vitest-when' import { MemoryRouter } from 'react-router-dom' import { fireEvent, screen } from '@testing-library/react' @@ -21,6 +20,7 @@ import { mockConnectedRobot } from '/app/redux/discovery/__fixtures__' import { ConfirmCancelRunModal } from '../ConfirmCancelRunModal' import { CancelingRunModal } from '../CancelingRunModal' +import type { ComponentProps } from 'react' import type { NavigateFunction } from 'react-router-dom' vi.mock('@opentrons/react-api-client') @@ -46,7 +46,7 @@ vi.mock('react-router-dom', async importOriginal => { } }) -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders( @@ -63,7 +63,7 @@ const ROBOT_NAME = 'otie' const mockFn = vi.fn() describe('ConfirmCancelRunModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/RunningProtocol/__tests__/CurrentRunningProtocolCommand.test.tsx b/app/src/organisms/ODD/RunningProtocol/__tests__/CurrentRunningProtocolCommand.test.tsx index 581df7c013c..ceda8df2e42 100644 --- a/app/src/organisms/ODD/RunningProtocol/__tests__/CurrentRunningProtocolCommand.test.tsx +++ b/app/src/organisms/ODD/RunningProtocol/__tests__/CurrentRunningProtocolCommand.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' @@ -12,6 +11,8 @@ import { useRunningStepCounts } from '/app/resources/protocols/hooks' import { useNotifyAllCommandsQuery } from '/app/resources/runs' import { FLEX_ROBOT_TYPE } from '@opentrons/shared-data' +import type { ComponentProps } from 'react' + vi.mock('/app/resources/runs') vi.mock('/app/resources/protocols/hooks') @@ -28,7 +29,7 @@ const mockRunTimer = { } const render = ( - props: React.ComponentProps + props: ComponentProps ) => { return renderWithProviders(, { i18nInstance: i18n, @@ -36,7 +37,7 @@ const render = ( } describe('CurrentRunningProtocolCommand', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/RunningProtocol/__tests__/RunFailedModal.test.tsx b/app/src/organisms/ODD/RunningProtocol/__tests__/RunFailedModal.test.tsx index 8dcfd2e5b88..40e1366d324 100644 --- a/app/src/organisms/ODD/RunningProtocol/__tests__/RunFailedModal.test.tsx +++ b/app/src/organisms/ODD/RunningProtocol/__tests__/RunFailedModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { MemoryRouter } from 'react-router-dom' import { fireEvent, screen } from '@testing-library/react' import { beforeEach, describe, expect, it, vi } from 'vitest' @@ -12,6 +11,8 @@ import { RunFailedModal } from '../RunFailedModal' import type { NavigateFunction } from 'react-router-dom' import { RUN_STATUS_FAILED } from '@opentrons/api-client' +import type { ComponentProps } from 'react' + vi.mock('@opentrons/react-api-client') const RUN_ID = 'mock_runID' @@ -82,7 +83,7 @@ vi.mock('react-router-dom', async importOriginal => { } }) -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders( @@ -94,7 +95,7 @@ const render = (props: React.ComponentProps) => { } describe('RunFailedModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/ODD/RunningProtocol/__tests__/RunningProtocolCommandList.test.tsx b/app/src/organisms/ODD/RunningProtocol/__tests__/RunningProtocolCommandList.test.tsx index 199ae940c3b..5f2ceba8121 100644 --- a/app/src/organisms/ODD/RunningProtocol/__tests__/RunningProtocolCommandList.test.tsx +++ b/app/src/organisms/ODD/RunningProtocol/__tests__/RunningProtocolCommandList.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { beforeEach, describe, expect, it, vi } from 'vitest' @@ -10,20 +9,20 @@ import { i18n } from '/app/i18n' import { mockRobotSideAnalysis } from '/app/molecules/Command/__fixtures__' import { RunningProtocolCommandList } from '../RunningProtocolCommandList' +import type { ComponentProps } from 'react' + const mockPlayRun = vi.fn() const mockPauseRun = vi.fn() const mockShowModal = vi.fn() -const render = ( - props: React.ComponentProps -) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('RunningProtocolCommandList', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { runStatus: RUN_STATUS_RUNNING, diff --git a/app/src/organisms/ODD/RunningProtocol/__tests__/RunningProtocolSkeleton.test.tsx b/app/src/organisms/ODD/RunningProtocol/__tests__/RunningProtocolSkeleton.test.tsx index 656d4d250d1..fcd48819c49 100644 --- a/app/src/organisms/ODD/RunningProtocol/__tests__/RunningProtocolSkeleton.test.tsx +++ b/app/src/organisms/ODD/RunningProtocol/__tests__/RunningProtocolSkeleton.test.tsx @@ -1,18 +1,17 @@ -import type * as React from 'react' import { screen } from '@testing-library/react' import { beforeEach, describe, expect, it } from 'vitest' import { renderWithProviders } from '/app/__testing-utils__' import { RunningProtocolSkeleton } from '../RunningProtocolSkeleton' -const render = ( - props: React.ComponentProps -) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders() } describe('RunningProtocolSkeleton', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/PipetteWizardFlows/CheckPipetteButton.tsx b/app/src/organisms/PipetteWizardFlows/CheckPipetteButton.tsx index 2300204b65b..25438c1442c 100644 --- a/app/src/organisms/PipetteWizardFlows/CheckPipetteButton.tsx +++ b/app/src/organisms/PipetteWizardFlows/CheckPipetteButton.tsx @@ -1,11 +1,12 @@ -import type * as React from 'react' import { useInstrumentsQuery } from '@opentrons/react-api-client' import { PrimaryButton } from '@opentrons/components' import { SmallButton } from '/app/atoms/buttons' +import type { Dispatch, SetStateAction } from 'react' + interface CheckPipetteButtonProps { proceedButtonText: string - setFetching: React.Dispatch> + setFetching: Dispatch> isFetching: boolean isOnDevice: boolean | null proceed?: () => void diff --git a/app/src/organisms/PipetteWizardFlows/MountPipette.tsx b/app/src/organisms/PipetteWizardFlows/MountPipette.tsx index 9ba1b036785..b750aee0ad2 100644 --- a/app/src/organisms/PipetteWizardFlows/MountPipette.tsx +++ b/app/src/organisms/PipetteWizardFlows/MountPipette.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useTranslation } from 'react-i18next' import { SINGLE_MOUNT_PIPETTES, @@ -17,11 +16,13 @@ import { Skeleton } from '/app/atoms/Skeleton' import { CheckPipetteButton } from './CheckPipetteButton' import { BODY_STYLE, SECTIONS } from './constants' import { getPipetteAnimations, getPipetteAnimations96 } from './utils' + +import type { Dispatch, ReactNode, SetStateAction } from 'react' import type { PipetteWizardStepProps } from './types' interface MountPipetteProps extends PipetteWizardStepProps { isFetching: boolean - setFetching: React.Dispatch> + setFetching: Dispatch> } const BACKGROUND_SIZE = '47rem' @@ -47,7 +48,7 @@ export const MountPipette = (props: MountPipetteProps): JSX.Element => { backgroundSize={BACKGROUND_SIZE} /> ) - let bodyText: React.ReactNode =
        + let bodyText: ReactNode =
        if (isFetching) { bodyText = ( <> diff --git a/app/src/organisms/PipetteWizardFlows/__tests__/AttachProbe.test.tsx b/app/src/organisms/PipetteWizardFlows/__tests__/AttachProbe.test.tsx index 00120fe438a..0bbab02ebc5 100644 --- a/app/src/organisms/PipetteWizardFlows/__tests__/AttachProbe.test.tsx +++ b/app/src/organisms/PipetteWizardFlows/__tests__/AttachProbe.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen, waitFor } from '@testing-library/react' import { describe, it, beforeEach, vi, expect } from 'vitest' @@ -16,7 +15,9 @@ import { FLOWS } from '../constants' import { AttachProbe } from '../AttachProbe' import { useNotifyDeckConfigurationQuery } from '/app/resources/deck_configuration' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] @@ -24,7 +25,7 @@ const render = (props: React.ComponentProps) => { vi.mock('/app/resources/deck_configuration') describe('AttachProbe', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { mount: LEFT, diff --git a/app/src/organisms/PipetteWizardFlows/__tests__/BeforeBeginning.test.tsx b/app/src/organisms/PipetteWizardFlows/__tests__/BeforeBeginning.test.tsx index a75e8bfe97a..db8b03816c2 100644 --- a/app/src/organisms/PipetteWizardFlows/__tests__/BeforeBeginning.test.tsx +++ b/app/src/organisms/PipetteWizardFlows/__tests__/BeforeBeginning.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, waitFor, screen } from '@testing-library/react' import { describe, it, vi, beforeEach, expect, afterEach } from 'vitest' @@ -19,19 +18,21 @@ import { BeforeBeginning } from '../BeforeBeginning' import { FLOWS } from '../constants' import { getIsGantryEmpty } from '../utils' +import type { ComponentProps } from 'react' + // TODO(jr, 11/3/22): uncomment out the get help link when we have // the correct URL to link it to vi.mock('/app/molecules/InProgressModal/InProgressModal') vi.mock('../utils') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('BeforeBeginning', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { selectedPipette: SINGLE_MOUNT_PIPETTES, diff --git a/app/src/organisms/PipetteWizardFlows/__tests__/Carriage.test.tsx b/app/src/organisms/PipetteWizardFlows/__tests__/Carriage.test.tsx index 17c8140ebe8..389fde2801f 100644 --- a/app/src/organisms/PipetteWizardFlows/__tests__/Carriage.test.tsx +++ b/app/src/organisms/PipetteWizardFlows/__tests__/Carriage.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, beforeEach, vi, expect } from 'vitest' @@ -11,14 +10,16 @@ import { RUN_ID_1 } from '/app/resources/runs/__fixtures__' import { FLOWS } from '../constants' import { Carriage } from '../Carriage' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('Carriage', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { mount: LEFT, diff --git a/app/src/organisms/PipetteWizardFlows/__tests__/CheckPipetteButton.test.tsx b/app/src/organisms/PipetteWizardFlows/__tests__/CheckPipetteButton.test.tsx index e5dfc5fe3de..76c60357b46 100644 --- a/app/src/organisms/PipetteWizardFlows/__tests__/CheckPipetteButton.test.tsx +++ b/app/src/organisms/PipetteWizardFlows/__tests__/CheckPipetteButton.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, waitFor, screen } from '@testing-library/react' import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest' @@ -7,14 +6,16 @@ import { useInstrumentsQuery } from '@opentrons/react-api-client' import { renderWithProviders } from '/app/__testing-utils__' import { CheckPipetteButton } from '../CheckPipetteButton' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders()[0] } vi.mock('@opentrons/react-api-client') describe('CheckPipetteButton', () => { - let props: React.ComponentProps + let props: ComponentProps const refetch = vi.fn(() => Promise.resolve()) beforeEach(() => { props = { diff --git a/app/src/organisms/PipetteWizardFlows/__tests__/ChoosePipette.test.tsx b/app/src/organisms/PipetteWizardFlows/__tests__/ChoosePipette.test.tsx index bda196f388c..ab14c846013 100644 --- a/app/src/organisms/PipetteWizardFlows/__tests__/ChoosePipette.test.tsx +++ b/app/src/organisms/PipetteWizardFlows/__tests__/ChoosePipette.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { LEFT, NINETY_SIX_CHANNEL, @@ -17,18 +16,20 @@ import { useAttachedPipettesFromInstrumentsQuery } from '/app/resources/instrume import { ChoosePipette } from '../ChoosePipette' import { getIsGantryEmpty } from '../utils' +import type { ComponentProps } from 'react' + vi.mock('../utils') vi.mock('/app/resources/instruments') vi.mock('/app/redux/config') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('ChoosePipette', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { vi.mocked(getIsOnDevice).mockReturnValue(false) vi.mocked(getIsGantryEmpty).mockReturnValue(true) diff --git a/app/src/organisms/PipetteWizardFlows/__tests__/DetachPipette.test.tsx b/app/src/organisms/PipetteWizardFlows/__tests__/DetachPipette.test.tsx index d7777ed368c..a8f85ef3d73 100644 --- a/app/src/organisms/PipetteWizardFlows/__tests__/DetachPipette.test.tsx +++ b/app/src/organisms/PipetteWizardFlows/__tests__/DetachPipette.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, beforeEach, vi, expect } from 'vitest' @@ -19,17 +18,19 @@ import { RUN_ID_1 } from '/app/resources/runs/__fixtures__' import { FLOWS } from '../constants' import { DetachPipette } from '../DetachPipette' +import type { ComponentProps } from 'react' + vi.mock('../CheckPipetteButton') vi.mock('/app/molecules/InProgressModal/InProgressModal') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('DetachPipette', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { selectedPipette: SINGLE_MOUNT_PIPETTES, diff --git a/app/src/organisms/PipetteWizardFlows/__tests__/DetachProbe.test.tsx b/app/src/organisms/PipetteWizardFlows/__tests__/DetachProbe.test.tsx index 059846aebb5..755c795e0d4 100644 --- a/app/src/organisms/PipetteWizardFlows/__tests__/DetachProbe.test.tsx +++ b/app/src/organisms/PipetteWizardFlows/__tests__/DetachProbe.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, beforeEach, vi, expect } from 'vitest' @@ -12,16 +11,18 @@ import { RUN_ID_1 } from '/app/resources/runs/__fixtures__' import { FLOWS } from '../constants' import { DetachProbe } from '../DetachProbe' +import type { ComponentProps } from 'react' + vi.mock('/app/molecules/InProgressModal/InProgressModal') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('DetachProbe', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { selectedPipette: SINGLE_MOUNT_PIPETTES, diff --git a/app/src/organisms/PipetteWizardFlows/__tests__/ExitModal.test.tsx b/app/src/organisms/PipetteWizardFlows/__tests__/ExitModal.test.tsx index a30407379a2..b09319fcb94 100644 --- a/app/src/organisms/PipetteWizardFlows/__tests__/ExitModal.test.tsx +++ b/app/src/organisms/PipetteWizardFlows/__tests__/ExitModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, beforeEach, vi, expect } from 'vitest' @@ -7,14 +6,16 @@ import { i18n } from '/app/i18n' import { FLOWS } from '../constants' import { ExitModal } from '../ExitModal' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('ExitModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/PipetteWizardFlows/__tests__/MountPipette.test.tsx b/app/src/organisms/PipetteWizardFlows/__tests__/MountPipette.test.tsx index 4c5d9dda2e0..24e8bb926b8 100644 --- a/app/src/organisms/PipetteWizardFlows/__tests__/MountPipette.test.tsx +++ b/app/src/organisms/PipetteWizardFlows/__tests__/MountPipette.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, beforeEach, vi } from 'vitest' @@ -16,16 +15,18 @@ import { FLOWS } from '../constants' import { CheckPipetteButton } from '../CheckPipetteButton' import { MountPipette } from '../MountPipette' +import type { ComponentProps } from 'react' + vi.mock('../CheckPipetteButton') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('MountPipette', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { selectedPipette: SINGLE_MOUNT_PIPETTES, diff --git a/app/src/organisms/PipetteWizardFlows/__tests__/MountingPlate.test.tsx b/app/src/organisms/PipetteWizardFlows/__tests__/MountingPlate.test.tsx index 38744ad1bab..2393d1080d5 100644 --- a/app/src/organisms/PipetteWizardFlows/__tests__/MountingPlate.test.tsx +++ b/app/src/organisms/PipetteWizardFlows/__tests__/MountingPlate.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, waitFor, screen } from '@testing-library/react' import { describe, it, expect, beforeEach, vi } from 'vitest' @@ -10,14 +9,16 @@ import { RUN_ID_1 } from '/app/resources/runs/__fixtures__' import { FLOWS } from '../constants' import { MountingPlate } from '../MountingPlate' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('MountingPlate', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { mount: LEFT, diff --git a/app/src/organisms/PipetteWizardFlows/__tests__/Results.test.tsx b/app/src/organisms/PipetteWizardFlows/__tests__/Results.test.tsx index 3382ac401a0..df53d95cdb7 100644 --- a/app/src/organisms/PipetteWizardFlows/__tests__/Results.test.tsx +++ b/app/src/organisms/PipetteWizardFlows/__tests__/Results.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { act, fireEvent, screen, waitFor } from '@testing-library/react' import { describe, it, expect, vi, beforeEach } from 'vitest' @@ -18,19 +17,20 @@ import { RUN_ID_1 } from '/app/resources/runs/__fixtures__' import { Results } from '../Results' import { FLOWS } from '../constants' +import type { ComponentProps } from 'react' import type { Mock } from 'vitest' vi.mock('@opentrons/react-api-client') vi.mock('/app/resources/robot-settings/hooks') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('Results', () => { - let props: React.ComponentProps + let props: ComponentProps let pipettePromise: Promise let mockRefetchInstruments: Mock beforeEach(() => { diff --git a/app/src/organisms/PipetteWizardFlows/__tests__/UnskippableModal.test.tsx b/app/src/organisms/PipetteWizardFlows/__tests__/UnskippableModal.test.tsx index bc738d0caf3..f2d51af9a5f 100644 --- a/app/src/organisms/PipetteWizardFlows/__tests__/UnskippableModal.test.tsx +++ b/app/src/organisms/PipetteWizardFlows/__tests__/UnskippableModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, vi } from 'vitest' @@ -6,14 +5,16 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { UnskippableModal } from '../UnskippableModal' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('UnskippableModal', () => { - let props: React.ComponentProps + let props: ComponentProps it('returns the correct information for unskippable modal, pressing return button calls goBack prop', () => { props = { goBack: vi.fn(), diff --git a/app/src/organisms/PipetteWizardFlows/__tests__/hooks.test.tsx b/app/src/organisms/PipetteWizardFlows/__tests__/hooks.test.tsx index f44bd96fc6e..996ec520af2 100644 --- a/app/src/organisms/PipetteWizardFlows/__tests__/hooks.test.tsx +++ b/app/src/organisms/PipetteWizardFlows/__tests__/hooks.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, beforeEach, vi, afterEach, expect } from 'vitest' import { I18nextProvider } from 'react-i18next' import { renderHook } from '@testing-library/react' @@ -16,6 +15,8 @@ import { import { FLOWS } from '../constants' import { usePipetteFlowWizardHeaderText } from '../hooks' +import type { FunctionComponent, ReactNode } from 'react' + const BASE_PROPS_FOR_RUN_SETUP = { flowType: FLOWS.CALIBRATE, selectedPipette: SINGLE_MOUNT_PIPETTES, @@ -23,7 +24,7 @@ const BASE_PROPS_FOR_RUN_SETUP = { } describe('usePipetteFlowWizardHeaderText', () => { - let wrapper: React.FunctionComponent<{ children: React.ReactNode }> + let wrapper: FunctionComponent<{ children: ReactNode }> beforeEach(() => { wrapper = ({ children }) => ( {children} diff --git a/app/src/organisms/PipetteWizardFlows/types.ts b/app/src/organisms/PipetteWizardFlows/types.ts index a8785e8a31c..3870141ab6e 100644 --- a/app/src/organisms/PipetteWizardFlows/types.ts +++ b/app/src/organisms/PipetteWizardFlows/types.ts @@ -1,6 +1,7 @@ -import type { SECTIONS, FLOWS } from './constants' +import type { Dispatch, SetStateAction } from 'react' import type { useCreateCommandMutation } from '@opentrons/react-api-client' import type { PipetteMount, CreateCommand } from '@opentrons/shared-data' +import type { SECTIONS, FLOWS } from './constants' import type { AttachedPipettesFromInstrumentsQuery } from '/app/resources/instruments' export type PipetteWizardStep = @@ -78,7 +79,7 @@ export interface PipetteWizardStepProps { isRobotMoving: boolean maintenanceRunId?: string attachedPipettes: AttachedPipettesFromInstrumentsQuery - setShowErrorMessage: React.Dispatch> + setShowErrorMessage: Dispatch> errorMessage: string | null selectedPipette: SelectablePipettes isOnDevice: boolean | null diff --git a/app/src/organisms/TakeoverModal/TakeoverModal.tsx b/app/src/organisms/TakeoverModal/TakeoverModal.tsx index 8f6441124a7..34a0754609e 100644 --- a/app/src/organisms/TakeoverModal/TakeoverModal.tsx +++ b/app/src/organisms/TakeoverModal/TakeoverModal.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { createPortal } from 'react-dom' import { useTranslation } from 'react-i18next' @@ -18,12 +17,13 @@ import { getTopPortalEl } from '/app/App/portal' import { SmallButton } from '/app/atoms/buttons' import { OddModal } from '/app/molecules/OddModal' +import type { Dispatch, SetStateAction } from 'react' import type { OddModalHeaderBaseProps } from '/app/molecules/OddModal/types' interface TakeoverModalProps { title: string showConfirmTerminateModal: boolean - setShowConfirmTerminateModal: React.Dispatch> + setShowConfirmTerminateModal: Dispatch> confirmTerminate: () => void terminateInProgress: boolean } diff --git a/app/src/organisms/TakeoverModal/__tests__/MaintenanceRunTakeover.test.tsx b/app/src/organisms/TakeoverModal/__tests__/MaintenanceRunTakeover.test.tsx index 94a59aa903a..92c286e9bbd 100644 --- a/app/src/organisms/TakeoverModal/__tests__/MaintenanceRunTakeover.test.tsx +++ b/app/src/organisms/TakeoverModal/__tests__/MaintenanceRunTakeover.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { screen } from '@testing-library/react' import { describe, it, expect, vi, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' @@ -8,6 +7,7 @@ import { useMaintenanceRunTakeover } from '../useMaintenanceRunTakeover' import { MaintenanceRunTakeover } from '../MaintenanceRunTakeover' import { useNotifyCurrentMaintenanceRun } from '/app/resources/maintenance_runs' +import type { ComponentProps } from 'react' import type { MaintenanceRunStatus } from '../MaintenanceRunStatusProvider' vi.mock('../useMaintenanceRunTakeover') @@ -21,14 +21,14 @@ const MOCK_MAINTENANCE_RUN: MaintenanceRunStatus = { setOddRunIds: () => null, } -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('MaintenanceRunTakeover', () => { - let props: React.ComponentProps + let props: ComponentProps const testComponent =
        {'Test Component'}
        beforeEach(() => { diff --git a/app/src/organisms/TakeoverModal/__tests__/TakeoverModal.test.tsx b/app/src/organisms/TakeoverModal/__tests__/TakeoverModal.test.tsx index a902544e4a0..4f3ffd78894 100644 --- a/app/src/organisms/TakeoverModal/__tests__/TakeoverModal.test.tsx +++ b/app/src/organisms/TakeoverModal/__tests__/TakeoverModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, vi, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' @@ -6,14 +5,16 @@ import { i18n } from '/app/i18n' import { renderWithProviders } from '/app/__testing-utils__' import { TakeoverModal } from '../TakeoverModal' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('TakeoverModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { showConfirmTerminateModal: false, diff --git a/app/src/organisms/UpdateRobotSoftware/ErrorUpdateSoftware.tsx b/app/src/organisms/UpdateRobotSoftware/ErrorUpdateSoftware.tsx index f1629e15b64..ab1b44991b6 100644 --- a/app/src/organisms/UpdateRobotSoftware/ErrorUpdateSoftware.tsx +++ b/app/src/organisms/UpdateRobotSoftware/ErrorUpdateSoftware.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useTranslation } from 'react-i18next' import { @@ -14,9 +13,11 @@ import { TYPOGRAPHY, } from '@opentrons/components' +import type { ReactNode } from 'react' + interface ErrorUpdateSoftwareProps { errorMessage: string - children: React.ReactNode + children: ReactNode } export function ErrorUpdateSoftware({ errorMessage, diff --git a/app/src/organisms/UpdateRobotSoftware/__tests__/CompleteUpdateSoftware.test.tsx b/app/src/organisms/UpdateRobotSoftware/__tests__/CompleteUpdateSoftware.test.tsx index b6b91424b92..be6d9056cc0 100644 --- a/app/src/organisms/UpdateRobotSoftware/__tests__/CompleteUpdateSoftware.test.tsx +++ b/app/src/organisms/UpdateRobotSoftware/__tests__/CompleteUpdateSoftware.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { screen } from '@testing-library/react' import { describe, it, expect, vi, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' @@ -6,16 +5,18 @@ import { i18n } from '/app/i18n' import { renderWithProviders } from '/app/__testing-utils__' import { CompleteUpdateSoftware } from '../CompleteUpdateSoftware' +import type { ComponentProps } from 'react' + vi.mock('/app/redux/robot-admin') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('CompleteUpdateSoftware', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/UpdateRobotSoftware/__tests__/ErrorUpdateSoftware.test.tsx b/app/src/organisms/UpdateRobotSoftware/__tests__/ErrorUpdateSoftware.test.tsx index d1706a4bf18..6f585d31db0 100644 --- a/app/src/organisms/UpdateRobotSoftware/__tests__/ErrorUpdateSoftware.test.tsx +++ b/app/src/organisms/UpdateRobotSoftware/__tests__/ErrorUpdateSoftware.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { screen } from '@testing-library/react' import { describe, it, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' @@ -6,14 +5,16 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { ErrorUpdateSoftware } from '../ErrorUpdateSoftware' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('ErrorUpdateSoftware', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/organisms/UpdateRobotSoftware/__tests__/UpdateSoftware.test.tsx b/app/src/organisms/UpdateRobotSoftware/__tests__/UpdateSoftware.test.tsx index 93deeb27956..76344df2c4c 100644 --- a/app/src/organisms/UpdateRobotSoftware/__tests__/UpdateSoftware.test.tsx +++ b/app/src/organisms/UpdateRobotSoftware/__tests__/UpdateSoftware.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { screen } from '@testing-library/react' import { describe, it, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' @@ -6,14 +5,16 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { UpdateSoftware } from '../UpdateSoftware' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('UpdateSoftware', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { updateType: 'downloading', diff --git a/app/src/pages/Desktop/AppSettings/GeneralSettings.tsx b/app/src/pages/Desktop/AppSettings/GeneralSettings.tsx index 85b24816da6..eed4f5be96a 100644 --- a/app/src/pages/Desktop/AppSettings/GeneralSettings.tsx +++ b/app/src/pages/Desktop/AppSettings/GeneralSettings.tsx @@ -1,8 +1,9 @@ // app info card with version and updated -import { useState } from 'react' +import { useState, useEffect } from 'react' import { createPortal } from 'react-dom' import { useTranslation } from 'react-i18next' import { useSelector, useDispatch } from 'react-redux' +import uuidv1 from 'uuid/v4' import { ALIGN_CENTER, @@ -41,6 +42,7 @@ import { import { useTrackEvent, ANALYTICS_APP_UPDATE_NOTIFICATIONS_TOGGLED, + ANALYTICS_LANGUAGE_UPDATED_DESKTOP_APP_SETTINGS, } from '/app/redux/analytics' import { getAppLanguage, updateConfigValue } from '/app/redux/config' import { UpdateAppModal } from '/app/organisms/Desktop/UpdateAppModal' @@ -55,6 +57,7 @@ const GITHUB_LINK = 'https://github.com/Opentrons/opentrons/blob/edge/app-shell/build/release-notes.md' const ENABLE_APP_UPDATE_NOTIFICATIONS = 'Enable app update notifications' +const uuid: () => string = uuidv1 export function GeneralSettings(): JSX.Element { const { t } = useTranslation(['app_settings', 'shared', 'branded']) @@ -68,9 +71,19 @@ export function GeneralSettings(): JSX.Element { const appLanguage = useSelector(getAppLanguage) const currentLanguageOption = LANGUAGES.find(lng => lng.value === appLanguage) - + let transactionId = '' + useEffect(() => { + transactionId = uuid() + }, []) const handleDropdownClick = (value: string): void => { dispatch(updateConfigValue('language.appLanguage', value)) + trackEvent({ + name: ANALYTICS_LANGUAGE_UPDATED_DESKTOP_APP_SETTINGS, + properties: { + language: value, + transactionId, + }, + }) } const [showUpdateBanner, setShowUpdateBanner] = useState( diff --git a/app/src/pages/Desktop/AppSettings/__test__/GeneralSettings.test.tsx b/app/src/pages/Desktop/AppSettings/__test__/GeneralSettings.test.tsx index 43d17a4d2cb..a06f4204bd7 100644 --- a/app/src/pages/Desktop/AppSettings/__test__/GeneralSettings.test.tsx +++ b/app/src/pages/Desktop/AppSettings/__test__/GeneralSettings.test.tsx @@ -12,6 +12,10 @@ import { US_ENGLISH_DISPLAY_NAME, } from '/app/i18n' import { getAlertIsPermanentlyIgnored } from '/app/redux/alerts' +import { + ANALYTICS_LANGUAGE_UPDATED_DESKTOP_APP_SETTINGS, + useTrackEvent, +} from '/app/redux/analytics' import { getAppLanguage, updateConfigValue } from '/app/redux/config' import * as Shell from '/app/redux/shell' import { GeneralSettings } from '../GeneralSettings' @@ -32,11 +36,14 @@ const render = (): ReturnType => { ) } +const mockTrackEvent = vi.fn() + describe('GeneralSettings', () => { beforeEach(() => { vi.mocked(Shell.getAvailableShellUpdate).mockReturnValue(null) vi.mocked(getAlertIsPermanentlyIgnored).mockReturnValue(false) vi.mocked(getAppLanguage).mockReturnValue(US_ENGLISH) + vi.mocked(useTrackEvent).mockReturnValue(mockTrackEvent) }) afterEach(() => { vi.resetAllMocks() @@ -118,5 +125,12 @@ describe('GeneralSettings', () => { 'language.appLanguage', SIMPLIFIED_CHINESE ) + expect(mockTrackEvent).toHaveBeenCalledWith({ + name: ANALYTICS_LANGUAGE_UPDATED_DESKTOP_APP_SETTINGS, + properties: { + language: SIMPLIFIED_CHINESE, + transactionId: expect.anything(), + }, + }) }) }) diff --git a/app/src/pages/Desktop/Labware/__tests__/hooks.test.tsx b/app/src/pages/Desktop/Labware/__tests__/hooks.test.tsx index 5fe55c260dc..c2edcacd08a 100644 --- a/app/src/pages/Desktop/Labware/__tests__/hooks.test.tsx +++ b/app/src/pages/Desktop/Labware/__tests__/hooks.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { Provider } from 'react-redux' import { createStore } from 'redux' import { vi, it, describe, expect, beforeEach, afterEach } from 'vitest' @@ -20,6 +19,7 @@ import { import { useLabwareFailure, useNewLabwareName } from '../hooks' import { useAllLabware } from '/app/local-resources/labware' +import type { FunctionComponent, ReactNode } from 'react' import type { Store } from 'redux' import type { State } from '/app/redux/types' import type { FailedLabwareFile } from '/app/redux/custom-labware/types' @@ -39,7 +39,7 @@ describe('useAllLabware hook', () => { }) it('should return object with only definition and modified date', () => { - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) => {children} const { result } = renderHook(() => useAllLabware('reverse', 'all'), { @@ -53,7 +53,7 @@ describe('useAllLabware hook', () => { expect(labware2.definition).toBe(mockValidLabware.definition) }) it('should return alphabetically sorted list', () => { - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) => {children} const { result } = renderHook(() => useAllLabware('alphabetical', 'all'), { @@ -67,7 +67,7 @@ describe('useAllLabware hook', () => { expect(labware1.definition).toBe(mockValidLabware.definition) }) it('should return no labware if not the right filter', () => { - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) => {children} const { result } = renderHook(() => useAllLabware('reverse', 'reservoir'), { @@ -80,7 +80,7 @@ describe('useAllLabware hook', () => { expect(labware2).toBe(undefined) }) it('should return labware with wellPlate filter', () => { - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) => {children} const { result } = renderHook(() => useAllLabware('reverse', 'wellPlate'), { @@ -94,7 +94,7 @@ describe('useAllLabware hook', () => { expect(labware2.definition).toBe(mockValidLabware.definition) }) it('should return custom labware with customLabware filter', () => { - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) => {children} const { result } = renderHook( @@ -127,7 +127,7 @@ describe('useLabwareFailure hook', () => { vi.restoreAllMocks() }) it('should return invalid labware definition', () => { - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) => ( @@ -147,7 +147,7 @@ describe('useLabwareFailure hook', () => { errorMessage: null, }) - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) => ( @@ -170,7 +170,7 @@ describe('useLabwareFailure hook', () => { errorMessage: null, }) - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) => ( @@ -190,7 +190,7 @@ describe('useLabwareFailure hook', () => { errorMessage: 'error', }) - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) => ( @@ -217,7 +217,7 @@ describe('useNewLabwareName hook', () => { }) it('should return filename as a string', () => { - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) => {children} const { result } = renderHook(useNewLabwareName, { wrapper }) diff --git a/app/src/pages/ODD/ChooseLanguage/__tests__/ChooseLanguage.test.tsx b/app/src/pages/ODD/ChooseLanguage/__tests__/ChooseLanguage.test.tsx index 8508a7b4d08..fa5c793e2d2 100644 --- a/app/src/pages/ODD/ChooseLanguage/__tests__/ChooseLanguage.test.tsx +++ b/app/src/pages/ODD/ChooseLanguage/__tests__/ChooseLanguage.test.tsx @@ -1,10 +1,12 @@ -import { vi, it, describe, expect } from 'vitest' +import { vi, it, describe, expect, beforeEach } from 'vitest' import { fireEvent, screen } from '@testing-library/react' import { MemoryRouter } from 'react-router-dom' import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' -import { updateConfigValue } from '/app/redux/config' +import { ANALYTICS_LANGUAGE_UPDATED_ODD_UNBOXING_FLOW } from '/app/redux/analytics' +import { useTrackEventWithRobotSerial } from '/app/redux-resources/analytics' +import { updateConfigValue, getAppLanguage } from '/app/redux/config' import { ChooseLanguage } from '..' import type { NavigateFunction } from 'react-router-dom' @@ -18,6 +20,9 @@ vi.mock('react-router-dom', async importOriginal => { } }) vi.mock('/app/redux/config') +vi.mock('/app/redux-resources/analytics') + +const mockTrackEvent = vi.fn() const render = () => { return renderWithProviders( @@ -31,6 +36,12 @@ const render = () => { } describe('ChooseLanguage', () => { + beforeEach(() => { + vi.mocked(useTrackEventWithRobotSerial).mockReturnValue({ + trackEventWithRobotSerial: mockTrackEvent, + }) + vi.mocked(getAppLanguage).mockReturnValue('en-US') + }) it('should render text, language options, and continue button', () => { render() screen.getByText('Choose your language') @@ -54,6 +65,12 @@ describe('ChooseLanguage', () => { it('should call mockNavigate when tapping continue', () => { render() fireEvent.click(screen.getByRole('button', { name: 'Continue' })) + expect(mockTrackEvent).toHaveBeenCalledWith({ + name: ANALYTICS_LANGUAGE_UPDATED_ODD_UNBOXING_FLOW, + properties: { + language: 'en-US', + }, + }) expect(mockNavigate).toHaveBeenCalledWith('/welcome') }) }) diff --git a/app/src/pages/ODD/ChooseLanguage/index.tsx b/app/src/pages/ODD/ChooseLanguage/index.tsx index d0110e68591..8ecb87451f7 100644 --- a/app/src/pages/ODD/ChooseLanguage/index.tsx +++ b/app/src/pages/ODD/ChooseLanguage/index.tsx @@ -13,6 +13,8 @@ import { TYPOGRAPHY, } from '@opentrons/components' +import { ANALYTICS_LANGUAGE_UPDATED_ODD_UNBOXING_FLOW } from '/app/redux/analytics' +import { useTrackEventWithRobotSerial } from '/app/redux-resources/analytics' import { MediumButton } from '/app/atoms/buttons' import { LANGUAGES, US_ENGLISH } from '/app/i18n' import { RobotSetupHeader } from '/app/organisms/ODD/RobotSetupHeader' @@ -24,6 +26,7 @@ export function ChooseLanguage(): JSX.Element { const { i18n, t } = useTranslation(['app_settings', 'shared']) const navigate = useNavigate() const dispatch = useDispatch() + const { trackEventWithRobotSerial } = useTrackEventWithRobotSerial() const appLanguage = useSelector(getAppLanguage) @@ -69,6 +72,12 @@ export function ChooseLanguage(): JSX.Element { { + trackEventWithRobotSerial({ + name: ANALYTICS_LANGUAGE_UPDATED_ODD_UNBOXING_FLOW, + properties: { + language: appLanguage, + }, + }) navigate('/welcome') }} width="100%" diff --git a/app/src/pages/ODD/ConnectViaEthernet/__tests__/DisplayConnectionStatus.test.tsx b/app/src/pages/ODD/ConnectViaEthernet/__tests__/DisplayConnectionStatus.test.tsx index 9efbfd5c3dc..0caa3a6ba10 100644 --- a/app/src/pages/ODD/ConnectViaEthernet/__tests__/DisplayConnectionStatus.test.tsx +++ b/app/src/pages/ODD/ConnectViaEthernet/__tests__/DisplayConnectionStatus.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, it, describe, expect, beforeEach } from 'vitest' import { fireEvent, screen } from '@testing-library/react' @@ -6,6 +5,7 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { DisplayConnectionStatus } from '../DisplayConnectionStatus' +import type { ComponentProps } from 'react' import type { NavigateFunction } from 'react-router-dom' const mockFunc = vi.fn() @@ -18,16 +18,14 @@ vi.mock('react-router-dom', async importOriginal => { } }) -const render = ( - props: React.ComponentProps -) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('DisplayConnectionStatus', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/pages/ODD/ConnectViaEthernet/__tests__/TitleHeader.test.tsx b/app/src/pages/ODD/ConnectViaEthernet/__tests__/TitleHeader.test.tsx index cffa8e9c63a..8c8667619b9 100644 --- a/app/src/pages/ODD/ConnectViaEthernet/__tests__/TitleHeader.test.tsx +++ b/app/src/pages/ODD/ConnectViaEthernet/__tests__/TitleHeader.test.tsx @@ -1,10 +1,10 @@ -import type * as React from 'react' import { vi, it, describe, expect, beforeEach } from 'vitest' import { fireEvent, screen } from '@testing-library/react' import { renderWithProviders } from '/app/__testing-utils__' import { TitleHeader } from '../TitleHeader' +import type { ComponentProps } from 'react' import type { NavigateFunction } from 'react-router-dom' const mockNavigate = vi.fn() @@ -16,12 +16,12 @@ vi.mock('react-router-dom', async importOriginal => { } }) -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders() } describe('TitleHeader', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/pages/ODD/ConnectViaWifi/SetWifiCred.tsx b/app/src/pages/ODD/ConnectViaWifi/SetWifiCred.tsx index e2716fc2282..2d81286d058 100644 --- a/app/src/pages/ODD/ConnectViaWifi/SetWifiCred.tsx +++ b/app/src/pages/ODD/ConnectViaWifi/SetWifiCred.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useTranslation } from 'react-i18next' import { Flex, DIRECTION_COLUMN } from '@opentrons/components' @@ -6,13 +5,14 @@ import { Flex, DIRECTION_COLUMN } from '@opentrons/components' import { SetWifiCred as SetWifiCredComponent } from '/app/organisms/ODD/NetworkSettings' import { RobotSetupHeader } from '/app/organisms/ODD/RobotSetupHeader' +import type { Dispatch, SetStateAction } from 'react' import type { WifiScreenOption } from './' interface SetWifiCredProps { handleConnect: () => void password: string setCurrentOption: (option: WifiScreenOption) => void - setPassword: React.Dispatch> + setPassword: Dispatch> } export function SetWifiCred({ diff --git a/app/src/pages/ODD/InitialLoadingScreen/index.tsx b/app/src/pages/ODD/InitialLoadingScreen/index.tsx index f35fad13b56..003d37e549e 100644 --- a/app/src/pages/ODD/InitialLoadingScreen/index.tsx +++ b/app/src/pages/ODD/InitialLoadingScreen/index.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { useSelector } from 'react-redux' import { ALIGN_CENTER, @@ -12,10 +11,12 @@ import { import { useRobotSettingsQuery } from '@opentrons/react-api-client' import { getIsShellReady } from '/app/redux/shell' +import type { ReactNode } from 'react' + export function InitialLoadingScreen({ children, }: { - children?: React.ReactNode + children?: ReactNode }): JSX.Element { const isShellReady = useSelector(getIsShellReady) diff --git a/app/src/pages/ODD/InstrumentsDashboard/index.tsx b/app/src/pages/ODD/InstrumentsDashboard/index.tsx index acc88714979..49268c0ec51 100644 --- a/app/src/pages/ODD/InstrumentsDashboard/index.tsx +++ b/app/src/pages/ODD/InstrumentsDashboard/index.tsx @@ -7,6 +7,7 @@ import { AttachedInstrumentMountItem } from '/app/organisms/ODD/InstrumentMountI import { GripperWizardFlows } from '/app/organisms/GripperWizardFlows' import { getShowPipetteCalibrationWarning } from '/app/transformations/instruments' import { PipetteRecalibrationODDWarning } from '/app/organisms/ODD/PipetteRecalibrationODDWarning' +import type { ComponentProps } from 'react' import type { GripperData, PipetteData } from '@opentrons/api-client' const FETCH_PIPETTE_CAL_POLL = 10000 @@ -16,8 +17,8 @@ export const InstrumentsDashboard = (): JSX.Element => { refetchInterval: FETCH_PIPETTE_CAL_POLL, }) const [wizardProps, setWizardProps] = useState< - | React.ComponentProps - | React.ComponentProps + | ComponentProps + | ComponentProps | null >(null) diff --git a/app/src/pages/ODD/ProtocolDashboard/PinnedProtocolCarousel.tsx b/app/src/pages/ODD/ProtocolDashboard/PinnedProtocolCarousel.tsx index 59e9fc5c117..267b77a5cea 100644 --- a/app/src/pages/ODD/ProtocolDashboard/PinnedProtocolCarousel.tsx +++ b/app/src/pages/ODD/ProtocolDashboard/PinnedProtocolCarousel.tsx @@ -1,4 +1,4 @@ -import type * as React from 'react' +import styled from 'styled-components' import { ALIGN_FLEX_START, DIRECTION_ROW, @@ -9,13 +9,13 @@ import { import { useNotifyAllRunsQuery } from '/app/resources/runs' import { PinnedProtocol } from './PinnedProtocol' +import type { Dispatch, SetStateAction } from 'react' import type { ProtocolResource } from '@opentrons/shared-data' import type { CardSizeType } from './PinnedProtocol' -import styled from 'styled-components' interface PinnedProtocolCarouselProps { pinnedProtocols: ProtocolResource[] - longPress: React.Dispatch> + longPress: Dispatch> setShowDeleteConfirmationModal: (showDeleteConfirmationModal: boolean) => void setTargetProtocolId: (targetProtocolId: string) => void isRequiredCSV?: boolean diff --git a/app/src/pages/ODD/ProtocolDashboard/ProtocolCard.tsx b/app/src/pages/ODD/ProtocolDashboard/ProtocolCard.tsx index 61a0bcb9061..6786205d889 100644 --- a/app/src/pages/ODD/ProtocolDashboard/ProtocolCard.tsx +++ b/app/src/pages/ODD/ProtocolDashboard/ProtocolCard.tsx @@ -35,6 +35,7 @@ import { LongPressModal } from './LongPressModal' import { formatTimeWithUtcLabel } from '/app/resources/runs' import { useUpdatedLastRunTime } from '/app/pages/ODD/ProtocolDashboard/hooks' +import type { Dispatch, SetStateAction } from 'react' import type { UseLongPressResult } from '@opentrons/components' import type { ProtocolResource } from '@opentrons/shared-data' import type { OddModalHeaderBaseProps } from '/app/molecules/OddModal/types' @@ -43,7 +44,7 @@ const REFETCH_INTERVAL = 5000 interface ProtocolCardProps { protocol: ProtocolResource - longPress: React.Dispatch> + longPress: Dispatch> setShowDeleteConfirmationModal: (showDeleteConfirmationModal: boolean) => void setTargetProtocolId: (targetProtocolId: string) => void lastRun?: string diff --git a/app/src/pages/ODD/ProtocolDashboard/__tests__/DeleteProtocolConfirmationModal.test.tsx b/app/src/pages/ODD/ProtocolDashboard/__tests__/DeleteProtocolConfirmationModal.test.tsx index 1c55405dbde..059e62f85e5 100644 --- a/app/src/pages/ODD/ProtocolDashboard/__tests__/DeleteProtocolConfirmationModal.test.tsx +++ b/app/src/pages/ODD/ProtocolDashboard/__tests__/DeleteProtocolConfirmationModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, it, describe, expect, beforeEach, afterEach } from 'vitest' import { when } from 'vitest-when' import { act, fireEvent, screen } from '@testing-library/react' @@ -10,6 +9,8 @@ import { useHost, useProtocolQuery } from '@opentrons/react-api-client' import { i18n } from '/app/i18n' import { useToaster } from '/app/organisms/ToasterOven' import { DeleteProtocolConfirmationModal } from '../DeleteProtocolConfirmationModal' + +import type { ComponentProps } from 'react' import type { HostConfig } from '@opentrons/api-client' vi.mock('@opentrons/api-client') @@ -22,7 +23,7 @@ const mockMakeSnackbar = vi.fn() const MOCK_HOST_CONFIG = {} as HostConfig const render = ( - props: React.ComponentProps + props: ComponentProps ) => { return renderWithProviders(, { i18nInstance: i18n, @@ -30,7 +31,7 @@ const render = ( } describe('DeleteProtocolConfirmationModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/pages/ODD/ProtocolDashboard/__tests__/PinnedProtocol.test.tsx b/app/src/pages/ODD/ProtocolDashboard/__tests__/PinnedProtocol.test.tsx index f92904573d0..a98f0478d6d 100644 --- a/app/src/pages/ODD/ProtocolDashboard/__tests__/PinnedProtocol.test.tsx +++ b/app/src/pages/ODD/ProtocolDashboard/__tests__/PinnedProtocol.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, it, describe, expect, beforeEach } from 'vitest' import { act, fireEvent, screen } from '@testing-library/react' import { MemoryRouter } from 'react-router-dom' @@ -10,9 +9,10 @@ import { i18n } from '/app/i18n' import { useFeatureFlag } from '/app/redux/config' import { PinnedProtocol } from '../PinnedProtocol' +import type { ComponentProps } from 'react' +import type { NavigateFunction } from 'react-router-dom' import type { Chip } from '@opentrons/components' import type { ProtocolResource } from '@opentrons/shared-data' -import type { NavigateFunction } from 'react-router-dom' const mockNavigate = vi.fn() @@ -50,7 +50,7 @@ const mockProtocol: ProtocolResource = { key: '26ed5a82-502f-4074-8981-57cdda1d066d', } -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders( @@ -62,7 +62,7 @@ const render = (props: React.ComponentProps) => { } describe('Pinned Protocol', () => { - let props: React.ComponentProps + let props: ComponentProps vi.useFakeTimers() beforeEach(() => { diff --git a/app/src/pages/ODD/ProtocolDashboard/__tests__/ProtocolCard.test.tsx b/app/src/pages/ODD/ProtocolDashboard/__tests__/ProtocolCard.test.tsx index c26b429e29e..5f1587242d8 100644 --- a/app/src/pages/ODD/ProtocolDashboard/__tests__/ProtocolCard.test.tsx +++ b/app/src/pages/ODD/ProtocolDashboard/__tests__/ProtocolCard.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, it, describe, expect, beforeEach } from 'vitest' import { act, fireEvent, screen } from '@testing-library/react' import { MemoryRouter } from 'react-router-dom' @@ -14,6 +13,7 @@ import { i18n } from '/app/i18n' import { useFeatureFlag } from '/app/redux/config' import { ProtocolCard } from '../ProtocolCard' +import type { ComponentProps } from 'react' import type { NavigateFunction } from 'react-router-dom' import type { UseQueryResult } from 'react-query' import type { @@ -77,7 +77,7 @@ const mockProtocolWithCSV: ProtocolResource = { key: '26ed5a82-502f-4074-8981-57cdda1d066d', } -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders( @@ -89,7 +89,7 @@ const render = (props: React.ComponentProps) => { } describe('ProtocolCard', () => { - let props: React.ComponentProps + let props: ComponentProps vi.useFakeTimers() beforeEach(() => { diff --git a/app/src/pages/ODD/ProtocolDetails/__tests__/Deck.test.tsx b/app/src/pages/ODD/ProtocolDetails/__tests__/Deck.test.tsx index a99e2c3f82e..902cd1d3b8c 100644 --- a/app/src/pages/ODD/ProtocolDetails/__tests__/Deck.test.tsx +++ b/app/src/pages/ODD/ProtocolDetails/__tests__/Deck.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, it, describe, expect, beforeEach, afterEach } from 'vitest' import { screen } from '@testing-library/react' import { when } from 'vitest-when' @@ -12,6 +11,7 @@ import { import { i18n } from '/app/i18n' import { Deck } from '../Deck' +import type { ComponentProps } from 'react' import type { UseQueryResult } from 'react-query' import type { CompletedProtocolAnalysis } from '@opentrons/shared-data' import type { Protocol } from '@opentrons/api-client' @@ -141,14 +141,14 @@ const MOCK_PROTOCOL_ANALYSIS = { ], } -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('Deck', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { protocolId: MOCK_PROTOCOL_ID, diff --git a/app/src/pages/ODD/ProtocolDetails/__tests__/EmptySection.test.tsx b/app/src/pages/ODD/ProtocolDetails/__tests__/EmptySection.test.tsx index 32b388ef1f3..9c1832fc08f 100644 --- a/app/src/pages/ODD/ProtocolDetails/__tests__/EmptySection.test.tsx +++ b/app/src/pages/ODD/ProtocolDetails/__tests__/EmptySection.test.tsx @@ -1,18 +1,19 @@ -import type * as React from 'react' import { it, describe } from 'vitest' import { screen } from '@testing-library/react' import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { EmptySection } from '../EmptySection' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, })[0] } describe('EmptySection', () => { - let props: React.ComponentProps + let props: ComponentProps it('should render text for labware', () => { props = { diff --git a/app/src/pages/ODD/ProtocolDetails/__tests__/Hardware.test.tsx b/app/src/pages/ODD/ProtocolDetails/__tests__/Hardware.test.tsx index a8f78c8a121..7d03ce6ba3d 100644 --- a/app/src/pages/ODD/ProtocolDetails/__tests__/Hardware.test.tsx +++ b/app/src/pages/ODD/ProtocolDetails/__tests__/Hardware.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, it, describe, beforeEach, afterEach } from 'vitest' import { screen } from '@testing-library/react' import { when } from 'vitest-when' @@ -12,19 +11,21 @@ import { i18n } from '/app/i18n' import { useRequiredProtocolHardware } from '/app/resources/protocols' import { Hardware } from '../Hardware' +import type { ComponentProps } from 'react' + vi.mock('/app/resources/protocols') vi.mock('/app/redux/config') const MOCK_PROTOCOL_ID = 'mock_protocol_id' -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('Hardware', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { protocolId: MOCK_PROTOCOL_ID, diff --git a/app/src/pages/ODD/ProtocolDetails/__tests__/Labware.test.tsx b/app/src/pages/ODD/ProtocolDetails/__tests__/Labware.test.tsx index 0c1aab61196..14568a6ceb3 100644 --- a/app/src/pages/ODD/ProtocolDetails/__tests__/Labware.test.tsx +++ b/app/src/pages/ODD/ProtocolDetails/__tests__/Labware.test.tsx @@ -1,10 +1,6 @@ -import type * as React from 'react' import { vi, it, describe, beforeEach, afterEach } from 'vitest' +import { screen } from '@testing-library/react' import { when } from 'vitest-when' -import { renderWithProviders } from '/app/__testing-utils__' -import { i18n } from '/app/i18n' -import { useRequiredProtocolLabware } from '/app/resources/protocols' -import { Labware } from '../Labware' import { fixtureTiprack10ul, @@ -12,21 +8,26 @@ import { fixture96Plate, } from '@opentrons/shared-data' +import { renderWithProviders } from '/app/__testing-utils__' +import { i18n } from '/app/i18n' +import { useRequiredProtocolLabware } from '/app/resources/protocols' +import { Labware } from '../Labware' + +import type { ComponentProps } from 'react' import type { LabwareDefinition2 } from '@opentrons/shared-data' -import { screen } from '@testing-library/react' vi.mock('/app/resources/protocols') const MOCK_PROTOCOL_ID = 'mock_protocol_id' -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('Labware', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { protocolId: MOCK_PROTOCOL_ID, diff --git a/app/src/pages/ODD/ProtocolDetails/__tests__/Liquids.test.tsx b/app/src/pages/ODD/ProtocolDetails/__tests__/Liquids.test.tsx index be019dd6cf1..23233c6c50d 100644 --- a/app/src/pages/ODD/ProtocolDetails/__tests__/Liquids.test.tsx +++ b/app/src/pages/ODD/ProtocolDetails/__tests__/Liquids.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, it, describe, beforeEach } from 'vitest' import { when } from 'vitest-when' import { screen } from '@testing-library/react' @@ -16,6 +15,7 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { Liquids } from '../Liquids' +import type { ComponentProps } from 'react' import type { UseQueryResult } from 'react-query' import type { Protocol } from '@opentrons/api-client' import type * as SharedData from '@opentrons/shared-data' @@ -180,14 +180,14 @@ const MOCK_LABWARE_INFO_BY_LIQUID_ID = { ], } -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('Liquids', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { protocolId: MOCK_PROTOCOL_ID, diff --git a/app/src/pages/ODD/ProtocolDetails/__tests__/Parameters.test.tsx b/app/src/pages/ODD/ProtocolDetails/__tests__/Parameters.test.tsx index f41115cf638..b2d60c57c92 100644 --- a/app/src/pages/ODD/ProtocolDetails/__tests__/Parameters.test.tsx +++ b/app/src/pages/ODD/ProtocolDetails/__tests__/Parameters.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { when } from 'vitest-when' import { it, describe, beforeEach, vi } from 'vitest' import { screen } from '@testing-library/react' @@ -9,17 +8,19 @@ import { useRunTimeParameters } from '/app/resources/protocols' import { Parameters } from '../Parameters' import { mockRunTimeParameterData } from '/app/organisms/ODD/ProtocolSetup/__fixtures__' +import type { ComponentProps } from 'react' + vi.mock('/app/organisms/ToasterOven') vi.mock('/app/resources/protocols') -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } const MOCK_MAKE_SNACK_BAR = vi.fn() describe('Parameters', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/pages/ODD/ProtocolSetup/__tests__/ConfirmAttachedModal.test.tsx b/app/src/pages/ODD/ProtocolSetup/__tests__/ConfirmAttachedModal.test.tsx index f06e36df20d..5a9b2ea98bc 100644 --- a/app/src/pages/ODD/ProtocolSetup/__tests__/ConfirmAttachedModal.test.tsx +++ b/app/src/pages/ODD/ProtocolSetup/__tests__/ConfirmAttachedModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, it, describe, expect, beforeEach } from 'vitest' import { fireEvent, screen } from '@testing-library/react' @@ -7,17 +6,19 @@ import { renderWithProviders } from '/app/__testing-utils__' import { i18n } from '/app/i18n' import { ConfirmAttachedModal } from '../ConfirmAttachedModal' +import type { ComponentProps } from 'react' + const mockOnCloseClick = vi.fn() const mockOnConfirmClick = vi.fn() -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('ConfirmAttachedModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/pages/ODD/QuickTransferDashboard/PinnedTransferCarousel.tsx b/app/src/pages/ODD/QuickTransferDashboard/PinnedTransferCarousel.tsx index 8b6554c3aa1..fc5b127b437 100644 --- a/app/src/pages/ODD/QuickTransferDashboard/PinnedTransferCarousel.tsx +++ b/app/src/pages/ODD/QuickTransferDashboard/PinnedTransferCarousel.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import styled from 'styled-components' import { ALIGN_FLEX_START, @@ -11,12 +10,13 @@ import { import { PinnedTransfer } from './PinnedTransfer' +import type { Dispatch, SetStateAction } from 'react' import type { ProtocolResource } from '@opentrons/shared-data' import type { CardSizeType } from './PinnedTransfer' export function PinnedTransferCarousel(props: { pinnedTransfers: ProtocolResource[] - longPress: React.Dispatch> + longPress: Dispatch> setShowDeleteConfirmationModal: (showDeleteConfirmationModal: boolean) => void setTargetTransferId: (targetTransferId: string) => void }): JSX.Element { diff --git a/app/src/pages/ODD/QuickTransferDashboard/__tests__/DeleteTransferConfirmationModal.test.tsx b/app/src/pages/ODD/QuickTransferDashboard/__tests__/DeleteTransferConfirmationModal.test.tsx index 1b42a6a5e3e..e7cb5ad92e6 100644 --- a/app/src/pages/ODD/QuickTransferDashboard/__tests__/DeleteTransferConfirmationModal.test.tsx +++ b/app/src/pages/ODD/QuickTransferDashboard/__tests__/DeleteTransferConfirmationModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, it, describe, expect, beforeEach, afterEach } from 'vitest' import { when } from 'vitest-when' import { act, fireEvent, screen } from '@testing-library/react' @@ -11,6 +10,7 @@ import { i18n } from '/app/i18n' import { useToaster } from '/app/organisms/ToasterOven' import { DeleteTransferConfirmationModal } from '../DeleteTransferConfirmationModal' +import type { ComponentProps } from 'react' import type { NavigateFunction } from 'react-router-dom' import type { HostConfig } from '@opentrons/api-client' @@ -33,7 +33,7 @@ const mockMakeSnackbar = vi.fn() const MOCK_HOST_CONFIG = {} as HostConfig const render = ( - props: React.ComponentProps + props: ComponentProps ) => { return renderWithProviders(, { i18nInstance: i18n, @@ -41,7 +41,7 @@ const render = ( } describe('DeleteTransferConfirmationModal', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/app/src/pages/ODD/QuickTransferDetails/__tests__/Deck.test.tsx b/app/src/pages/ODD/QuickTransferDetails/__tests__/Deck.test.tsx index e15296037d5..415a25fdc65 100644 --- a/app/src/pages/ODD/QuickTransferDetails/__tests__/Deck.test.tsx +++ b/app/src/pages/ODD/QuickTransferDetails/__tests__/Deck.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, it, describe, expect, beforeEach, afterEach } from 'vitest' import { screen } from '@testing-library/react' import { when } from 'vitest-when' @@ -12,6 +11,7 @@ import { import { i18n } from '/app/i18n' import { Deck } from '../Deck' +import type { ComponentProps } from 'react' import type { UseQueryResult } from 'react-query' import type { CompletedProtocolAnalysis } from '@opentrons/shared-data' import type { Protocol } from '@opentrons/api-client' @@ -141,14 +141,14 @@ const MOCK_PROTOCOL_ANALYSIS = { ], } -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('Deck', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { transferId: MOCK_PROTOCOL_ID, diff --git a/app/src/pages/ODD/QuickTransferDetails/__tests__/Hardware.test.tsx b/app/src/pages/ODD/QuickTransferDetails/__tests__/Hardware.test.tsx index 2b4af1a5178..a5f707fdf85 100644 --- a/app/src/pages/ODD/QuickTransferDetails/__tests__/Hardware.test.tsx +++ b/app/src/pages/ODD/QuickTransferDetails/__tests__/Hardware.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, it, describe, beforeEach, afterEach } from 'vitest' import { screen } from '@testing-library/react' import { when } from 'vitest-when' @@ -12,20 +11,22 @@ import { i18n } from '/app/i18n' import { useRequiredProtocolHardware } from '/app/resources/protocols' import { Hardware } from '../Hardware' +import type { ComponentProps } from 'react' + vi.mock('/app/transformations/commands') vi.mock('/app/resources/protocols') vi.mock('/app/redux/config') const MOCK_PROTOCOL_ID = 'mock_protocol_id' -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('Hardware', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { transferId: MOCK_PROTOCOL_ID, diff --git a/app/src/pages/ODD/QuickTransferDetails/__tests__/Labware.test.tsx b/app/src/pages/ODD/QuickTransferDetails/__tests__/Labware.test.tsx index 7dd49d4f279..09f09f73718 100644 --- a/app/src/pages/ODD/QuickTransferDetails/__tests__/Labware.test.tsx +++ b/app/src/pages/ODD/QuickTransferDetails/__tests__/Labware.test.tsx @@ -1,32 +1,31 @@ -import type * as React from 'react' import { vi, it, describe, beforeEach, afterEach } from 'vitest' import { when } from 'vitest-when' -import { renderWithProviders } from '/app/__testing-utils__' -import { i18n } from '/app/i18n' -import { useRequiredProtocolLabware } from '/app/resources/protocols' -import { Labware } from '../Labware' - +import { screen } from '@testing-library/react' import { fixtureTiprack10ul, fixtureTiprack300ul, fixture96Plate, } from '@opentrons/shared-data' +import { renderWithProviders } from '/app/__testing-utils__' +import { i18n } from '/app/i18n' +import { useRequiredProtocolLabware } from '/app/resources/protocols' +import { Labware } from '../Labware' +import type { ComponentProps } from 'react' import type { LabwareDefinition2 } from '@opentrons/shared-data' -import { screen } from '@testing-library/react' vi.mock('/app/resources/protocols') const MOCK_PROTOCOL_ID = 'mock_protocol_id' -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('Labware', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { transferId: MOCK_PROTOCOL_ID, diff --git a/app/src/pages/ODD/RobotDashboard/__tests__/WelcomeModal.test.tsx b/app/src/pages/ODD/RobotDashboard/__tests__/WelcomeModal.test.tsx index 7fc9bf46ea2..8258f29f281 100644 --- a/app/src/pages/ODD/RobotDashboard/__tests__/WelcomeModal.test.tsx +++ b/app/src/pages/ODD/RobotDashboard/__tests__/WelcomeModal.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, it, describe, expect, beforeEach } from 'vitest' import { fireEvent, screen } from '@testing-library/react' @@ -9,6 +8,7 @@ import { i18n } from '/app/i18n' import { updateConfigValue } from '/app/redux/config' import { WelcomeModal } from '../WelcomeModal' +import type { ComponentProps } from 'react' import type { SetStatusBarCreateCommand } from '@opentrons/shared-data' vi.mock('/app/redux/config') @@ -17,14 +17,14 @@ vi.mock('@opentrons/react-api-client') const mockFunc = vi.fn() const WELCOME_MODAL_IMAGE_NAME = 'welcome_dashboard_modal.png' -const render = (props: React.ComponentProps) => { +const render = (props: ComponentProps) => { return renderWithProviders(, { i18nInstance: i18n, }) } describe('WelcomeModal', () => { - let props: React.ComponentProps + let props: ComponentProps let mockCreateLiveCommand = vi.fn() beforeEach(() => { diff --git a/app/src/redux-resources/analytics/hooks/__tests__/useProtocolRunAnalyticsData.test.tsx b/app/src/redux-resources/analytics/hooks/__tests__/useProtocolRunAnalyticsData.test.tsx index b99b66c8816..1f0501e0c96 100644 --- a/app/src/redux-resources/analytics/hooks/__tests__/useProtocolRunAnalyticsData.test.tsx +++ b/app/src/redux-resources/analytics/hooks/__tests__/useProtocolRunAnalyticsData.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, it, expect, describe, beforeEach, afterEach } from 'vitest' import { when } from 'vitest-when' import { renderHook, waitFor } from '@testing-library/react' @@ -14,6 +13,8 @@ import { useStoredProtocolAnalysis } from '/app/resources/analysis' import { useProtocolMetadata } from '/app/resources/protocols' import { formatInterval } from '/app/transformations/commands' import { mockConnectableRobot } from '/app/redux/discovery/__fixtures__' + +import type { FunctionComponent, ReactNode } from 'react' import type { Store } from 'redux' vi.mock('/app/redux/analytics/hash') @@ -23,7 +24,7 @@ vi.mock('/app/resources/analysis') vi.mock('/app/resources/runs') vi.mock('/app/transformations/commands') -let wrapper: React.FunctionComponent<{ children: React.ReactNode }> +let wrapper: FunctionComponent<{ children: ReactNode }> let store: Store = createStore(vi.fn(), {}) const RUN_ID = '1' diff --git a/app/src/redux-resources/analytics/hooks/__tests__/useRobotAnalyticsData.test.tsx b/app/src/redux-resources/analytics/hooks/__tests__/useRobotAnalyticsData.test.tsx index a781d71c495..bdb7407f843 100644 --- a/app/src/redux-resources/analytics/hooks/__tests__/useRobotAnalyticsData.test.tsx +++ b/app/src/redux-resources/analytics/hooks/__tests__/useRobotAnalyticsData.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, it, expect, describe, beforeEach, afterEach } from 'vitest' import { when } from 'vitest-when' import { renderHook } from '@testing-library/react' @@ -18,6 +17,7 @@ import { getRobotSerialNumber, } from '/app/redux/discovery' +import type { FunctionComponent, ReactNode } from 'react' import type { Store } from 'redux' import type { DiscoveredRobot } from '/app/redux/discovery/types' import type { AttachedPipettesByMount } from '/app/redux/pipettes/types' @@ -41,7 +41,7 @@ const ATTACHED_PIPETTES = { } const ROBOT_SERIAL_NUMBER = 'OT123' -let wrapper: React.FunctionComponent<{ children: React.ReactNode }> +let wrapper: FunctionComponent<{ children: ReactNode }> let store: Store = createStore(vi.fn(), {}) describe('useRobotAnalyticsData hook', () => { diff --git a/app/src/redux-resources/analytics/hooks/__tests__/useTrackProtocolRunEvent.test.tsx b/app/src/redux-resources/analytics/hooks/__tests__/useTrackProtocolRunEvent.test.tsx index f769dc005c4..b387efa58fd 100644 --- a/app/src/redux-resources/analytics/hooks/__tests__/useTrackProtocolRunEvent.test.tsx +++ b/app/src/redux-resources/analytics/hooks/__tests__/useTrackProtocolRunEvent.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { createStore } from 'redux' import { Provider } from 'react-redux' import { QueryClient, QueryClientProvider } from 'react-query' @@ -12,9 +11,11 @@ import { useTrackEvent, ANALYTICS_PROTOCOL_RUN_ACTION, } from '/app/redux/analytics' +import { getAppLanguage } from '/app/redux/config' import { mockConnectableRobot } from '/app/redux/discovery/__fixtures__' import { useRobot } from '/app/redux-resources/robots' +import type { FunctionComponent, ReactNode } from 'react' import type { Store } from 'redux' import type { Mock } from 'vitest' @@ -23,6 +24,7 @@ vi.mock('../useProtocolRunAnalyticsData') vi.mock('/app/redux/discovery') vi.mock('/app/redux/pipettes') vi.mock('/app/redux/analytics') +vi.mock('/app/redux/config') vi.mock('/app/redux/robot-settings') const RUN_ID = 'runId' @@ -31,7 +33,7 @@ const PROTOCOL_PROPERTIES = { protocolType: 'python' } let mockTrackEvent: Mock let mockGetProtocolRunAnalyticsData: Mock -let wrapper: React.FunctionComponent<{ children: React.ReactNode }> +let wrapper: FunctionComponent<{ children: ReactNode }> let store: Store = createStore(vi.fn(), {}) describe('useTrackProtocolRunEvent hook', () => { @@ -55,6 +57,7 @@ describe('useTrackProtocolRunEvent hook', () => { ) vi.mocked(useRobot).mockReturnValue(mockConnectableRobot) vi.mocked(useTrackEvent).mockReturnValue(mockTrackEvent) + vi.mocked(getAppLanguage).mockReturnValue('en-US') when(vi.mocked(useProtocolRunAnalyticsData)) .calledWith(RUN_ID, mockConnectableRobot) @@ -88,7 +91,11 @@ describe('useTrackProtocolRunEvent hook', () => { ) expect(mockTrackEvent).toHaveBeenCalledWith({ name: ANALYTICS_PROTOCOL_RUN_ACTION.START, - properties: { ...PROTOCOL_PROPERTIES, transactionId: RUN_ID }, + properties: { + ...PROTOCOL_PROPERTIES, + transactionId: RUN_ID, + appLanguage: 'en-US', + }, }) }) diff --git a/app/src/redux-resources/analytics/hooks/useTrackProtocolRunEvent.ts b/app/src/redux-resources/analytics/hooks/useTrackProtocolRunEvent.ts index 05c3ce16746..0603994d4b4 100644 --- a/app/src/redux-resources/analytics/hooks/useTrackProtocolRunEvent.ts +++ b/app/src/redux-resources/analytics/hooks/useTrackProtocolRunEvent.ts @@ -1,5 +1,7 @@ +import { useSelector } from 'react-redux' import { useTrackEvent } from '/app/redux/analytics' import { useProtocolRunAnalyticsData } from './useProtocolRunAnalyticsData' +import { getAppLanguage } from '/app/redux/config' import { useRobot } from '/app/redux-resources/robots' interface ProtocolRunAnalyticsEvent { @@ -21,7 +23,7 @@ export function useTrackProtocolRunEvent( runId, robot ) - + const appLanguage = useSelector(getAppLanguage) const trackProtocolRunEvent: TrackProtocolRunEvent = ({ name, properties = {}, @@ -37,6 +39,7 @@ export function useTrackProtocolRunEvent( // It's sometimes unavoidable (namely on the desktop app) to prevent sending an event multiple times. // In these circumstances, we need an idempotency key to accurately filter events in Mixpanel. transactionId: runId, + appLanguage, }, }) }) diff --git a/app/src/redux-resources/config/__tests__/useIsUnboxingFlowOngoing.test.tsx b/app/src/redux-resources/config/__tests__/useIsUnboxingFlowOngoing.test.tsx index d7610096015..cc65ca15100 100644 --- a/app/src/redux-resources/config/__tests__/useIsUnboxingFlowOngoing.test.tsx +++ b/app/src/redux-resources/config/__tests__/useIsUnboxingFlowOngoing.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { renderHook } from '@testing-library/react' import { describe, it, expect, vi, beforeEach } from 'vitest' import { Provider } from 'react-redux' @@ -7,6 +6,7 @@ import { createStore } from 'redux' import { getIsOnDevice, getOnDeviceDisplaySettings } from '/app/redux/config' import { useIsUnboxingFlowOngoing } from '../useIsUnboxingFlowOngoing' +import type { FunctionComponent, ReactNode } from 'react' import type { Store } from 'redux' import type { State } from '/app/redux/types' @@ -22,7 +22,7 @@ const mockDisplaySettings = { } describe('useIsUnboxingFlowOngoing', () => { - let wrapper: React.FunctionComponent<{ children: React.ReactNode }> + let wrapper: FunctionComponent<{ children: ReactNode }> beforeEach(() => { wrapper = ({ children }) => {children} vi.mocked(getOnDeviceDisplaySettings).mockReturnValue(mockDisplaySettings) diff --git a/app/src/redux-resources/robots/hooks/__tests__/useIsFlex.test.tsx b/app/src/redux-resources/robots/hooks/__tests__/useIsFlex.test.tsx index acb68840dfe..19ca25dff24 100644 --- a/app/src/redux-resources/robots/hooks/__tests__/useIsFlex.test.tsx +++ b/app/src/redux-resources/robots/hooks/__tests__/useIsFlex.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, it, expect, describe, beforeEach, afterEach } from 'vitest' import { when } from 'vitest-when' import { Provider } from 'react-redux' @@ -9,6 +8,8 @@ import { QueryClient, QueryClientProvider } from 'react-query' import { getRobotModelByName } from '/app/redux/discovery' import { useIsFlex } from '..' + +import type { FunctionComponent, ReactNode } from 'react' import type { Store } from 'redux' vi.mock('/app/redux/discovery/selectors') @@ -16,7 +17,7 @@ vi.mock('/app/redux/discovery/selectors') const store: Store = createStore(vi.fn(), {}) describe('useIsFlex hook', () => { - let wrapper: React.FunctionComponent<{ children: React.ReactNode }> + let wrapper: FunctionComponent<{ children: ReactNode }> beforeEach(() => { const queryClient = new QueryClient() wrapper = ({ children }) => ( diff --git a/app/src/redux-resources/robots/hooks/__tests__/useIsRobotViewable.test.tsx b/app/src/redux-resources/robots/hooks/__tests__/useIsRobotViewable.test.tsx index 8b659d25656..38e908b8452 100644 --- a/app/src/redux-resources/robots/hooks/__tests__/useIsRobotViewable.test.tsx +++ b/app/src/redux-resources/robots/hooks/__tests__/useIsRobotViewable.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, it, expect, describe, beforeEach, afterEach } from 'vitest' import { when } from 'vitest-when' import { Provider } from 'react-redux' @@ -13,6 +12,8 @@ import { mockUnreachableRobot, } from '/app/redux/discovery/__fixtures__' import { useIsRobotViewable } from '../useIsRobotViewable' + +import type { FunctionComponent, ReactNode } from 'react' import type { Store } from 'redux' vi.mock('/app/redux/discovery') @@ -20,7 +21,7 @@ vi.mock('/app/redux/discovery') const store: Store = createStore(vi.fn(), {}) describe('useIsRobotViewable hook', () => { - let wrapper: React.FunctionComponent<{ children: React.ReactNode }> + let wrapper: FunctionComponent<{ children: ReactNode }> beforeEach(() => { const queryClient = new QueryClient() wrapper = ({ children }) => ( diff --git a/app/src/redux-resources/robots/hooks/__tests__/useRobot.test.tsx b/app/src/redux-resources/robots/hooks/__tests__/useRobot.test.tsx index df7e05347dd..f99452c7994 100644 --- a/app/src/redux-resources/robots/hooks/__tests__/useRobot.test.tsx +++ b/app/src/redux-resources/robots/hooks/__tests__/useRobot.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { when } from 'vitest-when' import { vi, it, expect, describe, beforeEach, afterEach } from 'vitest' import { Provider } from 'react-redux' @@ -11,6 +10,7 @@ import { mockConnectableRobot } from '/app/redux/discovery/__fixtures__' import { useRobot } from '..' +import type { FunctionComponent, ReactNode } from 'react' import type { Store } from 'redux' vi.mock('/app/redux/discovery') @@ -18,7 +18,7 @@ vi.mock('/app/redux/discovery') const store: Store = createStore(vi.fn(), {}) describe('useRobot hook', () => { - let wrapper: React.FunctionComponent<{ children: React.ReactNode }> + let wrapper: FunctionComponent<{ children: ReactNode }> beforeEach(() => { const queryClient = new QueryClient() wrapper = ({ children }) => ( diff --git a/app/src/redux/analytics/constants.ts b/app/src/redux/analytics/constants.ts index cde9b0a1d59..aadeb7c6696 100644 --- a/app/src/redux/analytics/constants.ts +++ b/app/src/redux/analytics/constants.ts @@ -103,3 +103,15 @@ export const ANALYTICS_QUICK_TRANSFER_RERUN = 'quickTransferReRunFromSummary' */ export const ANALYTICS_RESOURCE_MONITOR_REPORT: 'analytics:RESOURCE_MONITOR_REPORT' = 'analytics:RESOURCE_MONITOR_REPORT' + +/** + * Internationalization Analytics + */ +export const ANALYTICS_LANGUAGE_UPDATED_ODD_UNBOXING_FLOW: 'languageUpdatedOddUnboxingFlow' = + 'languageUpdatedOddUnboxingFlow' +export const ANALYTICS_LANGUAGE_UPDATED_ODD_SETTINGS: 'languageUpdatedOddSettings' = + 'languageUpdatedOddSettings' +export const ANALYTICS_LANGUAGE_UPDATED_DESKTOP_APP_MODAL: 'languageUpdatedDesktopAppModal' = + 'languageUpdatedDesktopAppModal' +export const ANALYTICS_LANGUAGE_UPDATED_DESKTOP_APP_SETTINGS: 'languageUpdatedDesktopAppSettings' = + 'languageUpdatedDesktopAppSettings' diff --git a/app/src/redux/robot-update/__tests__/hooks.test.tsx b/app/src/redux/robot-update/__tests__/hooks.test.tsx index 7528bf290bc..bf9cee3afbc 100644 --- a/app/src/redux/robot-update/__tests__/hooks.test.tsx +++ b/app/src/redux/robot-update/__tests__/hooks.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, describe, it, expect, beforeEach } from 'vitest' import { createStore } from 'redux' import { renderHook } from '@testing-library/react' @@ -9,11 +8,12 @@ import { i18n } from '/app/i18n' import { useDispatchStartRobotUpdate } from '../hooks' import { startRobotUpdate, clearRobotUpdateSession } from '../actions' +import type { FunctionComponent, ReactNode } from 'react' import type { Store } from 'redux' import type { State } from '../../types' describe('useDispatchStartRobotUpdate', () => { - let wrapper: React.FunctionComponent<{ children: React.ReactNode }> + let wrapper: FunctionComponent<{ children: ReactNode }> let store: Store const mockRobotName = 'robotName' const mockSystemFile = 'systemFile' diff --git a/app/src/resources/analysis/hooks/__tests__/useStoredProtocolAnalysis.test.tsx b/app/src/resources/analysis/hooks/__tests__/useStoredProtocolAnalysis.test.tsx index 2437ed6e1a7..8bebe10c0e7 100644 --- a/app/src/resources/analysis/hooks/__tests__/useStoredProtocolAnalysis.test.tsx +++ b/app/src/resources/analysis/hooks/__tests__/useStoredProtocolAnalysis.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, it, expect, describe, beforeEach, afterEach } from 'vitest' import { when } from 'vitest-when' import { QueryClient, QueryClientProvider } from 'react-query' @@ -25,6 +24,7 @@ import { } from '../__fixtures__/storedProtocolAnalysis' import { useNotifyRunQuery } from '/app/resources/runs' +import type { FunctionComponent, ReactNode } from 'react' import type { Store } from 'redux' import type { UseQueryResult } from 'react-query' import type { Protocol, Run } from '@opentrons/api-client' @@ -63,7 +63,7 @@ const PROTOCOL_ID = 'the_protocol_id' const PROTOCOL_KEY = 'the_protocol_key' describe('useStoredProtocolAnalysis hook', () => { - let wrapper: React.FunctionComponent<{ children: React.ReactNode }> + let wrapper: FunctionComponent<{ children: ReactNode }> beforeEach(() => { const queryClient = new QueryClient() wrapper = ({ children }) => ( diff --git a/app/src/resources/calibration/__tests__/useDeckCalibrationStatus.test.tsx b/app/src/resources/calibration/__tests__/useDeckCalibrationStatus.test.tsx index 768c4152ff2..3cf71852f01 100644 --- a/app/src/resources/calibration/__tests__/useDeckCalibrationStatus.test.tsx +++ b/app/src/resources/calibration/__tests__/useDeckCalibrationStatus.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, it, expect, describe, beforeEach, afterEach } from 'vitest' import { when } from 'vitest-when' import { Provider } from 'react-redux' @@ -12,6 +11,8 @@ import { getDiscoverableRobotByName } from '/app/redux/discovery' import { useDeckCalibrationStatus } from '..' import { mockConnectableRobot } from '/app/redux/discovery/__fixtures__' + +import type { FunctionComponent, ReactNode } from 'react' import type { Store } from 'redux' vi.mock('@opentrons/react-api-client') @@ -21,7 +22,7 @@ vi.mock('/app/redux/discovery') const store: Store = createStore(vi.fn(), {}) describe('useDeckCalibrationStatus hook', () => { - let wrapper: React.FunctionComponent<{ children: React.ReactNode }> + let wrapper: FunctionComponent<{ children: ReactNode }> beforeEach(() => { const queryClient = new QueryClient() wrapper = ({ children }) => ( diff --git a/app/src/resources/devices/hooks/__tests__/useLights.test.tsx b/app/src/resources/devices/hooks/__tests__/useLights.test.tsx index 7485a61f757..e190902f24b 100644 --- a/app/src/resources/devices/hooks/__tests__/useLights.test.tsx +++ b/app/src/resources/devices/hooks/__tests__/useLights.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, it, expect, describe, beforeEach, afterEach } from 'vitest' import { Provider } from 'react-redux' import { createStore } from 'redux' @@ -11,6 +10,7 @@ import { import { useLights } from '../useLights' +import type { FunctionComponent, ReactNode } from 'react' import type { Store } from 'redux' import type { Mock } from 'vitest' @@ -19,7 +19,7 @@ vi.mock('@opentrons/react-api-client') const store: Store = createStore(vi.fn(), {}) describe('useLights hook', () => { - let wrapper: React.FunctionComponent<{ children: React.ReactNode }> + let wrapper: FunctionComponent<{ children: ReactNode }> let setLights: Mock beforeEach(() => { diff --git a/app/src/resources/instruments/__tests__/useAttachedPipetteCalibrations.test.tsx b/app/src/resources/instruments/__tests__/useAttachedPipetteCalibrations.test.tsx index ef5309a52d5..02316923bd3 100644 --- a/app/src/resources/instruments/__tests__/useAttachedPipetteCalibrations.test.tsx +++ b/app/src/resources/instruments/__tests__/useAttachedPipetteCalibrations.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { when } from 'vitest-when' import { vi, it, expect, describe, beforeEach } from 'vitest' import { Provider } from 'react-redux' @@ -21,6 +20,8 @@ import { } from '/app/redux/calibration/tip-length/__fixtures__' import { useAttachedPipetteCalibrations } from '..' + +import type { FunctionComponent, ReactNode } from 'react' import type { Store } from 'redux' import type { State } from '/app/redux/types' @@ -43,7 +44,7 @@ const PIPETTE_CALIBRATIONS = { } describe('useAttachedPipetteCalibrations hook', () => { - let wrapper: React.FunctionComponent<{ children: React.ReactNode }> + let wrapper: FunctionComponent<{ children: ReactNode }> beforeEach(() => { const queryClient = new QueryClient() wrapper = ({ children }) => ( diff --git a/app/src/resources/instruments/__tests__/useAttachedPipettes.test.tsx b/app/src/resources/instruments/__tests__/useAttachedPipettes.test.tsx index 35dbd023839..30f9922a1a7 100644 --- a/app/src/resources/instruments/__tests__/useAttachedPipettes.test.tsx +++ b/app/src/resources/instruments/__tests__/useAttachedPipettes.test.tsx @@ -8,7 +8,8 @@ import { pipetteResponseFixtureLeft, pipetteResponseFixtureRight, } from '@opentrons/api-client' -import type * as React from 'react' + +import type { FunctionComponent, ReactNode } from 'react' import type { UseQueryResult } from 'react-query' import type { FetchPipettesResponseBody } from '@opentrons/api-client' import type { PipetteModelSpecs } from '@opentrons/shared-data' @@ -17,7 +18,7 @@ vi.mock('@opentrons/react-api-client') vi.mock('@opentrons/shared-data') describe('useAttachedPipettes hook', () => { - let wrapper: React.FunctionComponent<{ children: React.ReactNode }> + let wrapper: FunctionComponent<{ children: ReactNode }> beforeEach(() => { vi.mocked(getPipetteModelSpecs).mockReturnValue({ name: 'mockName', diff --git a/app/src/resources/instruments/__tests__/useAttachedPipettesFromInstrumentsQuery.test.ts b/app/src/resources/instruments/__tests__/useAttachedPipettesFromInstrumentsQuery.test.ts index a0ae4757582..cc2bdbdc081 100644 --- a/app/src/resources/instruments/__tests__/useAttachedPipettesFromInstrumentsQuery.test.ts +++ b/app/src/resources/instruments/__tests__/useAttachedPipettesFromInstrumentsQuery.test.ts @@ -7,7 +7,7 @@ import { } from '@opentrons/api-client' import { useIsOEMMode } from '/app/resources/robot-settings/hooks' import { useAttachedPipettesFromInstrumentsQuery } from '..' -import type * as React from 'react' +import type { FunctionComponent, ReactNode } from 'react' vi.mock('@opentrons/react-api-client') vi.mock('/app/resources/robot-settings/hooks') @@ -17,7 +17,7 @@ describe('useAttachedPipettesFromInstrumentsQuery hook', () => { vi.mocked(useIsOEMMode).mockReturnValue(false) }) - let wrapper: React.FunctionComponent<{ children: React.ReactNode }> + let wrapper: FunctionComponent<{ children: ReactNode }> it('returns attached pipettes', () => { vi.mocked(useInstrumentsQuery).mockReturnValue({ data: { diff --git a/app/src/resources/modules/hooks/__tests__/useAttachedModules.test.tsx b/app/src/resources/modules/hooks/__tests__/useAttachedModules.test.tsx index 49fba0eeaa0..6eec9e0996f 100644 --- a/app/src/resources/modules/hooks/__tests__/useAttachedModules.test.tsx +++ b/app/src/resources/modules/hooks/__tests__/useAttachedModules.test.tsx @@ -4,13 +4,14 @@ import { mockModulesResponse } from '@opentrons/api-client' import { useModulesQuery } from '@opentrons/react-api-client' import { useAttachedModules } from '..' +import type { FunctionComponent, ReactNode } from 'react' import type { UseQueryResult } from 'react-query' import type { Modules } from '@opentrons/api-client' vi.mock('@opentrons/react-api-client') describe('useAttachedModules hook', () => { - let wrapper: React.FunctionComponent<{ children: React.ReactNode }> + let wrapper: FunctionComponent<{ children: ReactNode }> it('returns attached modules', () => { vi.mocked(useModulesQuery).mockReturnValue({ diff --git a/app/src/resources/networking/hooks/__tests__/useCanDisconnect.test.tsx b/app/src/resources/networking/hooks/__tests__/useCanDisconnect.test.tsx index 3985dc36ca8..d8788bf7ee1 100644 --- a/app/src/resources/networking/hooks/__tests__/useCanDisconnect.test.tsx +++ b/app/src/resources/networking/hooks/__tests__/useCanDisconnect.test.tsx @@ -1,18 +1,18 @@ -import type * as React from 'react' import { when } from 'vitest-when' import { describe, it, expect, vi, beforeEach } from 'vitest' import { createStore } from 'redux' import { Provider } from 'react-redux' -import { SECURITY_WPA_EAP } from '@opentrons/api-client' import { renderHook } from '@testing-library/react' +import { SECURITY_WPA_EAP } from '@opentrons/api-client' import { getRobotApiVersionByName } from '/app/redux/discovery' import { useIsFlex } from '/app/redux-resources/robots' import { useCanDisconnect } from '../useCanDisconnect' import { useWifiList } from '../useWifiList' -import type { WifiNetwork } from '@opentrons/api-client' +import type { FunctionComponent, ReactNode } from 'react' import type { Store } from 'redux' +import type { WifiNetwork } from '@opentrons/api-client' import type { State } from '/app/redux/types' vi.mock('../useWifiList') @@ -21,9 +21,9 @@ vi.mock('/app/redux/discovery') const store: Store = createStore(state => state, {}) -const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ - children, -}) => {children} +const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children }) => ( + {children} +) const mockWifiNetwork: WifiNetwork = { ssid: 'linksys', diff --git a/app/src/resources/networking/hooks/__tests__/useNetworkConnection.test.tsx b/app/src/resources/networking/hooks/__tests__/useNetworkConnection.test.tsx index 2c0e6257e42..9335c7eafea 100644 --- a/app/src/resources/networking/hooks/__tests__/useNetworkConnection.test.tsx +++ b/app/src/resources/networking/hooks/__tests__/useNetworkConnection.test.tsx @@ -1,5 +1,3 @@ -import type * as React from 'react' - import { when } from 'vitest-when' import { describe, it, expect, vi, beforeEach } from 'vitest' import { Provider } from 'react-redux' @@ -14,6 +12,8 @@ import * as Fixtures from '/app/redux/networking/__fixtures__' import { getNetworkInterfaces } from '/app/redux/networking' import { useNetworkConnection } from '../useNetworkConnection' + +import type { FunctionComponent, ReactNode } from 'react' import type { Store } from 'redux' vi.mock('/app/redux/networking/selectors') @@ -48,7 +48,7 @@ const store: Store = createStore(vi.fn(), {}) // ToDo (kj:0202/2023) USB test cases will be added when USB is out describe('useNetworkConnection', () => { - let wrapper: React.FunctionComponent<{ children: React.ReactNode }> + let wrapper: FunctionComponent<{ children: ReactNode }> beforeEach(() => { wrapper = ({ children }) => ( diff --git a/app/src/resources/protocols/hooks/__tests__/useProtocolMetadata.test.tsx b/app/src/resources/protocols/hooks/__tests__/useProtocolMetadata.test.tsx index 48ced67d25f..bea57c80284 100644 --- a/app/src/resources/protocols/hooks/__tests__/useProtocolMetadata.test.tsx +++ b/app/src/resources/protocols/hooks/__tests__/useProtocolMetadata.test.tsx @@ -1,5 +1,4 @@ // tests for the HostConfig context and hook -import type * as React from 'react' import { vi, it, expect, describe, beforeEach, afterEach } from 'vitest' import { when } from 'vitest-when' import { Provider } from 'react-redux' @@ -8,6 +7,7 @@ import { renderHook } from '@testing-library/react' import { useCurrentProtocol } from '../useCurrentProtocol' import { useProtocolMetadata } from '../useProtocolMetadata' +import type { FunctionComponent, ReactNode } from 'react' import type { Store } from 'redux' import type { State } from '/app/redux/types' @@ -39,7 +39,7 @@ describe('useProtocolMetadata', () => { }) it('should return author, lastUpdated, method, description, and robot type', () => { - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) => {children} const { result } = renderHook(useProtocolMetadata, { wrapper }) diff --git a/app/src/resources/runs/__tests__/useCloneRun.test.tsx b/app/src/resources/runs/__tests__/useCloneRun.test.tsx index 9323bbf8073..cf9de675f67 100644 --- a/app/src/resources/runs/__tests__/useCloneRun.test.tsx +++ b/app/src/resources/runs/__tests__/useCloneRun.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { when } from 'vitest-when' import { renderHook } from '@testing-library/react' import { QueryClient, QueryClientProvider } from 'react-query' @@ -13,6 +12,7 @@ import { import { useCloneRun } from '../useCloneRun' import { useNotifyRunQuery } from '../useNotifyRunQuery' +import type { FunctionComponent, ReactNode } from 'react' import type { HostConfig } from '@opentrons/api-client' vi.mock('@opentrons/react-api-client') @@ -23,7 +23,7 @@ const RUN_ID_NO_RTP: string = 'run_id_no_rtp' const RUN_ID_RTP: string = 'run_id_rtp' describe('useCloneRun hook', () => { - let wrapper: React.FunctionComponent<{ children: React.ReactNode }> + let wrapper: FunctionComponent<{ children: ReactNode }> beforeEach(() => { when(vi.mocked(useHost)).calledWith().thenReturn(HOST_CONFIG) @@ -90,8 +90,8 @@ describe('useCloneRun hook', () => { } as any) const queryClient = new QueryClient() - const clientProvider: React.FunctionComponent<{ - children: React.ReactNode + const clientProvider: FunctionComponent<{ + children: ReactNode }> = ({ children }) => ( {children} ) diff --git a/app/src/resources/runs/__tests__/useLPCDisabledReason.test.tsx b/app/src/resources/runs/__tests__/useLPCDisabledReason.test.tsx index 0be19bc19d3..349804ac58b 100644 --- a/app/src/resources/runs/__tests__/useLPCDisabledReason.test.tsx +++ b/app/src/resources/runs/__tests__/useLPCDisabledReason.test.tsx @@ -1,13 +1,14 @@ -import type * as React from 'react' import { renderHook } from '@testing-library/react' import { Provider } from 'react-redux' import { I18nextProvider } from 'react-i18next' import { createStore } from 'redux' import { vi, it, expect, describe, beforeEach, afterEach } from 'vitest' + import { getLoadedLabwareDefinitionsByUri, simple_v6 as _uncastedSimpleV6Protocol, } from '@opentrons/shared-data' + import { i18n } from '/app/i18n' import { RUN_ID_1 } from '..//__fixtures__' import { useStoredProtocolAnalysis } from '/app/resources/analysis' @@ -17,6 +18,7 @@ import { useRunCalibrationStatus } from '../useRunCalibrationStatus' import { useMostRecentCompletedAnalysis } from '../useMostRecentCompletedAnalysis' import { useRunHasStarted } from '../useRunHasStarted' +import type { FunctionComponent, ReactNode } from 'react' import type { Store } from 'redux' import type * as SharedData from '@opentrons/shared-data' import type { State } from '/app/redux/types' @@ -38,7 +40,7 @@ const simpleV6Protocol = (_uncastedSimpleV6Protocol as unknown) as SharedData.Pr describe('useLPCDisabledReason', () => { const store: Store = createStore(vi.fn(), {}) - const wrapper: React.FunctionComponent<{ children: React.ReactNode }> = ({ + const wrapper: FunctionComponent<{ children: ReactNode }> = ({ children, }) => ( diff --git a/app/src/resources/runs/__tests__/useModuleCalibrationStatus.test.tsx b/app/src/resources/runs/__tests__/useModuleCalibrationStatus.test.tsx index 5691230dbaf..fef1217b173 100644 --- a/app/src/resources/runs/__tests__/useModuleCalibrationStatus.test.tsx +++ b/app/src/resources/runs/__tests__/useModuleCalibrationStatus.test.tsx @@ -1,4 +1,5 @@ -import type * as React from 'react' +import { Provider } from 'react-redux' +import { createStore } from 'redux' import { QueryClient, QueryClientProvider } from 'react-query' import { renderHook } from '@testing-library/react' import { vi, it, expect, describe, beforeEach, afterEach } from 'vitest' @@ -10,15 +11,13 @@ import { useIsFlex } from '/app/redux-resources/robots' import { mockMagneticModuleGen2 } from '/app/redux/modules/__fixtures__' +import type { FunctionComponent, ReactNode } from 'react' import type { ModuleModel, ModuleType } from '@opentrons/shared-data' -import { Provider } from 'react-redux' -import { createStore } from 'redux' - vi.mock('/app/redux-resources/robots') vi.mock('../useModuleRenderInfoForProtocolById') -let wrapper: React.FunctionComponent<{ children: React.ReactNode }> +let wrapper: FunctionComponent<{ children: ReactNode }> const mockMagneticModuleDefinition = { moduleId: 'someMagneticModule', diff --git a/app/src/resources/runs/__tests__/useRunCalibrationStatus.test.tsx b/app/src/resources/runs/__tests__/useRunCalibrationStatus.test.tsx index d0a81ff3e50..a93a3fe5d7a 100644 --- a/app/src/resources/runs/__tests__/useRunCalibrationStatus.test.tsx +++ b/app/src/resources/runs/__tests__/useRunCalibrationStatus.test.tsx @@ -1,10 +1,11 @@ -import type * as React from 'react' +import { Provider } from 'react-redux' +import { createStore } from 'redux' import { QueryClient, QueryClientProvider } from 'react-query' import { renderHook } from '@testing-library/react' import { vi, it, expect, describe, beforeEach } from 'vitest' import { when } from 'vitest-when' -import { mockTipRackDefinition } from '/app/redux/custom-labware/__fixtures__' +import { mockTipRackDefinition } from '/app/redux/custom-labware/__fixtures__' import { useRunCalibrationStatus, useRunPipetteInfoByMount, @@ -13,9 +14,8 @@ import { import { useDeckCalibrationStatus } from '/app/resources/calibration' import { useIsFlex } from '/app/redux-resources/robots' +import type { FunctionComponent, ReactNode } from 'react' import type { PipetteInfo } from '/app/redux/pipettes' -import { Provider } from 'react-redux' -import { createStore } from 'redux' vi.mock('../useRunPipetteInfoByMount') vi.mock('../useNotifyRunQuery') @@ -23,7 +23,7 @@ vi.mock('/app/resources/calibration') vi.mock('/app/resources/analysis') vi.mock('/app/redux-resources/robots') -let wrapper: React.FunctionComponent<{ children: React.ReactNode }> +let wrapper: FunctionComponent<{ children: ReactNode }> describe('useRunCalibrationStatus hook', () => { beforeEach(() => { diff --git a/app/src/resources/runs/utils.ts b/app/src/resources/runs/utils.ts index d9b6781f4b2..1ab7c205158 100644 --- a/app/src/resources/runs/utils.ts +++ b/app/src/resources/runs/utils.ts @@ -1,6 +1,6 @@ import { format } from 'date-fns' -import type * as React from 'react' +import type { Dispatch, SetStateAction } from 'react' import type { UseMutateAsyncFunction } from 'react-query' import type { CommandData } from '@opentrons/api-client' import type { CreateCommand } from '@opentrons/shared-data' @@ -11,7 +11,7 @@ export const chainRunCommandsRecursive = ( commands: CreateCommand[], createRunCommand: CreateRunCommand, continuePastCommandFailure: boolean = true, - setIsLoading: React.Dispatch> + setIsLoading: Dispatch> ): Promise => { if (commands.length < 1) { return Promise.reject(new Error('no commands to execute')) @@ -57,7 +57,7 @@ export const chainLiveCommandsRecursive = ( CreateLiveCommandMutateParams >, continuePastCommandFailure: boolean = true, - setIsLoading: React.Dispatch> + setIsLoading: Dispatch> ): Promise => { if (commands.length < 1) { return Promise.reject(new Error('no commands to execute')) @@ -100,7 +100,7 @@ export const chainMaintenanceCommandsRecursive = ( commands: CreateCommand[], createMaintenanceCommand: CreateMaintenanceCommand, continuePastCommandFailure: boolean = true, - setIsLoading: React.Dispatch> + setIsLoading: Dispatch> ): Promise => { if (commands.length < 1) { return Promise.reject(new Error('no commands to execute')) diff --git a/app/src/transformations/commands/hooks/__tests__/useMissingProtocolHardware.test.tsx b/app/src/transformations/commands/hooks/__tests__/useMissingProtocolHardware.test.tsx index 99ce33a9de3..54fd39d607f 100644 --- a/app/src/transformations/commands/hooks/__tests__/useMissingProtocolHardware.test.tsx +++ b/app/src/transformations/commands/hooks/__tests__/useMissingProtocolHardware.test.tsx @@ -1,8 +1,7 @@ import omitBy from 'lodash/omitBy' import { vi, it, describe, expect, beforeEach, afterEach } from 'vitest' -import type { UseQueryResult } from 'react-query' import { renderHook } from '@testing-library/react' -import type { Protocol } from '@opentrons/api-client' + import { useProtocolQuery, useProtocolAnalysisAsDocumentQuery, @@ -14,14 +13,19 @@ import { WASTE_CHUTE_RIGHT_ADAPTER_NO_COVER_FIXTURE, fixtureTiprack300ul, } from '@opentrons/shared-data' + +import { useNotifyDeckConfigurationQuery } from '/app/resources/deck_configuration/useNotifyDeckConfigurationQuery' +import { useMissingProtocolHardware } from '../useMissingProtocolHardware' +import { mockHeaterShaker } from '/app/redux/modules/__fixtures__' + +import type { FunctionComponent, ReactNode } from 'react' +import type { UseQueryResult } from 'react-query' +import type { Protocol } from '@opentrons/api-client' import type { CompletedProtocolAnalysis, DeckConfiguration, LabwareDefinition2, } from '@opentrons/shared-data' -import { useNotifyDeckConfigurationQuery } from '/app/resources/deck_configuration/useNotifyDeckConfigurationQuery' -import { useMissingProtocolHardware } from '../useMissingProtocolHardware' -import { mockHeaterShaker } from '/app/redux/modules/__fixtures__' vi.mock('@opentrons/react-api-client') vi.mock('/app/resources/deck_configuration/useNotifyDeckConfigurationQuery') @@ -161,7 +165,7 @@ const PROTOCOL_ANALYSIS = { runTimeParameters: mockRTPData, } as any describe.only('useMissingProtocolHardware', () => { - let wrapper: React.FunctionComponent<{ children: React.ReactNode }> + let wrapper: FunctionComponent<{ children: ReactNode }> beforeEach(() => { vi.mocked(useInstrumentsQuery).mockReturnValue({ data: { data: [] }, diff --git a/components/src/alerts/AlertItem.tsx b/components/src/alerts/AlertItem.tsx index 708f44f746c..4ef5eb04a8c 100644 --- a/components/src/alerts/AlertItem.tsx +++ b/components/src/alerts/AlertItem.tsx @@ -1,9 +1,9 @@ -import type * as React from 'react' import cx from 'classnames' import { Icon } from '../icons' import { IconButton } from '../buttons' import styles from './alerts.module.css' +import type { ReactNode } from 'react' import type { IconProps } from '../icons' export type AlertType = 'success' | 'warning' | 'error' | 'info' @@ -12,9 +12,9 @@ export interface AlertItemProps { /** name constant of the icon to display */ type: AlertType /** title/main message of colored alert bar */ - title: React.ReactNode + title: ReactNode /** Alert message body contents */ - children?: React.ReactNode + children?: ReactNode /** Additional class name */ className?: string /** optional handler to show close button/clear alert */ diff --git a/components/src/atoms/Checkbox/__tests__/Checkbox.test.tsx b/components/src/atoms/Checkbox/__tests__/Checkbox.test.tsx index cfee4c22835..1bc8265ad4f 100644 --- a/components/src/atoms/Checkbox/__tests__/Checkbox.test.tsx +++ b/components/src/atoms/Checkbox/__tests__/Checkbox.test.tsx @@ -1,16 +1,17 @@ -import type * as React from 'react' import { describe, beforeEach, afterEach, vi, expect, it } from 'vitest' import { fireEvent, screen } from '@testing-library/react' import '@testing-library/jest-dom/vitest' import { renderWithProviders } from '../../../testing/utils' import { Checkbox } from '..' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders()[0] } describe('Checkbox', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/components/src/atoms/Checkbox/index.tsx b/components/src/atoms/Checkbox/index.tsx index f4ae61dee1f..c5763665351 100644 --- a/components/src/atoms/Checkbox/index.tsx +++ b/components/src/atoms/Checkbox/index.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { css } from 'styled-components' import { COLORS, BORDERS } from '../../helix-design-system' import { Flex } from '../../primitives' @@ -14,13 +13,15 @@ import { import { RESPONSIVENESS, SPACING } from '../../ui-style-constants' import { StyledText } from '../StyledText' +import type { MouseEventHandler } from 'react' + export interface CheckboxProps { /** checkbox is checked if value is true */ isChecked: boolean /** label text that describes the option */ labelText: string /** callback click/tap handler */ - onClick: React.MouseEventHandler + onClick: MouseEventHandler /** html tabindex property */ tabIndex?: number /** if disabled is true, mouse events will not trigger onClick callback */ diff --git a/components/src/atoms/CheckboxField/__tests__/CheckboxField.test.tsx b/components/src/atoms/CheckboxField/__tests__/CheckboxField.test.tsx index 06fc3153d9e..b3b0e561711 100644 --- a/components/src/atoms/CheckboxField/__tests__/CheckboxField.test.tsx +++ b/components/src/atoms/CheckboxField/__tests__/CheckboxField.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, beforeEach, afterEach, vi, expect, it } from 'vitest' import { fireEvent, screen } from '@testing-library/react' import '@testing-library/jest-dom/vitest' @@ -8,12 +7,14 @@ import { BORDERS, COLORS } from '../../../helix-design-system' import { TYPOGRAPHY, SPACING } from '../../../ui-style-constants' import { CheckboxField } from '..' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders()[0] } describe('CheckboxField', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/components/src/atoms/CheckboxField/index.tsx b/components/src/atoms/CheckboxField/index.tsx index 9f02ef52bc0..1be78e36c1a 100644 --- a/components/src/atoms/CheckboxField/index.tsx +++ b/components/src/atoms/CheckboxField/index.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { css } from 'styled-components' import { SPACING, TYPOGRAPHY } from '../../ui-style-constants' import { COLORS, BORDERS } from '../../helix-design-system' @@ -11,21 +10,23 @@ import { JUSTIFY_CENTER, } from '../../styles' +import type { ChangeEventHandler, ComponentProps, ReactNode } from 'react' + export interface CheckboxFieldProps { /** change handler */ - onChange: React.ChangeEventHandler + onChange: ChangeEventHandler /** checkbox is checked if value is true */ value?: boolean /** name of field in form */ name?: string /** label text for checkbox */ - label?: React.ReactNode + label?: ReactNode /** checkbox is disabled if value is true */ disabled?: boolean /** html tabindex property */ tabIndex?: number /** props passed into label div. TODO IMMEDIATELY what is the Flow type? */ - labelProps?: React.ComponentProps<'div'> + labelProps?: ComponentProps<'div'> /** if true, render indeterminate icon */ isIndeterminate?: boolean } diff --git a/components/src/atoms/Chip/__tests__/Chip.test.tsx b/components/src/atoms/Chip/__tests__/Chip.test.tsx index 65de215160f..9fb190e665b 100644 --- a/components/src/atoms/Chip/__tests__/Chip.test.tsx +++ b/components/src/atoms/Chip/__tests__/Chip.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, expect, beforeEach } from 'vitest' import { screen } from '@testing-library/react' import { BORDERS, COLORS } from '../../../helix-design-system' @@ -6,12 +5,14 @@ import { SPACING } from '../../../ui-style-constants' import { renderWithProviders } from '../../../testing/utils' import { Chip } from '..' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders() } describe('Chip Touchscreen', () => { - let props: React.ComponentProps + let props: ComponentProps it('should render text, icon, bgcolor with success colors', () => { props = { @@ -214,7 +215,7 @@ describe('Chip Touchscreen', () => { }) describe('Chip Web', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { Object.defineProperty(window, 'innerWidth', { diff --git a/components/src/atoms/Divider/index.tsx b/components/src/atoms/Divider/index.tsx index 7de6a3757f4..df9a9e9af07 100644 --- a/components/src/atoms/Divider/index.tsx +++ b/components/src/atoms/Divider/index.tsx @@ -1,7 +1,8 @@ -import type * as React from 'react' import { Box, COLORS, SPACING } from '../..' -type Props = React.ComponentProps +import type { ComponentProps } from 'react' + +type Props = ComponentProps export function Divider(props: Props): JSX.Element { return ( diff --git a/components/src/atoms/InputField/__tests__/InputField.test.tsx b/components/src/atoms/InputField/__tests__/InputField.test.tsx index f53d4f4163a..87b3e752272 100644 --- a/components/src/atoms/InputField/__tests__/InputField.test.tsx +++ b/components/src/atoms/InputField/__tests__/InputField.test.tsx @@ -1,15 +1,16 @@ -import type * as React from 'react' import { describe, it, vi, beforeEach, expect } from 'vitest' import { screen, fireEvent } from '@testing-library/react' import { renderWithProviders } from '../../../testing/utils' import { InputField } from '..' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders()[0] } describe('HeaterShakerSlideout', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { type: 'number', diff --git a/components/src/atoms/InputField/index.tsx b/components/src/atoms/InputField/index.tsx index 001374f71ce..2064bac4d75 100644 --- a/components/src/atoms/InputField/index.tsx +++ b/components/src/atoms/InputField/index.tsx @@ -20,6 +20,7 @@ import type { ChangeEventHandler, FocusEvent, MouseEvent, + MutableRefObject, ReactNode, } from 'react' import type { IconName } from '../../icons' @@ -81,7 +82,7 @@ export interface InputFieldProps { /** small or medium input field height, relevant only */ size?: 'medium' | 'small' /** react useRef to control input field instead of react event */ - ref?: React.MutableRefObject + ref?: MutableRefObject /** optional IconName to display icon aligned to left of input field */ leftIcon?: IconName /** if true, show delete icon aligned to right of input field */ diff --git a/components/src/atoms/ListButton/ListButtonChildren/ListButtonAccordion.tsx b/components/src/atoms/ListButton/ListButtonChildren/ListButtonAccordion.tsx index 04c42ba654b..2d874f61c99 100644 --- a/components/src/atoms/ListButton/ListButtonChildren/ListButtonAccordion.tsx +++ b/components/src/atoms/ListButton/ListButtonChildren/ListButtonAccordion.tsx @@ -1,11 +1,12 @@ -import type * as React from 'react' import { Flex } from '../../../primitives' import { DIRECTION_COLUMN } from '../../../styles' import { SPACING } from '../../../ui-style-constants' import { StyledText } from '../../StyledText' +import type { ReactNode } from 'react' + interface ListButtonAccordionProps { - children: React.ReactNode + children: ReactNode // determines if the accordion is expanded or not isExpanded?: boolean // is it nested into another accordion? diff --git a/components/src/atoms/ListButton/ListButtonChildren/ListButtonAccordionContainer.tsx b/components/src/atoms/ListButton/ListButtonChildren/ListButtonAccordionContainer.tsx index 85f76f901b2..d0e8f19821f 100644 --- a/components/src/atoms/ListButton/ListButtonChildren/ListButtonAccordionContainer.tsx +++ b/components/src/atoms/ListButton/ListButtonChildren/ListButtonAccordionContainer.tsx @@ -1,9 +1,10 @@ -import type * as React from 'react' import { Flex } from '../../../primitives' import { DIRECTION_COLUMN } from '../../../styles' +import type { ReactNode } from 'react' + interface ListButtonAccordionContainerProps { - children: React.ReactNode + children: ReactNode id: string } /* diff --git a/components/src/atoms/ListButton/__tests__/ListButton.test.tsx b/components/src/atoms/ListButton/__tests__/ListButton.test.tsx index e7ba460b5e2..fe4e3fb7349 100644 --- a/components/src/atoms/ListButton/__tests__/ListButton.test.tsx +++ b/components/src/atoms/ListButton/__tests__/ListButton.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, describe, it, expect, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' import { fireEvent, screen } from '@testing-library/react' @@ -7,11 +6,13 @@ import { COLORS } from '../../../helix-design-system' import { ListButton } from '..' -const render = (props: React.ComponentProps) => +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => renderWithProviders() describe('ListButton', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/components/src/atoms/ListButton/__tests__/ListButtonAccordion.test.tsx b/components/src/atoms/ListButton/__tests__/ListButtonAccordion.test.tsx index 29a2673c773..07ce7452549 100644 --- a/components/src/atoms/ListButton/__tests__/ListButtonAccordion.test.tsx +++ b/components/src/atoms/ListButton/__tests__/ListButtonAccordion.test.tsx @@ -1,15 +1,16 @@ -import type * as React from 'react' import { describe, it, beforeEach } from 'vitest' import { screen } from '@testing-library/react' import { renderWithProviders } from '../../../testing/utils' import { ListButtonAccordion } from '..' -const render = (props: React.ComponentProps) => +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => renderWithProviders() describe('ListButtonAccordion', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/components/src/atoms/ListButton/__tests__/ListButtonRadioButton.test.tsx b/components/src/atoms/ListButton/__tests__/ListButtonRadioButton.test.tsx index e9448ffabdf..95520a9691b 100644 --- a/components/src/atoms/ListButton/__tests__/ListButtonRadioButton.test.tsx +++ b/components/src/atoms/ListButton/__tests__/ListButtonRadioButton.test.tsx @@ -1,15 +1,16 @@ -import type * as React from 'react' import { describe, it, beforeEach, vi, expect } from 'vitest' import { fireEvent, screen } from '@testing-library/react' import { renderWithProviders } from '../../../testing/utils' import { ListButtonRadioButton } from '..' -const render = (props: React.ComponentProps) => +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => renderWithProviders() describe('ListButtonRadioButton', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/components/src/atoms/ListButton/index.tsx b/components/src/atoms/ListButton/index.tsx index 3f26c830a50..fd4d0cce052 100644 --- a/components/src/atoms/ListButton/index.tsx +++ b/components/src/atoms/ListButton/index.tsx @@ -1,9 +1,10 @@ -import type * as React from 'react' import { css } from 'styled-components' import { Flex } from '../../primitives' import { SPACING } from '../../ui-style-constants' import { BORDERS, COLORS } from '../../helix-design-system' import { CURSOR_POINTER } from '../../styles' + +import type { ReactNode } from 'react' import type { StyleProps } from '../../primitives' export * from './ListButtonChildren/index' @@ -12,7 +13,7 @@ export type ListButtonType = 'noActive' | 'connected' | 'notConnected' interface ListButtonProps extends StyleProps { type: ListButtonType - children: React.ReactNode + children: ReactNode disabled?: boolean onClick?: () => void } diff --git a/components/src/atoms/ListItem/__tests__/ListItem.test.tsx b/components/src/atoms/ListItem/__tests__/ListItem.test.tsx index ce15aec5d8e..7b603d85868 100644 --- a/components/src/atoms/ListItem/__tests__/ListItem.test.tsx +++ b/components/src/atoms/ListItem/__tests__/ListItem.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, describe, it, expect, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' import { fireEvent, screen } from '@testing-library/react' @@ -7,11 +6,13 @@ import { BORDERS, COLORS } from '../../../helix-design-system' import { ListItem } from '..' -const render = (props: React.ComponentProps) => +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => renderWithProviders() describe('ListItem', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/components/src/atoms/ListItem/index.tsx b/components/src/atoms/ListItem/index.tsx index 5a47c614ea8..d1d9b8d1312 100644 --- a/components/src/atoms/ListItem/index.tsx +++ b/components/src/atoms/ListItem/index.tsx @@ -1,9 +1,10 @@ -import type * as React from 'react' import { css } from 'styled-components' import { Flex } from '../../primitives' import { RESPONSIVENESS, SPACING } from '../../ui-style-constants' import { BORDERS, COLORS } from '../../helix-design-system' import { FLEX_MAX_CONTENT } from '../../styles' + +import type { ReactNode } from 'react' import type { StyleProps } from '../../primitives' export * from './ListItemChildren' @@ -19,7 +20,7 @@ interface ListItemProps extends StyleProps { /** ListItem state type */ type: ListItemType /** ListItem contents */ - children: React.ReactNode + children: ReactNode onClick?: () => void onMouseEnter?: () => void onMouseLeave?: () => void diff --git a/components/src/atoms/MenuList/OverflowBtn.tsx b/components/src/atoms/MenuList/OverflowBtn.tsx index efe9195f03d..0414f95f7d3 100644 --- a/components/src/atoms/MenuList/OverflowBtn.tsx +++ b/components/src/atoms/MenuList/OverflowBtn.tsx @@ -1,20 +1,22 @@ -import * as React from 'react' +import { forwardRef } from 'react' import { css } from 'styled-components' import { Btn } from '../../primitives' import { BORDERS, COLORS } from '../../helix-design-system' import { SPACING } from '../../ui-style-constants' -interface OverflowBtnProps extends React.ComponentProps { +import type { ComponentProps, ForwardedRef, ReactNode } from 'react' + +interface OverflowBtnProps extends ComponentProps { fillColor?: string } export const OverflowBtn: ( props: OverflowBtnProps, - ref: React.ForwardedRef -) => React.ReactNode = React.forwardRef( + ref: ForwardedRef +) => ReactNode = forwardRef( ( props: OverflowBtnProps, - ref: React.ForwardedRef + ref: ForwardedRef ): JSX.Element => { const { fillColor, ...restProps } = props return ( diff --git a/components/src/atoms/MenuList/__tests__/MenuItem.test.tsx b/components/src/atoms/MenuList/__tests__/MenuItem.test.tsx index f6d0485be45..4a90984f638 100644 --- a/components/src/atoms/MenuList/__tests__/MenuItem.test.tsx +++ b/components/src/atoms/MenuList/__tests__/MenuItem.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, expect, beforeEach } from 'vitest' import { screen } from '@testing-library/react' @@ -8,12 +7,14 @@ import { SPACING, TYPOGRAPHY } from '../../../ui-style-constants' import { MenuItem } from '../MenuItem' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders()[0] } describe('MenuItem', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/components/src/atoms/MenuList/__tests__/MenuList.test.tsx b/components/src/atoms/MenuList/__tests__/MenuList.test.tsx index e38e145eceb..7b2ccffc42b 100644 --- a/components/src/atoms/MenuList/__tests__/MenuList.test.tsx +++ b/components/src/atoms/MenuList/__tests__/MenuList.test.tsx @@ -1,18 +1,19 @@ -import type * as React from 'react' import { describe, it, expect, vi, beforeEach } from 'vitest' import { fireEvent, screen } from '@testing-library/react' import { renderWithProviders } from '../../../testing/utils' import { MenuList } from '..' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders()[0] } const mockBtn =
        mockBtn
        describe('MenuList', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { children: mockBtn, diff --git a/components/src/atoms/MenuList/__tests__/OverflowBtn.test.tsx b/components/src/atoms/MenuList/__tests__/OverflowBtn.test.tsx index 00f080fae2c..af60a617c41 100644 --- a/components/src/atoms/MenuList/__tests__/OverflowBtn.test.tsx +++ b/components/src/atoms/MenuList/__tests__/OverflowBtn.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { vi, it, expect, describe } from 'vitest' import { fireEvent, screen } from '@testing-library/react' @@ -6,7 +5,9 @@ import { COLORS } from '../../../helix-design-system' import { renderWithProviders } from '../../../testing/utils' import { OverflowBtn } from '../OverflowBtn' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders()[0] } diff --git a/components/src/atoms/MenuList/index.tsx b/components/src/atoms/MenuList/index.tsx index 7b930243ba0..f06fe983523 100644 --- a/components/src/atoms/MenuList/index.tsx +++ b/components/src/atoms/MenuList/index.tsx @@ -1,5 +1,3 @@ -import type * as React from 'react' - import { BORDERS, COLORS } from '../../helix-design-system' import { DIRECTION_COLUMN, @@ -10,10 +8,12 @@ import { Flex } from '../../primitives' import { SPACING } from '../../ui-style-constants' import { ModalShell } from '../../modals' +import type { MouseEventHandler, ReactNode } from 'react' + interface MenuListProps { - children: React.ReactNode + children: ReactNode isOnDevice?: boolean - onClick?: React.MouseEventHandler + onClick?: MouseEventHandler } export const MenuList = (props: MenuListProps): JSX.Element | null => { diff --git a/components/src/atoms/Snackbar/__tests__/Snackbar.test.tsx b/components/src/atoms/Snackbar/__tests__/Snackbar.test.tsx index a4ae1f8f6b0..0f093548cdc 100644 --- a/components/src/atoms/Snackbar/__tests__/Snackbar.test.tsx +++ b/components/src/atoms/Snackbar/__tests__/Snackbar.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, expect, vi, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' import { screen, act } from '@testing-library/react' @@ -6,12 +5,14 @@ import { renderWithProviders } from '../../../testing/utils' import { Snackbar } from '..' import { COLORS } from '../../../helix-design-system' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders()[0] } describe('Snackbar', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { message: 'test message', diff --git a/components/src/atoms/StyledText/LegacyStyledText.tsx b/components/src/atoms/StyledText/LegacyStyledText.tsx index 83df2c69e06..7816a8967f9 100644 --- a/components/src/atoms/StyledText/LegacyStyledText.tsx +++ b/components/src/atoms/StyledText/LegacyStyledText.tsx @@ -2,11 +2,11 @@ import styled, { css } from 'styled-components' import { Text } from '../../primitives' import { TYPOGRAPHY, RESPONSIVENESS } from '../../ui-style-constants' -import type * as React from 'react' +import type { ComponentProps, ReactNode } from 'react' import type { FlattenSimpleInterpolation } from 'styled-components' -export interface LegacyProps extends React.ComponentProps { - children?: React.ReactNode +export interface LegacyProps extends ComponentProps { + children?: ReactNode } const styleMap: { [tag: string]: FlattenSimpleInterpolation } = { diff --git a/components/src/atoms/StyledText/StyledText.tsx b/components/src/atoms/StyledText/StyledText.tsx index fc33536da9a..df16b3f8b0a 100644 --- a/components/src/atoms/StyledText/StyledText.tsx +++ b/components/src/atoms/StyledText/StyledText.tsx @@ -3,7 +3,7 @@ import { Text } from '../../primitives' import { TYPOGRAPHY, RESPONSIVENESS } from '../../ui-style-constants' import { TYPOGRAPHY as HELIX_TYPOGRAPHY } from '../../helix-design-system/product' -import type * as React from 'react' +import type { ComponentProps, ReactNode } from 'react' import type { FlattenSimpleInterpolation } from 'styled-components' const helixProductStyleMap = { @@ -290,10 +290,10 @@ const ODDStyleMap = { }, } as const -export interface Props extends React.ComponentProps { +export interface Props extends ComponentProps { oddStyle?: ODDStyles desktopStyle?: HelixStyles - children?: React.ReactNode + children?: ReactNode } export const ODD_STYLES = Object.keys(ODDStyleMap) export const HELIX_STYLES = Object.keys(helixProductStyleMap) diff --git a/components/src/atoms/Tag/__tests__/Tag.test.tsx b/components/src/atoms/Tag/__tests__/Tag.test.tsx index dcb25c77d27..9c7ba83731d 100644 --- a/components/src/atoms/Tag/__tests__/Tag.test.tsx +++ b/components/src/atoms/Tag/__tests__/Tag.test.tsx @@ -1,16 +1,17 @@ -import type * as React from 'react' import { describe, it, expect } from 'vitest' import { screen } from '@testing-library/react' import { COLORS } from '../../../helix-design-system' import { renderWithProviders } from '../../../testing/utils' import { Tag } from '../index' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders() } describe('Tag', () => { - let props: React.ComponentProps + let props: ComponentProps it('should render text, icon with default', () => { props = { diff --git a/components/src/atoms/Toast/__tests__/ODDToast.test.tsx b/components/src/atoms/Toast/__tests__/ODDToast.test.tsx index d198df7f03e..3999fc8ec6e 100644 --- a/components/src/atoms/Toast/__tests__/ODDToast.test.tsx +++ b/components/src/atoms/Toast/__tests__/ODDToast.test.tsx @@ -1,16 +1,17 @@ -import type * as React from 'react' import { describe, it, expect, vi, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' import { act, fireEvent, screen } from '@testing-library/react' import { renderWithProviders } from '../../../testing/utils' import { Toast, TOAST_ANIMATION_DURATION } from '..' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders()[0] } describe('Toast', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { id: '1', diff --git a/components/src/atoms/Toast/__tests__/Toast.test.tsx b/components/src/atoms/Toast/__tests__/Toast.test.tsx index 5133651ecd6..2d4e189e895 100644 --- a/components/src/atoms/Toast/__tests__/Toast.test.tsx +++ b/components/src/atoms/Toast/__tests__/Toast.test.tsx @@ -1,16 +1,17 @@ -import type * as React from 'react' import { describe, it, expect, vi, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' import { act, fireEvent, screen } from '@testing-library/react' import { renderWithProviders } from '../../../testing/utils' import { Toast, TOAST_ANIMATION_DURATION } from '..' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders()[0] } describe('Toast', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { id: '1', diff --git a/components/src/atoms/ToggleGroup/__tests__/ToggleGroup.test.tsx b/components/src/atoms/ToggleGroup/__tests__/ToggleGroup.test.tsx index f7beb737696..f754467da5e 100644 --- a/components/src/atoms/ToggleGroup/__tests__/ToggleGroup.test.tsx +++ b/components/src/atoms/ToggleGroup/__tests__/ToggleGroup.test.tsx @@ -1,15 +1,16 @@ -import type * as React from 'react' import { describe, it, expect, vi } from 'vitest' import { fireEvent, screen } from '@testing-library/react' import { renderWithProviders } from '../../../testing/utils' import { ToggleGroup } from '../index' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders() } describe('ToggleGroup', () => { - let props: React.ComponentProps + let props: ComponentProps it('should render text and buttons', () => { props = { diff --git a/components/src/atoms/Tooltip/__tests__/Tooltip.test.tsx b/components/src/atoms/Tooltip/__tests__/Tooltip.test.tsx index ddc1e4f6a1a..18fe3fcce85 100644 --- a/components/src/atoms/Tooltip/__tests__/Tooltip.test.tsx +++ b/components/src/atoms/Tooltip/__tests__/Tooltip.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, expect, vi, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' import { screen } from '@testing-library/react' @@ -11,7 +10,9 @@ import { POSITION_ABSOLUTE } from '../../../styles' import { renderWithProviders } from '../../../testing/utils' import { Tooltip } from '..' -const render = (props: React.ComponentProps) => { +import type { ComponentProps, ReactNode } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders()[0] } @@ -39,11 +40,11 @@ const MockTooltipProps = { } describe('Tooltip', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { - children: 'mock children' as React.ReactNode, + children: 'mock children' as ReactNode, tooltipProps: MockTooltipProps, key: 'mock key', } diff --git a/components/src/atoms/Tooltip/index.tsx b/components/src/atoms/Tooltip/index.tsx index 6bc04add77c..9ba18b99e1e 100644 --- a/components/src/atoms/Tooltip/index.tsx +++ b/components/src/atoms/Tooltip/index.tsx @@ -1,15 +1,14 @@ -import type * as React from 'react' - import { COLORS } from '../../helix-design-system' import { TYPOGRAPHY } from '../../ui-style-constants' import { LegacyTooltip } from '../../tooltips' import { FLEX_MAX_CONTENT } from '../../styles' +import type { ReactNode } from 'react' import type { UseTooltipResultTooltipProps } from '../../tooltips' import type { StyleProps } from '../../primitives' export interface TooltipProps extends StyleProps { - children: React.ReactNode + children: ReactNode tooltipProps: UseTooltipResultTooltipProps & { visible: boolean } key?: string } diff --git a/components/src/atoms/buttons/LargeButton.tsx b/components/src/atoms/buttons/LargeButton.tsx index 67436adf6ed..7bfcf4b6533 100644 --- a/components/src/atoms/buttons/LargeButton.tsx +++ b/components/src/atoms/buttons/LargeButton.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { css } from 'styled-components' import { Btn } from '../../primitives' @@ -16,6 +15,7 @@ import { } from '../..' import { Icon } from '../../icons' +import type { ReactNode } from 'react' import type { StyleProps } from '../../primitives' import type { IconName } from '../../icons' @@ -126,7 +126,7 @@ interface LargeButtonProps extends StyleProps { type?: 'submit' onClick?: () => void buttonType?: LargeButtonTypes - buttonText: React.ReactNode + buttonText: ReactNode iconName?: IconName disabled?: boolean /** aria-disabled for displaying snack bar. */ diff --git a/components/src/atoms/buttons/RadioButton.tsx b/components/src/atoms/buttons/RadioButton.tsx index a4d1a769144..8b371912e6a 100644 --- a/components/src/atoms/buttons/RadioButton.tsx +++ b/components/src/atoms/buttons/RadioButton.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import styled, { css } from 'styled-components' import { Flex } from '../../primitives' import { COLORS, BORDERS } from '../../helix-design-system' @@ -12,14 +11,16 @@ import { Icon, StyledText, } from '../../index' + +import type { ChangeEventHandler, ReactNode } from 'react' +import type { FlattenSimpleInterpolation } from 'styled-components' import type { IconName } from '../../icons' import type { StyleProps } from '../../primitives' -import type { FlattenSimpleInterpolation } from 'styled-components' interface RadioButtonProps extends StyleProps { - buttonLabel: string | React.ReactNode + buttonLabel: string | ReactNode buttonValue: string | number - onChange: React.ChangeEventHandler + onChange: ChangeEventHandler disabled?: boolean iconName?: IconName isSelected?: boolean diff --git a/components/src/atoms/buttons/__tests__/AlertPrimaryButton.test.tsx b/components/src/atoms/buttons/__tests__/AlertPrimaryButton.test.tsx index cad0175d981..61d1b07729c 100644 --- a/components/src/atoms/buttons/__tests__/AlertPrimaryButton.test.tsx +++ b/components/src/atoms/buttons/__tests__/AlertPrimaryButton.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, beforeEach, expect } from 'vitest' import { screen } from '@testing-library/react' import '@testing-library/jest-dom/vitest' @@ -8,12 +7,14 @@ import { TYPOGRAPHY, SPACING } from '../../../ui-style-constants' import { AlertPrimaryButton } from '../AlertPrimaryButton' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders()[0] } describe('AlertPrimaryButton', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/components/src/atoms/buttons/__tests__/AltPrimaryButton.test.tsx b/components/src/atoms/buttons/__tests__/AltPrimaryButton.test.tsx index f65613d0561..7697336c219 100644 --- a/components/src/atoms/buttons/__tests__/AltPrimaryButton.test.tsx +++ b/components/src/atoms/buttons/__tests__/AltPrimaryButton.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, beforeEach, expect } from 'vitest' import { screen } from '@testing-library/react' import '@testing-library/jest-dom/vitest' @@ -7,12 +6,14 @@ import { BORDERS, COLORS } from '../../../helix-design-system' import { TYPOGRAPHY, SPACING } from '../../../ui-style-constants' import { AltPrimaryButton } from '../AltPrimaryButton' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders()[0] } describe('AltPrimaryButton', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/components/src/atoms/buttons/__tests__/EmptySelectorButton.test.tsx b/components/src/atoms/buttons/__tests__/EmptySelectorButton.test.tsx index 6fea2d8d297..bf5e2953086 100644 --- a/components/src/atoms/buttons/__tests__/EmptySelectorButton.test.tsx +++ b/components/src/atoms/buttons/__tests__/EmptySelectorButton.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import '@testing-library/jest-dom/vitest' import { fireEvent, screen } from '@testing-library/react' import { describe, it, expect, vi, beforeEach } from 'vitest' @@ -6,12 +5,14 @@ import { renderWithProviders } from '../../../testing/utils' import { JUSTIFY_CENTER, JUSTIFY_START } from '../../../styles' import { EmptySelectorButton } from '../EmptySelectorButton' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders()[0] } describe('EmptySelectorButton', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { onClick: vi.fn(), diff --git a/components/src/atoms/buttons/__tests__/LargeButton.test.tsx b/components/src/atoms/buttons/__tests__/LargeButton.test.tsx index 52f6c9e71f6..628dd88b541 100644 --- a/components/src/atoms/buttons/__tests__/LargeButton.test.tsx +++ b/components/src/atoms/buttons/__tests__/LargeButton.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, expect, vi, beforeEach } from 'vitest' import '@testing-library/jest-dom/vitest' import { fireEvent, screen } from '@testing-library/react' @@ -7,12 +6,14 @@ import { renderWithProviders } from '../../../testing/utils' import { COLORS } from '../../../helix-design-system' import { LargeButton } from '../LargeButton' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders()[0] } describe('LargeButton', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { onClick: vi.fn(), diff --git a/components/src/atoms/buttons/__tests__/PrimaryButton.test.tsx b/components/src/atoms/buttons/__tests__/PrimaryButton.test.tsx index 558f4a595eb..8f465d4bc63 100644 --- a/components/src/atoms/buttons/__tests__/PrimaryButton.test.tsx +++ b/components/src/atoms/buttons/__tests__/PrimaryButton.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, beforeEach, expect } from 'vitest' import { fireEvent, screen } from '@testing-library/react' import '@testing-library/jest-dom/vitest' @@ -7,12 +6,14 @@ import { BORDERS, COLORS } from '../../../helix-design-system' import { TYPOGRAPHY, SPACING } from '../../../ui-style-constants' import { PrimaryButton } from '../PrimaryButton' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders()[0] } describe('PrimaryButton', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/components/src/atoms/buttons/__tests__/RadioButton.test.tsx b/components/src/atoms/buttons/__tests__/RadioButton.test.tsx index 95aaf6532fc..b259bcc97fb 100644 --- a/components/src/atoms/buttons/__tests__/RadioButton.test.tsx +++ b/components/src/atoms/buttons/__tests__/RadioButton.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import '@testing-library/jest-dom/vitest' import { screen, queryByAttribute } from '@testing-library/react' import { describe, it, expect, vi, beforeEach } from 'vitest' @@ -7,12 +6,14 @@ import { COLORS } from '../../../helix-design-system' import { SPACING } from '../../../ui-style-constants' import { RadioButton } from '../RadioButton' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders()[0] } describe('RadioButton', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { onChange: vi.fn(), diff --git a/components/src/atoms/buttons/__tests__/SecondaryButton.test.tsx b/components/src/atoms/buttons/__tests__/SecondaryButton.test.tsx index 8887e679268..c7fdcc3229f 100644 --- a/components/src/atoms/buttons/__tests__/SecondaryButton.test.tsx +++ b/components/src/atoms/buttons/__tests__/SecondaryButton.test.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import { describe, it, beforeEach, expect } from 'vitest' import { screen } from '@testing-library/react' import '@testing-library/jest-dom/vitest' @@ -8,12 +7,14 @@ import { BORDERS, COLORS } from '../../../helix-design-system' import { SecondaryButton } from '../SecondaryButton' -const render = (props: React.ComponentProps) => { +import type { ComponentProps } from 'react' + +const render = (props: ComponentProps) => { return renderWithProviders()[0] } describe('SecondaryButton', () => { - let props: React.ComponentProps + let props: ComponentProps beforeEach(() => { props = { diff --git a/components/src/buttons/Button.tsx b/components/src/buttons/Button.tsx index 749c4e603a5..3c159a3b759 100644 --- a/components/src/buttons/Button.tsx +++ b/components/src/buttons/Button.tsx @@ -1,4 +1,3 @@ -import type * as React from 'react' import cx from 'classnames' import omit from 'lodash/omit' @@ -7,6 +6,7 @@ import styles from './buttons.module.css' import { BUTTON_TYPE_BUTTON } from '../primitives' +import type { ComponentType, MouseEventHandler, ReactNode } from 'react' import type { BUTTON_TYPE_SUBMIT, BUTTON_TYPE_RESET } from '../primitives' import type { IconName } from '../icons' import type { UseHoverTooltipTargetProps } from '../tooltips' @@ -15,7 +15,7 @@ export interface ButtonProps { /** id attribute */ id?: string /** click handler */ - onClick?: React.MouseEventHandler + onClick?: MouseEventHandler /** name attribute */ name?: string /** title attribute */ @@ -31,7 +31,7 @@ export interface ButtonProps { /** inverts the default color/background/border of default button style */ inverted?: boolean /** contents of the button */ - children?: React.ReactNode + children?: ReactNode /** type of button (default "button") */ type?: | typeof BUTTON_TYPE_SUBMIT @@ -40,7 +40,7 @@ export interface ButtonProps { /** ID of form that button is for */ form?: string /** custom element or component to use instead of `