boardinfo_test.go 804 B

1234567891011121314151617181920212223242526
  1. // boardinfo_test.go — BoardInfoFor (#477 P2): lectura del último board info
  2. // cacheado (push del agente o sondeo SSH).
  3. package adapters
  4. import "testing"
  5. func TestBoardInfoFor(t *testing.T) {
  6. l := &Live{boardCache: map[string]*BoardInfo{}}
  7. if bi := l.BoardInfoFor("desconocido"); bi != nil {
  8. t.Fatalf("router desconocido debe devolver nil, got %+v", bi)
  9. }
  10. b := &BoardInfo{Model: "Redmi AX6", BoardName: "redmi,ax6"}
  11. b.Release.Version = "25.12.5"
  12. b.Release.Target = "qualcommax/ipq807x"
  13. l.boardCache["rt4"] = b
  14. got := l.BoardInfoFor("rt4")
  15. if got == nil {
  16. t.Fatal("BoardInfoFor(rt4) = nil, esperaba el board cacheado")
  17. }
  18. if got.BoardName != "redmi,ax6" || got.Release.Target != "qualcommax/ipq807x" || got.Release.Version != "25.12.5" {
  19. t.Fatalf("board corrupto: %+v", got)
  20. }
  21. }