(t *testing.T)
| 17 | ) |
| 18 | |
| 19 | func TestConfigModification(t *testing.T) { |
| 20 | cfg := NewConfig(func() any { return &testCtx{} }, EndpointTypeGetter("ep1", func() any { return &testEP1{} })) |
| 21 | assert.Equal(t, &testCtx{}, cfg.contextType()) |
| 22 | assert.Equal(t, &testEP1{}, cfg.endpointTypes["ep1"]()) |
| 23 | cfgCopy := cfg |
| 24 | |
| 25 | // modify existing endpoint |
| 26 | cfg.SetEndpoint("ep1", func() any { return &testEP2{} }) |
| 27 | // add endpoint |
| 28 | cfg.SetEndpoint("ep2", func() any { return &testEP3{} }) |
| 29 | assert.Equal(t, &testCtx{}, cfg.contextType()) |
| 30 | assert.Equal(t, &testEP2{}, cfg.endpointTypes["ep1"]()) |
| 31 | assert.Equal(t, &testEP3{}, cfg.endpointTypes["ep2"]()) |
| 32 | // check it applied on already initialized store |
| 33 | assert.Equal(t, &testCtx{}, cfgCopy.contextType()) |
| 34 | assert.Equal(t, &testEP2{}, cfgCopy.endpointTypes["ep1"]()) |
| 35 | assert.Equal(t, &testEP3{}, cfgCopy.endpointTypes["ep2"]()) |
| 36 | } |
| 37 | |
| 38 | func TestValidFilePaths(t *testing.T) { |
| 39 | paths := map[string]bool{ |
nothing calls this directly
no test coverage detected
searching dependent graphs…