test(14.3-04): cover every summer new branch, key and CLI path
- name rule, existing targets, framework resolution order, inside-checkout refusal - cleanup on failure, key validation, .env 0600, AGENTS.md symlink - first commit identity, configured identity, missing git, --no-git, --no-plugin build - plugin:add relative go.work, plain make:plugin routes, GenerateAppKey, summer new via the CLI
This commit is contained in:
@@ -272,8 +272,15 @@ func TestMakeAndAddPluginOnHelloCopy(t *testing.T) {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !bytes.Contains(work, []byte("plugins/demo")) {
|
||||
t.Fatalf("go.work missing plugins/demo:\n%s", work)
|
||||
if !bytes.Contains(work, []byte("./plugins/demo")) {
|
||||
t.Fatalf("go.work missing ./plugins/demo:\n%s", work)
|
||||
}
|
||||
// plugin:add writes go.work use paths relative to the go.work directory,
|
||||
// so a committed go.work carries no machine-specific path.
|
||||
for _, line := range strings.Split(string(work), "\n") {
|
||||
if strings.HasPrefix(strings.TrimSpace(line), "/") {
|
||||
t.Fatalf("go.work has an absolute use path %q:\n%s", line, work)
|
||||
}
|
||||
}
|
||||
appMod, err := os.ReadFile(filepath.Join(dir, "go.mod"))
|
||||
if err != nil {
|
||||
@@ -324,6 +331,28 @@ func TestMakeAndAddPluginOnHelloCopy(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
// TestMakePluginRoutesUnchanged: plain make:plugin still renders the
|
||||
// no-route stub; only summer new opts into the starter route.
|
||||
func TestMakePluginRoutesUnchanged(t *testing.T) {
|
||||
dir := copyHelloApp(t)
|
||||
pluginDir, err := MakePlugin(t.Context(), dir, "golem15.demo")
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
routes, err := os.ReadFile(filepath.Join(pluginDir, "routes.go"))
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !bytes.Contains(routes, []byte("func (p *Plugin) Routes(pact.Router) error { return nil }")) {
|
||||
t.Fatalf("routes.go is not the no-route stub:\n%s", routes)
|
||||
}
|
||||
for _, unwanted := range []string{`"net/http"`, `"encoding/json"`, "r.Get("} {
|
||||
if bytes.Contains(routes, []byte(unwanted)) {
|
||||
t.Fatalf("plain routes.go contains %s:\n%s", unwanted, routes)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestAddPluginRejectsConflictingID(t *testing.T) {
|
||||
dir := copyHelloApp(t)
|
||||
ctx := t.Context()
|
||||
|
||||
Reference in New Issue
Block a user