MCPcopy Index your code
hub / github.com/go-telegram/bot / TestMigrateError

Function TestMigrateError

errors_test.go:29–48  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

27}
28
29func TestMigrateError(t *testing.T) {
30 err := &MigrateError{
31 Message: "chat migrated",
32 MigrateToChatID: 12345,
33 }
34
35 expectedErrorMsg := "chat migrated: migrate_to_chat_id 12345"
36 if err.Error() != expectedErrorMsg {
37 t.Errorf("expected %s, got %s", expectedErrorMsg, err.Error())
38 }
39
40 if !IsMigrateError(err) {
41 t.Errorf("expected IsMigrateError to return true")
42 }
43
44 var genericError error = err
45 if !IsMigrateError(genericError) {
46 t.Errorf("expected IsMigrateError to return true for generic error type")
47 }
48}
49
50func TestStandardErrors(t *testing.T) {
51 tests := []struct {

Callers

nothing calls this directly

Calls 2

ErrorMethod · 0.95
IsMigrateErrorFunction · 0.85

Tested by

no test coverage detected