test(09-02): add failing tests for admin create and reset commands
- admin:create and admin:reset-password are not registered yet - Generated app main does not append cabana runtime commands
This commit is contained in:
@@ -109,6 +109,22 @@ func TestGenerateStableQuotedImportsInManifestOrder(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestGenerateMainRegistersCabanaRuntimeCommands(t *testing.T) {
|
||||
mainSrc, err := generateMain(Manifest{Module: "example.com/app", Binary: "hello"})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if bytes.Count(mainSrc, []byte("cabana.RuntimeCommands")) != 1 {
|
||||
t.Fatalf("cabana.RuntimeCommands count = %d\n%s", bytes.Count(mainSrc, []byte("cabana.RuntimeCommands")), mainSrc)
|
||||
}
|
||||
if !bytes.Contains(mainSrc, []byte("commands = append(commands, cabana.RuntimeCommands(app)...)")) {
|
||||
t.Fatalf("generated main does not append cabana runtime commands once:\n%s", mainSrc)
|
||||
}
|
||||
if bytes.Contains(mainSrc, []byte("examples/hello")) {
|
||||
t.Fatal("generated main hard-codes examples/hello")
|
||||
}
|
||||
}
|
||||
|
||||
func TestWriteIfChangedSkipsIdenticalBytes(t *testing.T) {
|
||||
dir := t.TempDir()
|
||||
path := filepath.Join(dir, "out.go")
|
||||
|
||||
Reference in New Issue
Block a user