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

Function TestDefaultContainer_UsePostProcessor

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

Source from the content-addressed store, hash-verified

1337}
1338
1339func TestDefaultContainer_UsePostProcessor(t *testing.T) {
1340 testCases := []struct {
1341 name string
1342 postProcessor PostProcessor
1343
1344 wantErr error
1345 wantLen int
1346 }{
1347 {
1348 name: "nil pre processor",
1349 wantErr: errors.New("nil processor"),
1350 wantLen: 0,
1351 },
1352 {
1353 name: "valid pre processor",
1354 postProcessor: &AnyPostProcessor{},
1355 wantErr: nil,
1356 wantLen: 1,
1357 },
1358 }
1359
1360 for _, tc := range testCases {
1361 t.Run(tc.name, func(t *testing.T) {
1362 // given
1363 container := NewDefaultContainer()
1364
1365 // when
1366 err := container.UsePostProcessor(tc.postProcessor)
1367
1368 // then
1369 if tc.wantErr != nil {
1370 require.Error(t, err)
1371 require.EqualError(t, err, tc.wantErr.Error())
1372 return
1373 }
1374
1375 assert.NoError(t, err)
1376
1377 assert.Len(t, container.postProcessors, tc.wantLen)
1378 })
1379 }
1380}
1381
1382func TestDefaultContainer_Initialize(t *testing.T) {
1383

Callers

nothing calls this directly

Calls 4

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

Tested by

no test coverage detected