(t *testing.T)
| 518 | } |
| 519 | |
| 520 | func TestCmdAdd_ParseError(t *testing.T) { |
| 521 | cb := &mockCallbacks{} |
| 522 | cb.parseAndValidateFn = func(_ Function, _ string) (testConfig, error) { |
| 523 | return testConfig{}, errors.New("bad config") |
| 524 | } |
| 525 | h := newTestHandler(cb) |
| 526 | |
| 527 | fn := newTestFn("test:job1", "add", "job1", []byte(`{}`)) |
| 528 | h.CmdAdd(fn) |
| 529 | |
| 530 | assert.Equal(t, 0, h.exposed.Count()) |
| 531 | } |
| 532 | |
| 533 | func TestCmdAdd_ReplacesExisting(t *testing.T) { |
| 534 | cb := &mockCallbacks{} |