import sys, os
sys.path.insert(0, os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'src', 'shared'))

from bot_base import BotConfig, BaseBot
cfg = BotConfig(jid="t@y.f", password="x")
assert cfg.nick == "t"
assert cfg.host == "xmpp.yoin.fun"
assert BaseBot.extract_response("hello") == "hello"
assert BaseBot.extract_response("__SILENT__") is None
assert BaseBot.extract_response("<tool_calls>x</tool_calls>") == ""
print("bot_base: PASS")

os.environ["XXM_JID"] = "test@yoin.fun"
os.environ["XXM_PASS"] = "test123"
os.environ["VOLCENGINE_KEY"] = "vk-test"
from config import get_bot_config
cfg2 = get_bot_config("xxm")
assert cfg2.jid == "test@yoin.fun"
assert cfg2.providers["volcengine"]["api_key"] == "vk-test"
print("config: PASS")

print("\nALL TESTS PASSED")
