Canstralian commited on
Commit
b290e5c
·
verified ·
1 Parent(s): e6c0d6b

Create test_chat_loop.py

Browse files
Files changed (1) hide show
  1. tests/test_chat_loop.py +21 -0
tests/test_chat_loop.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from your_module.components.chat_loop import chat_loop
2
+ import unittest
3
+ from unittest.mock import MagicMock
4
+ import streamlit as st
5
+
6
+ class TestChatLoop(unittest.TestCase):
7
+
8
+ def test_chat_loop_renders_correctly(self):
9
+ session_state_mock = MagicMock()
10
+ config_mock = {"chat_key": "value"}
11
+
12
+ # Mocking Streamlit's write function
13
+ st.write = MagicMock()
14
+
15
+ chat_loop(session_state_mock, config_mock)
16
+
17
+ # Assert that the chat loop writes to the screen
18
+ st.write.assert_called_with("Chat Loop Running...")
19
+
20
+ if __name__ == '__main__':
21
+ unittest.main()