...
1 package devstate
2
3 import (
4 "testing"
5 )
6
7 func TestDevfileState_GetFlowChart(t *testing.T) {
8 tests := []struct {
9 name string
10 state func() DevfileState
11 want string
12 wantErr bool
13 }{
14 {
15 name: "with initial devfile",
16 state: func() DevfileState {
17 return NewDevfileState()
18 },
19 want: `graph TB
20 containers["containers"]
21 start["start"]
22 sync-all-containers["Sync All Sources"]
23 start -->|"dev"| containers
24 containers -->|"container running"| sync-all-containers
25 `,
26 },
27
28 }
29 for _, tt := range tests {
30 t.Run(tt.name, func(t *testing.T) {
31 o := tt.state()
32 got, err := o.GetFlowChart()
33 if (err != nil) != tt.wantErr {
34 t.Errorf("DevfileState.GetFlowChart() error = %v, wantErr %v", err, tt.wantErr)
35 return
36 }
37 if got != tt.want {
38 t.Errorf("DevfileState.GetFlowChart() = %v, want %v", got, tt.want)
39 }
40 })
41 }
42 }
43
View as plain text