feat(01-02): add optional plugin services and HasPlugin
- App-scoped typed Publish/Lookup with duplicate-provider errors - Set plugin IDs before Register so HasPlugin sees the full set - Greeter uses pact.OptionalMessage without importing optional
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"io"
|
||||
"os"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
@@ -61,6 +62,16 @@ func TestBootUsesPublishedOptionalService(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestGreeterSourceDoesNotImportOptional(t *testing.T) {
|
||||
body, err := os.ReadFile("plugin.go")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if strings.Contains(string(body), "plugins/optional") {
|
||||
t.Fatal("greeter must not import the optional plugin module")
|
||||
}
|
||||
}
|
||||
|
||||
func runHelloCmd(t *testing.T, p *Plugin) string {
|
||||
t.Helper()
|
||||
cmds := p.Commands()
|
||||
|
||||
Reference in New Issue
Block a user