mirror of
https://github.com/status-im/status-go.git
synced 2025-02-06 11:56:01 +00:00
feat_: endpoint for testing panic reports (#6126)
* feat_: endpoint for testing panic reports * test_: TestIntendedPanic * fix_: linter
This commit is contained in:
parent
9bc514805d
commit
81bd17ca01
@ -2261,3 +2261,13 @@ func addCentralizedMetric(requestJSON string) string {
|
|||||||
|
|
||||||
return metric.ID
|
return metric.ID
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func IntendedPanic(message string) string {
|
||||||
|
type intendedPanic struct {
|
||||||
|
error
|
||||||
|
}
|
||||||
|
return callWithResponse(func() {
|
||||||
|
err := intendedPanic{error: errors.New(message)}
|
||||||
|
panic(err)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
@ -6,6 +6,8 @@ import (
|
|||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
|
"github.com/brianvoe/gofakeit/v6"
|
||||||
|
|
||||||
"github.com/status-im/status-go/multiaccounts"
|
"github.com/status-im/status-go/multiaccounts"
|
||||||
"github.com/status-im/status-go/multiaccounts/settings"
|
"github.com/status-im/status-go/multiaccounts/settings"
|
||||||
"github.com/status-im/status-go/signal"
|
"github.com/status-im/status-go/signal"
|
||||||
@ -38,3 +40,10 @@ func TestSetMobileSignalHandler(t *testing.T) {
|
|||||||
require.Contains(t, handler.receivedSignal, `"name":"test"`, "Signal should contain the correct account name")
|
require.Contains(t, handler.receivedSignal, `"name":"test"`, "Signal should contain the correct account name")
|
||||||
require.Contains(t, handler.receivedSignal, `"ensUsernames":{"test":"test"}`, "Signal should contain the correct ENS usernames")
|
require.Contains(t, handler.receivedSignal, `"ensUsernames":{"test":"test"}`, "Signal should contain the correct ENS usernames")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestIntendedPanic(t *testing.T) {
|
||||||
|
message := gofakeit.LetterN(5)
|
||||||
|
require.PanicsWithError(t, message, func() {
|
||||||
|
IntendedPanic(message)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user