MCPcopy Create free account
hub / github.com/github/gh-aw / TestIsNotFoundError

Function TestIsNotFoundError

pkg/parser/frontmatter_utils_test.go:866–915  ·  view source on GitHub ↗

TestIsNotFoundError verifies the shared errorutil.IsNotFoundError helper covers all known forms of 404/not-found errors returned by the GitHub API and gh CLI.

(t *testing.T)

Source from the content-addressed store, hash-verified

864// TestIsNotFoundError verifies the shared errorutil.IsNotFoundError helper covers
865// all known forms of 404/not-found errors returned by the GitHub API and gh CLI.
866func TestIsNotFoundError(t *testing.T) {
867 tests := []struct {
868 name string
869 err error
870 expected bool
871 }{
872 {
873 name: "HTTP 404 text",
874 err: errors.New("HTTP 404: Not Found"),
875 expected: true,
876 },
877 {
878 name: "not found phrase",
879 err: errors.New("failed to fetch file: not found"),
880 expected: true,
881 },
882 {
883 name: "uppercase not found phrase",
884 err: errors.New("RESOURCE NOT FOUND"),
885 expected: true,
886 },
887 {
888 name: "non-404 status",
889 err: errors.New("HTTP 401: Unauthorized"),
890 expected: false,
891 },
892 {
893 name: "word without space",
894 err: errors.New("remote returned notfound response"),
895 expected: false,
896 },
897 {
898 name: "nil error",
899 err: nil,
900 expected: false,
901 },
902 {
903 name: "whitespace-only message",
904 err: errors.New(" "),
905 expected: false,
906 },
907 }
908
909 for _, tt := range tests {
910 t.Run(tt.name, func(t *testing.T) {
911 result := errorutil.IsNotFoundError(tt.err)
912 assert.Equal(t, tt.expected, result, "errorutil.IsNotFoundError(%v)", tt.err)
913 })
914 }
915}
916
917func TestFrontmatterContainsExpressions(t *testing.T) {
918 tests := []struct {

Callers

nothing calls this directly

Calls 2

IsNotFoundErrorFunction · 0.92
RunMethod · 0.45

Tested by

no test coverage detected