Stratal API Reference
    Preparing search index...

    Class TestWsConnection

    TestWsConnection

    Live WebSocket connection wrapper with assertion helpers for testing.

    const ws = await module.ws('/ws/chat').connect()
    ws.send('hello')
    await ws.assertMessage('echo:hello')
    ws.close()
    await ws.waitForClose()
    Index

    Constructors

    Accessors

    Methods

    • Assert that the connection closes, optionally with an expected code

      Parameters

      • OptionalexpectedCode: number
      • timeout: number = 5000

      Returns Promise<void>