test(client): avoid fatal assertions in send callbacks
- commit
- 00f573e831a2786847de08bac0d8751e991c816a
- author
- brice · · 2026-07-17 09:22 UTC
- parent
- 7995fb3
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
1 file · +8 -2
M internal/usecase/client/client_test.go +8 -2
| @@ -1121,7 +1121,10 @@ func TestAttachSchemeRequeryCreatesPaletteGenerationBoundary(t *testing.T) { | |||
| 1121 | 1121 | tr.EXPECT().Send(isType(ports.MsgHello)).Return(nil).Once() | |
| 1122 | 1122 | tr.EXPECT().Send(isType(ports.MsgTheme)).RunAndReturn(func(f ports.Frame) error { | |
| 1123 | 1123 | theme, err := ports.UnmarshalTheme(f.Payload) | |
| 1124 | - | require.NoError(t, err) | |
| 1124 | + | if err != nil { | |
| 1125 | + | t.Errorf("decode sent theme: %v", err) | |
| 1126 | + | return err | |
| 1127 | + | } | |
| 1125 | 1128 | themes <- theme | |
| 1126 | 1129 | return nil | |
| 1127 | 1130 | }).Times(3) | |
| @@ -1210,7 +1213,10 @@ func TestAttachSchemeRequeryClearsStalePalette(t *testing.T) { | |||
| 1210 | 1213 | tr.EXPECT().Send(isType(ports.MsgHello)).Return(nil).Once() | |
| 1211 | 1214 | tr.EXPECT().Send(isType(ports.MsgTheme)).RunAndReturn(func(f ports.Frame) error { | |
| 1212 | 1215 | theme, err := ports.UnmarshalTheme(f.Payload) | |
| 1213 | - | require.NoError(t, err) | |
| 1216 | + | if err != nil { | |
| 1217 | + | t.Errorf("decode sent theme: %v", err) | |
| 1218 | + | return err | |
| 1219 | + | } | |
| 1214 | 1220 | themesMu.Lock() | |
| 1215 | 1221 | themes = append(themes, theme) | |
| 1216 | 1222 | themesMu.Unlock() | |
| @@ -1121,7 +1121,10 @@ func TestAttachSchemeRequeryCreatesPaletteGenerationBoundary(t *testing.T) { | |||||
| 1121 | tr.EXPECT().Send(isType(ports.MsgHello)).Return(nil).Once() | 1121 | tr.EXPECT().Send(isType(ports.MsgHello)).Return(nil).Once() | ||
| 1122 | tr.EXPECT().Send(isType(ports.MsgTheme)).RunAndReturn(func(f ports.Frame) error { | 1122 | tr.EXPECT().Send(isType(ports.MsgTheme)).RunAndReturn(func(f ports.Frame) error { | ||
| 1123 | theme, err := ports.UnmarshalTheme(f.Payload) | 1123 | theme, err := ports.UnmarshalTheme(f.Payload) | ||
| 1124 | - | require.NoError(t, err) | 1124 | + | if err != nil { |
| 1125 | + | t.Errorf("decode sent theme: %v", err) | |||
| 1126 | + | return err | |||
| 1127 | + | } | |||
| 1125 | themes <- theme | 1128 | themes <- theme | ||
| 1126 | return nil | 1129 | return nil | ||
| 1127 | }).Times(3) | 1130 | }).Times(3) | ||
| @@ -1210,7 +1213,10 @@ func TestAttachSchemeRequeryClearsStalePalette(t *testing.T) { | |||||
| 1210 | tr.EXPECT().Send(isType(ports.MsgHello)).Return(nil).Once() | 1213 | tr.EXPECT().Send(isType(ports.MsgHello)).Return(nil).Once() | ||
| 1211 | tr.EXPECT().Send(isType(ports.MsgTheme)).RunAndReturn(func(f ports.Frame) error { | 1214 | tr.EXPECT().Send(isType(ports.MsgTheme)).RunAndReturn(func(f ports.Frame) error { | ||
| 1212 | theme, err := ports.UnmarshalTheme(f.Payload) | 1215 | theme, err := ports.UnmarshalTheme(f.Payload) | ||
| 1213 | - | require.NoError(t, err) | 1216 | + | if err != nil { |
| 1217 | + | t.Errorf("decode sent theme: %v", err) | |||
| 1218 | + | return err | |||
| 1219 | + | } | |||
| 1214 | themesMu.Lock() | 1220 | themesMu.Lock() | ||
| 1215 | themes = append(themes, theme) | 1221 | themes = append(themes, theme) | ||
| 1216 | themesMu.Unlock() | 1222 | themesMu.Unlock() | ||