|
| 1 | +// Jest Snapshot v1, https://goo.gl/fbAQLP |
| 2 | + |
| 3 | +exports[`Testing of RegisterReceiveOperations component render RegisterReceiveOperations component with receive operations 1`] = ` |
| 4 | +"def register_receive_message_handler(self, handler, discriminator_key=None, discriminator_value=None): |
| 5 | + \\"\\"\\" |
| 6 | + Register a handler for receiveMessage operation. |
| 7 | +
|
| 8 | + Args: |
| 9 | + handler (callable): Handler function that receives raw_message as argument |
| 10 | + discriminator_key (str): Message field to use for routing (e.g., 'type', 'event_type') |
| 11 | + discriminator_value (str): Expected value for routing (e.g., 'hello', 'user_joined') |
| 12 | + \\"\\"\\" |
| 13 | + if not callable(handler): |
| 14 | + print(\\"Handler must be callable\\") |
| 15 | + return |
| 16 | +
|
| 17 | + # Validate that either both discriminator_key and discriminator_value are provided or neither |
| 18 | + if (discriminator_key is not None and discriminator_value is None) or (discriminator_key is None and discriminator_value is not None): |
| 19 | + print(\\"Error: Both discriminator_key and discriminator_value must be provided together\\") |
| 20 | + return |
| 21 | +
|
| 22 | + # Register handler |
| 23 | + self.receive_operation_handlers[\\"receiveMessage\\"] = handler |
| 24 | +
|
| 25 | + # Add discriminator entry to the list if both key and value are provided |
| 26 | + if discriminator_key is not None and discriminator_value is not None: |
| 27 | + discriminator_entry = { |
| 28 | + \\"key\\": discriminator_key, |
| 29 | + \\"value\\": discriminator_value, |
| 30 | + \\"operation_id\\": \\"receiveMessage\\" |
| 31 | + } |
| 32 | + |
| 33 | + # Check if this discriminator already exists |
| 34 | + exists = any( |
| 35 | + d.get(\\"key\\") == discriminator_key and |
| 36 | + d.get(\\"value\\") == discriminator_value and |
| 37 | + d.get(\\"operation_id\\") == \\"receiveMessage\\" |
| 38 | + for d in self.receive_operation_discriminators |
| 39 | + ) |
| 40 | +
|
| 41 | + if not exists: |
| 42 | + self.receive_operation_discriminators.append(discriminator_entry) |
| 43 | +
|
| 44 | + def register_receive_notification_handler(self, handler, discriminator_key=None, discriminator_value=None): |
| 45 | + \\"\\"\\" |
| 46 | + Register a handler for receiveNotification operation. |
| 47 | +
|
| 48 | + Args: |
| 49 | + handler (callable): Handler function that receives raw_message as argument |
| 50 | + discriminator_key (str): Message field to use for routing (e.g., 'type', 'event_type') |
| 51 | + discriminator_value (str): Expected value for routing (e.g., 'hello', 'user_joined') |
| 52 | + \\"\\"\\" |
| 53 | + if not callable(handler): |
| 54 | + print(\\"Handler must be callable\\") |
| 55 | + return |
| 56 | +
|
| 57 | + # Validate that either both discriminator_key and discriminator_value are provided or neither |
| 58 | + if (discriminator_key is not None and discriminator_value is None) or (discriminator_key is None and discriminator_value is not None): |
| 59 | + print(\\"Error: Both discriminator_key and discriminator_value must be provided together\\") |
| 60 | + return |
| 61 | +
|
| 62 | + # Register handler |
| 63 | + self.receive_operation_handlers[\\"receiveNotification\\"] = handler |
| 64 | +
|
| 65 | + # Add discriminator entry to the list if both key and value are provided |
| 66 | + if discriminator_key is not None and discriminator_value is not None: |
| 67 | + discriminator_entry = { |
| 68 | + \\"key\\": discriminator_key, |
| 69 | + \\"value\\": discriminator_value, |
| 70 | + \\"operation_id\\": \\"receiveNotification\\" |
| 71 | + } |
| 72 | + |
| 73 | + # Check if this discriminator already exists |
| 74 | + exists = any( |
| 75 | + d.get(\\"key\\") == discriminator_key and |
| 76 | + d.get(\\"value\\") == discriminator_value and |
| 77 | + d.get(\\"operation_id\\") == \\"receiveNotification\\" |
| 78 | + for d in self.receive_operation_discriminators |
| 79 | + ) |
| 80 | +
|
| 81 | + if not exists: |
| 82 | + self.receive_operation_discriminators.append(discriminator_entry)" |
| 83 | +`; |
| 84 | + |
| 85 | +exports[`Testing of RegisterReceiveOperations component renders nothing when receive operations is empty 1`] = `""`; |
| 86 | + |
| 87 | +exports[`Testing of RegisterReceiveOperations component renders nothing when receive operations is null 1`] = `""`; |
| 88 | + |
| 89 | +exports[`Testing of RegisterReceiveOperations component renders nothing when receiveOperations is undefined 1`] = `""`; |
| 90 | + |
| 91 | +exports[`Testing of RegisterReceiveOperations component renders nothing without receive operations 1`] = `""`; |
0 commit comments