Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion internal/api/client.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 13 additions & 9 deletions internal/cmd/personas_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,11 @@ import (
"github.com/nottelabs/notte-cli/internal/testutil"
)

const personaIDTest = "persona_123"
const (
personaIDTest = "persona_123"
personaEmailTest = "test.user@example.com"
personaInternalEmailTest = "persona_123@example.com"
)

func setupPersonaTest(t *testing.T) *testutil.MockServer {
t.Helper()
Expand All @@ -30,11 +34,11 @@ func setupPersonaTest(t *testing.T) *testutil.MockServer {
}

func personaJSON(id string) string {
return `{"persona_id":"` + id + `","email":"test@example.com","first_name":"Test","last_name":"User","status":"active"}`
return `{"persona_id":"` + id + `","email":"` + personaEmailTest + `","internal_email":"` + id + `@example.com","first_name":"Test","last_name":"User","status":"active"}`
}

func personaResponseJSON() string {
return `{"persona_id":"` + personaIDTest + `","email":"test@example.com","first_name":"Test","last_name":"User","status":"active"}`
return `{"persona_id":"` + personaIDTest + `","email":"` + personaEmailTest + `","internal_email":"` + personaInternalEmailTest + `","first_name":"Test","last_name":"User","status":"active"}`
}

func TestRunPersonasList_Success(t *testing.T) {
Expand All @@ -61,8 +65,8 @@ func TestRunPersonasList_Success(t *testing.T) {
}
})

if stdout == "" {
t.Error("expected output, got empty string")
if !strings.Contains(stdout, personaEmailTest) || !strings.Contains(stdout, "persona_1@example.com") {
t.Errorf("expected both persona email addresses, got %q", stdout)
}
}

Expand Down Expand Up @@ -132,8 +136,8 @@ func TestRunPersonasCreate(t *testing.T) {
}
})

if stdout == "" {
t.Error("expected output, got empty string")
if !strings.Contains(stdout, personaEmailTest) || !strings.Contains(stdout, "persona_2@example.com") {
t.Errorf("expected both persona email addresses, got %q", stdout)
}
}

Expand All @@ -155,8 +159,8 @@ func TestRunPersonaShow(t *testing.T) {
}
})

if stdout == "" {
t.Error("expected output, got empty string")
if !strings.Contains(stdout, personaEmailTest) || !strings.Contains(stdout, personaInternalEmailTest) {
t.Errorf("expected both persona email addresses, got %q", stdout)
}
}

Expand Down
Loading