File tree 2 files changed +14
-1
lines changed
2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ func NewDashboard(title string) *Dashboard {
49
49
// GetTags turns the tags in data json into go string array
50
50
func (dash * Dashboard ) GetTags () []string {
51
51
jsonTags := dash .Data ["tags" ]
52
- if jsonTags == nil {
52
+ if jsonTags == nil || jsonTags == "" {
53
53
return []string {}
54
54
}
55
55
Original file line number Diff line number Diff line change @@ -15,4 +15,17 @@ func TestDashboardModel(t *testing.T) {
15
15
So (dashboard .Slug , ShouldEqual , "grafana-play-home" )
16
16
})
17
17
18
+ Convey ("Given a dashboard json" , t , func () {
19
+ json := map [string ]interface {}{
20
+ "title" : "test dash" ,
21
+ }
22
+
23
+ Convey ("With tags as string value" , func () {
24
+ json ["tags" ] = ""
25
+ dash := NewDashboardFromJson (json )
26
+
27
+ So (len (dash .GetTags ()), ShouldEqual , 0 )
28
+ })
29
+ })
30
+
18
31
}
You can’t perform that action at this time.
0 commit comments