MCPcopy Create free account
hub / github.com/codnect/procyon / TestDefaultContainer_UsePreProcessor

Function TestDefaultContainer_UsePreProcessor

component/container_test.go:1296–1337  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1294}
1295
1296func TestDefaultContainer_UsePreProcessor(t *testing.T) {
1297 testCases := []struct {
1298 name string
1299 preProcessor PreProcessor
1300
1301 wantErr error
1302 wantLen int
1303 }{
1304 {
1305 name: "nil pre processor",
1306 wantErr: errors.New("nil processor"),
1307 wantLen: 0,
1308 },
1309 {
1310 name: "valid pre processor",
1311 preProcessor: &AnyPreProcessor{},
1312 wantErr: nil,
1313 wantLen: 1,
1314 },
1315 }
1316
1317 for _, tc := range testCases {
1318 t.Run(tc.name, func(t *testing.T) {
1319 // given
1320 container := NewDefaultContainer()
1321
1322 // when
1323 err := container.UsePreProcessor(tc.preProcessor)
1324
1325 // then
1326 if tc.wantErr != nil {
1327 require.Error(t, err)
1328 require.EqualError(t, err, tc.wantErr.Error())
1329 return
1330 }
1331
1332 assert.NoError(t, err)
1333
1334 assert.Len(t, container.preProcessors, tc.wantLen)
1335 })
1336 }
1337}
1338
1339func TestDefaultContainer_UsePostProcessor(t *testing.T) {
1340 testCases := []struct {

Callers

nothing calls this directly

Calls 4

UsePreProcessorMethod · 0.95
NewDefaultContainerFunction · 0.85
LenMethod · 0.80
RunMethod · 0.65

Tested by

no test coverage detected