MCPcopy Index your code
hub / github.com/coder/coder / TestStreamErrorStatus

Function TestStreamErrorStatus

coderd/x/chatd/chatdebug/model_internal_test.go:906–928  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

904}
905
906func TestStreamErrorStatus(t *testing.T) {
907 t.Parallel()
908
909 t.Run("CancellationBecomesInterrupted", func(t *testing.T) {
910 t.Parallel()
911 require.Equal(t, StatusInterrupted, streamErrorStatus(StatusCompleted, context.Canceled))
912 })
913
914 t.Run("DeadlineExceededBecomesInterrupted", func(t *testing.T) {
915 t.Parallel()
916 require.Equal(t, StatusInterrupted, streamErrorStatus(StatusCompleted, context.DeadlineExceeded))
917 })
918
919 t.Run("NilErrorBecomesError", func(t *testing.T) {
920 t.Parallel()
921 require.Equal(t, StatusError, streamErrorStatus(StatusCompleted, nil))
922 })
923
924 t.Run("ExistingErrorWins", func(t *testing.T) {
925 t.Parallel()
926 require.Equal(t, StatusError, streamErrorStatus(StatusError, context.Canceled))
927 })
928}
929
930func objectPartsToSeq(parts []fantasy.ObjectStreamPart) fantasy.ObjectStreamResponse {
931 return func(yield func(fantasy.ObjectStreamPart) bool) {

Callers

nothing calls this directly

Calls 3

streamErrorStatusFunction · 0.85
RunMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected