Skip to content

Commit

Permalink
Add unit test for dashboard.Slug()
Browse files Browse the repository at this point in the history
  • Loading branch information
K-Phoen committed Feb 19, 2023
1 parent 5013996 commit dd251ec
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion dashboard/dashboard_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import (
"encoding/json"
"testing"

"github.com/K-Phoen/grabana/variable/datasource"
"github.com/stretchr/testify/require"

"github.com/K-Phoen/grabana/variable/datasource"
)

func requireJSON(t *testing.T, payload []byte) {
Expand Down Expand Up @@ -82,6 +83,15 @@ func TestDashboardUIDCanBeSet(t *testing.T) {
req.Equal("foo", panel.board.UID)
}

func TestDashboardSlugCanBeSet(t *testing.T) {
req := require.New(t)

panel, err := New("", Slug("super-slug"))

req.NoError(err)
req.Equal("super-slug", panel.board.Slug)
}

func TestDashboardUIDWillBeHashedWhenTooLongForGrafana(t *testing.T) {
req := require.New(t)

Expand Down

0 comments on commit dd251ec

Please sign in to comment.