File tree Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Expand file tree Collapse file tree 1 file changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -22,14 +22,11 @@ import (
22
22
23
23
"github.com/arduino/arduino-cloud-cli/internal/template/mocks"
24
24
iotclient "github.com/arduino/iot-client-go"
25
+ "github.com/gofrs/uuid"
25
26
"github.com/google/go-cmp/cmp"
26
27
"github.com/stretchr/testify/mock"
27
28
)
28
29
29
- const (
30
- uuidv4Length = 36
31
- )
32
-
33
30
var (
34
31
dashboardTemplateTest = map [string ]interface {}{
35
32
"id" : "home-security-alarm-dashboard" ,
@@ -144,7 +141,6 @@ func TestLoadTemplate(t *testing.T) {
144
141
}
145
142
146
143
func TestLoadDashboard (t * testing.T ) {
147
-
148
144
mockClient := & mocks.Client {}
149
145
mockThingShow := func (thingID string ) * iotclient.ArduinoThing {
150
146
thing := & iotclient.ArduinoThing {
@@ -220,9 +216,11 @@ func TestLoadDashboard(t *testing.T) {
220
216
for i := range got .Widgets {
221
217
// check widget id generation
222
218
id := got .Widgets [i ].Id
223
- if len (id ) != uuidv4Length {
224
- t .Errorf ("Widget ID is wrong: = %s" , id )
219
+ _ , err := uuid .FromString (id )
220
+ if err != nil {
221
+ t .Errorf ("Widget ID is not a valid UUID: %s" , id )
225
222
}
223
+ // Remove generated id to be able to compare the widget with the expected one
226
224
got .Widgets [i ].Id = ""
227
225
}
228
226
You can’t perform that action at this time.
0 commit comments