graasp / graasp/client

Add websocket integration tests in Builder

Open
#714 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
0
Forks
4
PR merge metrics
No merged PRs in 30d

Description

Add integrations tests in https://github.com/graasp/graasp-compose/tree/master/cypress/integration/ws for new behaviours and API introduced by graasp/graasp-builder#191

### Howto

For each hook call in a component, check if it subscribes to a websocket channel. For instance `ItemScreen` calls `useItem(itemId)`, which in turns calls `useItemUpdates`: https://github.com/graasp/graasp-query-client/blob/5cd8e1392d81583d754baaa9371157400543b77e/src/hooks/item.ts#L149-L152

Then, check the list of corresponding events that should be sent by the backend: in this case https://github.com/graasp/graasp/blob/d44ec1fc342424e78b10ca90123ec0fea3f8d3ca/src/services/items/ws/events.ts#L20-L27

For each possible `op`, design integration test case that uses the mock test WS client https://github.com/graasp/graasp-websockets/blob/master/test/mock-client.js injected into the browser window, and receive each event as defined by the aforementioned API. See examples at https://github.com/graasp/graasp-compose/tree/master/cypress/integration/ws

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.