Thomas Valloo
06/04/2024, 10:21 AMdeclareMock<SupabaseClient> {
every { auth } returns mockk {
coEvery {
signInWith(Email) {
this.email = any()
this.password = any()
}
} throws HttpRequestTimeoutException("<http://www.website.com|www.website.com>", 1000)
}
}
but got this error :
java.lang.IllegalStateException: Plugin auth not installed or not of type Auth. Consider installing Auth within your SupabaseClientBuilder
at io.github.jan.supabase.gotrue.AuthKt.getAuth(Auth.kt:409)
ThanksThomas Valloo
06/04/2024, 10:53 AMdeclareMock<SupabaseClient> {
every { pluginManager } returns mockk {
every { installedPlugins[Auth.key] } returns mockk<Auth> {
coEvery {
signInWith(Email) {
this.email = any()
this.password = any()
}
} throws HttpRequestTimeoutException("<http://www.website.com|www.website.com>", 1000)
}
}
}
Jan
06/04/2024, 11:45 AMauth
property only has a getter which calls pluginManager.getPlugin(Auth)
. So that would be your best solutionThomas Valloo
06/11/2024, 1:57 PMdeclareMock<SupabaseClient> {
every { pluginManager } returns mockk {
every { installedPlugins[Auth.key] } returns mockk<Auth> {
every { config } returns mockk<AuthConfig> {
every { defaultRedirectUrl } returns "<http://www.redirect.com|www.redirect.com>"
}
coEvery {
signInWith(Email, any(), any())
} throws BadRequestRestException("invalid_grant", mockk<HttpResponse> {
every { request } returns mockk<HttpRequest> {
every { url } returns Url("<http://www.website.com|www.website.com>")
every { headers } returns Headers.Empty
every { method } returns HttpMethod.Get
}
})
}
}
}