Skip to content

Commit 4385b0d

Browse files
authored
feat(connecting): implement WebSocket message subscriptions (#310)
* feat(members): implement WebSocket message subscriptions * fix: npm audit fix * fix: remove audit workflow, snyk is set up to scan our repo more wholistically * refactor(tests): replace Connect mock with real component in ConnectWidget-test.tsx * fix: add optional chaining to protect from when isConnected is not provided * fix: priority data was not correctly handled, ensure member data is available * fix(websockets): add tests for recent changes
1 parent 3d984db commit 4385b0d

16 files changed

Lines changed: 693 additions & 111 deletions

File tree

.github/workflows/audit.yml

Lines changed: 0 additions & 17 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ const App = () => {
4848
| `profiles` | [`ProfilesTypes`](./typings/connectProps.d.ts) | The connect widget uses the profiles to set the initial state of the widget. [More details](./docs/PROFILES.md) | See more details |
4949
| `userFeatures` | [`UserFeaturesType`](./typings/connectProps.d.ts) | The connect widget uses user features to determine the behavior of the widget. [More details](./docs/USER_FEATURES.md) | See more details |
5050
| `showTooSmallDialog` | `boolean` | The connect widget can show a warning when the widget size is below the supported 320px. | `true` |
51+
| `webSocketConnection` | `object` | An object containing `isConnected()` function and `webSocketMessages$` observable for real-time updates. | `null` |
52+
| `experimentalFeatures` | `object` | An object to enable or disable experimental features like `useWebSockets: true`. | `null` |
5153

5254
## ApiProvider
5355

architectureDecisionRecords/0003AutomatedTestingFrontend.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ We will use the following technologies to test:
1818
1. [Vitest](https://vitest.dev/) for unit/integration tests
1919
1. [MSW](https://mswjs.io/docs/getting-started/) for api mocking in unit/integration tests
2020

21-
We will mock as little as possible in our tests and [prefer integration tests over unit tests](https://kentcdodds.com/blog/write-tests). The bulk of our tests will be integration tests, because they provide the best performance to confidence ratio.
21+
We will mock as little as possible in our tests and [prefer integration tests over unit tests](https://kentcdodds.com/blog/write-tests). The bulk of our tests will be integration tests, because they provide the best performance to confidence ratio. We also prefer to render real components rather than using mocks (e.g., `vi.mock`) in integration tests to ensure that context and side-effects are correctly wired.
2222

2323
The purpose of our end to end tests will be to validate that the frontend is working with the backend properly, and that apis are working together properly. We don't need to test every edge case in our end to end tests, because using MSW allows us to test those edge cases in our integration tests.
2424

0 commit comments

Comments
 (0)