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
1 change: 1 addition & 0 deletions pkg/cmd/workspace_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ func (w *workspaceListCmd) run(cmd *cobra.Command, args []string) error {

for _, instance := range instancesList {
cmd.Printf("ID: %s\n", instance.GetID())
cmd.Printf(" Name: %s\n", instance.GetName())
cmd.Printf(" Sources: %s\n", instance.GetSourceDir())
cmd.Printf(" Configuration: %s\n", instance.GetConfigDir())
cmd.Println()
Expand Down
71 changes: 57 additions & 14 deletions pkg/cmd/workspace_list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,21 @@ func TestWorkspaceListCmd_E2E(t *testing.T) {
}

result := output.String()
if !strings.Contains(result, addedInstance.GetID()) {
t.Errorf("Expected output to contain ID %s, got: %s", addedInstance.GetID(), result)
expectedID := "ID: " + addedInstance.GetID()
if !strings.Contains(result, expectedID) {
t.Errorf("Expected output to contain %q, got: %s", expectedID, result)
}
if !strings.Contains(result, sourcesDir) {
t.Errorf("Expected output to contain sources dir %s, got: %s", sourcesDir, result)
expectedName := " Name: " + addedInstance.GetName()
if !strings.Contains(result, expectedName) {
t.Errorf("Expected output to contain %q, got: %s", expectedName, result)
}
expectedSources := " Sources: " + sourcesDir
if !strings.Contains(result, expectedSources) {
t.Errorf("Expected output to contain %q, got: %s", expectedSources, result)
}
expectedConfig := " Configuration: " + filepath.Join(sourcesDir, ".kortex")
if !strings.Contains(result, expectedConfig) {
t.Errorf("Expected output to contain %q, got: %s", expectedConfig, result)
}
})

Expand Down Expand Up @@ -255,17 +265,37 @@ func TestWorkspaceListCmd_E2E(t *testing.T) {
}

result := output.String()
if !strings.Contains(result, addedInstance1.GetID()) {
t.Errorf("Expected output to contain ID %s, got: %s", addedInstance1.GetID(), result)
expectedID1 := "ID: " + addedInstance1.GetID()
if !strings.Contains(result, expectedID1) {
t.Errorf("Expected output to contain %q, got: %s", expectedID1, result)
}
expectedName1 := " Name: " + addedInstance1.GetName()
if !strings.Contains(result, expectedName1) {
t.Errorf("Expected output to contain %q, got: %s", expectedName1, result)
}
expectedSources1 := " Sources: " + sourcesDir1
if !strings.Contains(result, expectedSources1) {
t.Errorf("Expected output to contain %q, got: %s", expectedSources1, result)
}
expectedConfig1 := " Configuration: " + filepath.Join(sourcesDir1, ".kortex")
if !strings.Contains(result, expectedConfig1) {
t.Errorf("Expected output to contain %q, got: %s", expectedConfig1, result)
}
if !strings.Contains(result, addedInstance2.GetID()) {
t.Errorf("Expected output to contain ID %s, got: %s", addedInstance2.GetID(), result)
expectedID2 := "ID: " + addedInstance2.GetID()
if !strings.Contains(result, expectedID2) {
t.Errorf("Expected output to contain %q, got: %s", expectedID2, result)
}
if !strings.Contains(result, sourcesDir1) {
t.Errorf("Expected output to contain sources dir %s, got: %s", sourcesDir1, result)
expectedName2 := " Name: " + addedInstance2.GetName()
if !strings.Contains(result, expectedName2) {
t.Errorf("Expected output to contain %q, got: %s", expectedName2, result)
}
if !strings.Contains(result, sourcesDir2) {
t.Errorf("Expected output to contain sources dir %s, got: %s", sourcesDir2, result)
expectedSources2 := " Sources: " + sourcesDir2
if !strings.Contains(result, expectedSources2) {
t.Errorf("Expected output to contain %q, got: %s", expectedSources2, result)
}
expectedConfig2 := " Configuration: " + filepath.Join(sourcesDir2, ".kortex")
if !strings.Contains(result, expectedConfig2) {
t.Errorf("Expected output to contain %q, got: %s", expectedConfig2, result)
}
})

Expand Down Expand Up @@ -307,8 +337,21 @@ func TestWorkspaceListCmd_E2E(t *testing.T) {
}

result := output.String()
if !strings.Contains(result, addedInstance.GetID()) {
t.Errorf("Expected output to contain ID %s, got: %s", addedInstance.GetID(), result)
expectedID := "ID: " + addedInstance.GetID()
if !strings.Contains(result, expectedID) {
t.Errorf("Expected output to contain %q, got: %s", expectedID, result)
}
expectedName := " Name: " + addedInstance.GetName()
if !strings.Contains(result, expectedName) {
t.Errorf("Expected output to contain %q, got: %s", expectedName, result)
}
expectedSources := " Sources: " + sourcesDir
if !strings.Contains(result, expectedSources) {
t.Errorf("Expected output to contain %q, got: %s", expectedSources, result)
}
expectedConfig := " Configuration: " + filepath.Join(sourcesDir, ".kortex")
if !strings.Contains(result, expectedConfig) {
t.Errorf("Expected output to contain %q, got: %s", expectedConfig, result)
}
})

Expand Down