@@ -12,7 +12,6 @@ import {
12
12
import {
13
13
act ,
14
14
render ,
15
- renderHook ,
16
15
waitFor ,
17
16
screen ,
18
17
fireEvent ,
@@ -26,7 +25,6 @@ import {
26
25
MessageRole ,
27
26
FeedbackType ,
28
27
} from "@ragbits/api-client-react" ;
29
- import { useConfigContext } from "../../src/core/contexts/ConfigContext/useConfigContext" ;
30
28
import { ConfigContextProvider } from "../../src/core/contexts/ConfigContext/ConfigContextProvider" ;
31
29
import userEvent from "@testing-library/user-event" ;
32
30
import PromptInput from "../../src/core/components/inputs/PromptInput/PromptInput" ;
@@ -61,69 +59,6 @@ historyStore.getState()._internal._setHasHydrated(true);
61
59
62
60
describe ( "Integration tests" , ( ) => {
63
61
const BASE_URL = "http://127.0.0.1:8000" ;
64
- const renderWithHook = < R , > ( hook : ( ) => R ) => {
65
- return renderHook ( ( ) => hook ( ) , {
66
- wrapper : ( { children } : { children : React . ReactNode } ) => {
67
- return (
68
- < RagbitsContextProvider baseUrl = { BASE_URL } >
69
- < ConfigContextProvider > { children } </ ConfigContextProvider >
70
- </ RagbitsContextProvider >
71
- ) ;
72
- } ,
73
- } ) ;
74
- } ;
75
- /**
76
- * This should test all default endpoints from the API
77
- * using UIs mechanims
78
- */
79
- describe ( "/api/config" , ( ) => {
80
- it ( "should return config" , async ( ) => {
81
- // TODO: Automate generation of this test
82
- const { result } = renderWithHook ( ( ) => useConfigContext ( ) ) ;
83
-
84
- await waitFor ( ( ) => {
85
- expect ( result . current ) . not . toBeNull ( ) ;
86
- } ) ;
87
-
88
- const config = result . current . config ;
89
- // Customization
90
- expect ( config ) . toHaveProperty ( "customization" ) ;
91
- // Debug mode
92
- expect ( config ) . toHaveProperty ( "debug_mode" ) ;
93
- expect ( typeof config . debug_mode ) . toBe ( "boolean" ) ;
94
- // History mode
95
- expect ( config ) . toHaveProperty ( "conversation_history" ) ;
96
- expect ( typeof config . conversation_history ) . toBe ( "boolean" ) ;
97
- // Authentication
98
- expect ( typeof config . authentication ) . toBe ( "object" ) ;
99
- expect ( typeof config . authentication . enabled ) . toBe ( "boolean" ) ;
100
- expect ( Array . isArray ( config . authentication . auth_types ) ) . toBe ( true ) ;
101
- // Usage
102
- expect ( config ) . toHaveProperty ( "show_usage" ) ;
103
- expect ( typeof config . show_usage ) . toBe ( "boolean" ) ;
104
-
105
- // Feedback
106
- expect ( config ) . toHaveProperty ( "feedback" ) ;
107
- expect ( config . feedback ) . toHaveProperty ( FeedbackType . Like ) ;
108
- expect ( config . feedback ) . toHaveProperty ( "like" ) ;
109
- expect ( config . feedback . like ) . toHaveProperty ( "enabled" ) ;
110
- expect ( typeof config . feedback . like . enabled === "boolean" ) . toBe ( true ) ;
111
- expect ( config . feedback . like ) . toHaveProperty ( "form" ) ;
112
- expect (
113
- config . feedback . like . form === null ||
114
- config . feedback . like . form instanceof Object ,
115
- ) . toBe ( true ) ;
116
-
117
- expect ( config . feedback ) . toHaveProperty ( FeedbackType . Dislike ) ;
118
- expect ( config . feedback . dislike ) . toHaveProperty ( "enabled" ) ;
119
- expect ( typeof config . feedback . dislike . enabled === "boolean" ) . toBe ( true ) ;
120
- expect ( config . feedback . dislike ) . toHaveProperty ( "form" ) ;
121
- expect (
122
- config . feedback . dislike . form === null ||
123
- config . feedback . dislike . form instanceof Object ,
124
- ) . toBe ( true ) ;
125
- } ) ;
126
- } ) ;
127
62
128
63
describe ( "/api/chat" , { timeout : 30000 } , ( ) => {
129
64
describe ( "should call chat endpoint with correct data" , ( ) => {
0 commit comments