import {withWebSocketTest} from '@rest-vir/host';
import {describe, it} from '@augment-vir/test';
describe('my WebSocket', () => {
it(
'does a thing',
withWebSocketTest(
myApiImplementation.implementation.webSockets['/my-web-socket-path'],
{},
async (webSocket) => {
const response = await webSocket.sendAndWaitForReply();
assert.strictEquals(response, 'ok');
},
),
);
});
Test your WebSocket implementation with a real connection pipeline. This is used to generate an
itcallback and will automatically close the WebSocket connection at the end of the test.You can also use testWebSocket to directly test a WebSocket but it does not automatically close the WebSocket.
This should be used in backend testing to verify your WebSocket implementation.