File tree Expand file tree Collapse file tree 1 file changed +25
-0
lines changed
android/src/androidTest/java/com/formbricks/android/network Expand file tree Collapse file tree 1 file changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,31 @@ class FormbricksApiServiceInstrumentedTest {
5050 assertTrue(result.isFailure)
5151 }
5252
53+ @Test
54+ fun testPostUser_withNullAttributes_handlesErrorGracefully () {
55+ val dummyBody = PostUserBody (" dummy-user-id" , null )
56+ val result = apiService.postUser(" dummy-environment-id" , dummyBody)
57+ assertTrue(result.isFailure)
58+ }
59+
60+ @Test
61+ fun testInitialize_multipleTimes_noCrash () {
62+ try {
63+ apiService.initialize(" https://example.com" , isLoggingEnabled = false )
64+ apiService.initialize(" https://another-url.com" , isLoggingEnabled = true )
65+ } catch (e: Exception ) {
66+ fail(" Multiple initializations should not throw: ${e.message} " )
67+ }
68+ }
69+
70+ @Test
71+ fun testGetEnvironmentStateObject_beforeInitialize_returnsFailure () {
72+ val uninitializedService = FormbricksApiService ()
73+ val result = uninitializedService.getEnvironmentStateObject(" dummy" )
74+ assertTrue(result.isFailure)
75+ assertTrue(result.exceptionOrNull() is UninitializedPropertyAccessException )
76+ }
77+
5378 // Add more integration-style tests as needed, e.g.:
5479 // - testGetEnvironmentStateObject_withMockServer
5580 // - testPostUser_withMockServer
You can’t perform that action at this time.
0 commit comments