@@ -59,9 +59,9 @@ func TestBrickCreate(t *testing.T) {
5959 require .Equal (t , "variable \" ARDUINO_DEVICE_ID\" cannot be empty" , err .Error ())
6060 })
6161
62- t .Run ("log a warning if a mandatory variable is not present in the request" , func (t * testing.T ) {
63- tempApp , _ := copyToTempApp (t , paths .New ("testdata/AppFromExample" ))
64- // defer cleanUp()
62+ t .Run ("omit a mandatory variable is not present in the request" , func (t * testing.T ) {
63+ tempApp , cleanUp := copyToTempApp (t , paths .New ("testdata/AppFromExample" ))
64+ defer cleanUp ()
6565
6666 req := BrickCreateUpdateRequest {ID : "arduino:arduino_cloud" , Variables : map [string ]string {
6767 "ARDUINO_SECRET" : "a-secret-a" ,
@@ -73,7 +73,10 @@ func TestBrickCreate(t *testing.T) {
7373 require .Nil (t , err )
7474 require .Len (t , after .Descriptor .Bricks , 1 )
7575 require .Equal (t , "arduino:arduino_cloud" , after .Descriptor .Bricks [0 ].ID )
76- require .Equal (t , "" , after .Descriptor .Bricks [0 ].Variables ["ARDUINO_DEVICE_ID" ]) // <-- the DEVICE_ID is empty
76+ // NOTE: currently it is not possible to distinguish a field with empty string or missing field into the yaml.
77+ // The 'ARDUINO_DEVICE_ID' is missing from the app.yaml but here we check the empty string.
78+ // A better aproach is to use golden files
79+ require .Equal (t , "" , after .Descriptor .Bricks [0 ].Variables ["ARDUINO_DEVICE_ID" ])
7780 require .Equal (t , "a-secret-a" , after .Descriptor .Bricks [0 ].Variables ["ARDUINO_SECRET" ])
7881 })
7982
0 commit comments