(t *testing.T)
| 29 | ) |
| 30 | |
| 31 | func TestHandleRequest(t *testing.T) { |
| 32 | f, p, cleanup, err := setup(testConfig("ProcessorRun")) |
| 33 | if err != nil { |
| 34 | t.Fatal(err) |
| 35 | } |
| 36 | defer cleanup() |
| 37 | |
| 38 | ctx := context.Background() |
| 39 | req := &OrderRequest{ID: "x"} |
| 40 | bytes, err := json.Marshal(req) |
| 41 | if err != nil { |
| 42 | t.Fatal(err) |
| 43 | } |
| 44 | if err := f.requestTopic.Send(ctx, &pubsub.Message{Body: bytes}); err != nil { |
| 45 | t.Fatal(err) |
| 46 | } |
| 47 | if err := p.handleRequest(ctx); err != nil { |
| 48 | t.Fatal(err) |
| 49 | } |
| 50 | // Just verify that there is an order "x" in the collection. |
| 51 | order := &Order{ID: "x"} |
| 52 | if err := p.coll.Get(ctx, order); err != nil { |
| 53 | t.Fatal(err) |
| 54 | } |
| 55 | } |
| 56 | |
| 57 | func TestProcessOrder(t *testing.T) { |
| 58 | _, p, cleanup, err := setup(testConfig("ProcessOrder")) |
nothing calls this directly
no test coverage detected