def assert_next(
    next_message: NextMessage,
    id: str,
    data: dict[str, object],
    extensions: Optional[dict[str, object]] = None,
):
    """
    Assert that the NextMessage payload contains the provided data.
    If extensions is provided, it will also assert that the
    extensions are present
    """
    assert next_message["type"] == "next"
    assert next_message["id"] == id
    assert set(next_message["payload"].keys()) <= {"data", "errors", "extensions"}
    assert "data" in next_message["payload"]
    assert next_message["payload"]["data"] == data
    if extensions is not None:
        assert "extensions" in next_message["payload"]
        assert next_message["payload"]["extensions"] == extensions

    Assert that the NextMessage payload contains the provided data.
    If extensions is provided, it will also assert that the
    extensions are present
    
tests/websockets/test_graphql_transport_ws.py