code: def test_to_dict(self):
      component = SearchApiWebSearch(
          api_key="api_key",
          top_k=10,
          allowed_domains=["testdomain.com"],
          search_params={"param": "test params"},
      )
      data = component.to_dict()
      assert data == {
          "type": "haystack.components.websearch.searchapi.SearchApiWebSearch",
          "init_parameters": {
              "top_k": 10,
              "allowed_domains": ["testdomain.com"],
              "search_params": {"param": "test params"},
          },
      }
  
file_path: haystack/test/components/websearch/test_searchapi.py
imports: import os
  from unittest.mock import Mock, patch
  import pytest
  from requests import Timeout, RequestException, HTTPError
  from haystack import Document
  from haystack.components.websearch.searchapi import SearchApiError, SearchApiWebSearch
label_desc: Use image node_id 2 for calling the TestSearchApiSearchAPI obj's underlying member method code with example usage: obj.test_to_dict() without return types