github.com/simpleiot/simpleiot@v0.18.3/client/shelly_test.go (about)

     1  package client
     2  
     3  import (
     4  	"testing"
     5  )
     6  
     7  func TestShellyScanHost(t *testing.T) {
     8  	testData := [][]string{
     9  		{"ShellyPlugUS-C049EF8889A0.local.", "PlugUS", "C049EF8889A0"},
    10  		{"ShellyBulbDuo-6646EB.local.", "BulbDuo", "6646EB"},
    11  		{"shellyrgbw2-D93C00.local.", "rgbw2", "D93C00"},
    12  		{"shelly1pm-B91754.local.", "1pm", "B91754"},
    13  	}
    14  
    15  	for _, e := range testData {
    16  		typ, id := shellyScanHost(e[0])
    17  		if typ != e[1] {
    18  			t.Errorf("Exp: %v, got: %v", e[1], id)
    19  		}
    20  	}
    21  }