mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-04-26 21:05:30 +00:00
add tests to ensure module id returns correctly
This commit is contained in:
@@ -14,6 +14,7 @@ func TestHTTPClientFromRegistry(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
moduleInstance, err := registration.New(config.ModuleConfig{
|
moduleInstance, err := registration.New(config.ModuleConfig{
|
||||||
|
Id: "test",
|
||||||
Type: "http.client",
|
Type: "http.client",
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -21,6 +22,10 @@ func TestHTTPClientFromRegistry(t *testing.T) {
|
|||||||
t.Fatalf("failed to create http.client module: %s", err)
|
t.Fatalf("failed to create http.client module: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if moduleInstance.Id() != "test" {
|
||||||
|
t.Fatalf("http.client module has wrong id: %s", moduleInstance.Id())
|
||||||
|
}
|
||||||
|
|
||||||
if moduleInstance.Type() != "http.client" {
|
if moduleInstance.Type() != "http.client" {
|
||||||
t.Fatalf("http.client module has wrong type: %s", moduleInstance.Type())
|
t.Fatalf("http.client module has wrong type: %s", moduleInstance.Type())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ func TestHTTPServerFromRegistry(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
moduleInstance, err := registration.New(config.ModuleConfig{
|
moduleInstance, err := registration.New(config.ModuleConfig{
|
||||||
|
Id: "test",
|
||||||
Type: "http.server",
|
Type: "http.server",
|
||||||
Params: map[string]any{
|
Params: map[string]any{
|
||||||
"port": 3000.0,
|
"port": 3000.0,
|
||||||
@@ -24,6 +25,10 @@ func TestHTTPServerFromRegistry(t *testing.T) {
|
|||||||
t.Fatalf("failed to create http.server module: %s", err)
|
t.Fatalf("failed to create http.server module: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if moduleInstance.Id() != "test" {
|
||||||
|
t.Fatalf("http.server module has wrong id: %s", moduleInstance.Id())
|
||||||
|
}
|
||||||
|
|
||||||
if moduleInstance.Type() != "http.server" {
|
if moduleInstance.Type() != "http.server" {
|
||||||
t.Fatalf("http.server module has wrong type: %s", moduleInstance.Type())
|
t.Fatalf("http.server module has wrong type: %s", moduleInstance.Type())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ func TestMIDIInputFromRegistry(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
moduleInstance, err := registration.New(config.ModuleConfig{
|
moduleInstance, err := registration.New(config.ModuleConfig{
|
||||||
|
Id: "test",
|
||||||
Type: "midi.input",
|
Type: "midi.input",
|
||||||
Params: map[string]any{
|
Params: map[string]any{
|
||||||
"port": "test",
|
"port": "test",
|
||||||
@@ -24,6 +25,10 @@ func TestMIDIInputFromRegistry(t *testing.T) {
|
|||||||
t.Fatalf("failed to create midi.input module: %s", err)
|
t.Fatalf("failed to create midi.input module: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if moduleInstance.Id() != "test" {
|
||||||
|
t.Fatalf("midi.input module has wrong id: %s", moduleInstance.Id())
|
||||||
|
}
|
||||||
|
|
||||||
if moduleInstance.Type() != "midi.input" {
|
if moduleInstance.Type() != "midi.input" {
|
||||||
t.Fatalf("midi.input module has wrong type: %s", moduleInstance.Type())
|
t.Fatalf("midi.input module has wrong type: %s", moduleInstance.Type())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ func TestMIDIOutputFromRegistry(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
moduleInstance, err := registration.New(config.ModuleConfig{
|
moduleInstance, err := registration.New(config.ModuleConfig{
|
||||||
|
Id: "test",
|
||||||
Type: "midi.output",
|
Type: "midi.output",
|
||||||
Params: map[string]any{
|
Params: map[string]any{
|
||||||
"port": "test",
|
"port": "test",
|
||||||
@@ -24,6 +25,10 @@ func TestMIDIOutputFromRegistry(t *testing.T) {
|
|||||||
t.Fatalf("failed to create midi.output module: %s", err)
|
t.Fatalf("failed to create midi.output module: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if moduleInstance.Id() != "test" {
|
||||||
|
t.Fatalf("midi.output module has wrong id: %s", moduleInstance.Id())
|
||||||
|
}
|
||||||
|
|
||||||
if moduleInstance.Type() != "midi.output" {
|
if moduleInstance.Type() != "midi.output" {
|
||||||
t.Fatalf("midi.output module has wrong type: %s", moduleInstance.Type())
|
t.Fatalf("midi.output module has wrong type: %s", moduleInstance.Type())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ func TestMQTTClientFromRegistry(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
moduleInstance, err := registration.New(config.ModuleConfig{
|
moduleInstance, err := registration.New(config.ModuleConfig{
|
||||||
|
Id: "test",
|
||||||
Type: "mqtt.client",
|
Type: "mqtt.client",
|
||||||
Params: map[string]any{
|
Params: map[string]any{
|
||||||
"broker": "mqtt://localhost:1883",
|
"broker": "mqtt://localhost:1883",
|
||||||
@@ -26,6 +27,10 @@ func TestMQTTClientFromRegistry(t *testing.T) {
|
|||||||
t.Fatalf("failed to create mqtt.client module: %s", err)
|
t.Fatalf("failed to create mqtt.client module: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if moduleInstance.Id() != "test" {
|
||||||
|
t.Fatalf("mqtt.client module has wrong id: %s", moduleInstance.Id())
|
||||||
|
}
|
||||||
|
|
||||||
if moduleInstance.Type() != "mqtt.client" {
|
if moduleInstance.Type() != "mqtt.client" {
|
||||||
t.Fatalf("mqtt.client module has wrong type: %s", moduleInstance.Type())
|
t.Fatalf("mqtt.client module has wrong type: %s", moduleInstance.Type())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ func TestNATSClientFromRegistry(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
moduleInstance, err := registration.New(config.ModuleConfig{
|
moduleInstance, err := registration.New(config.ModuleConfig{
|
||||||
|
Id: "test",
|
||||||
Type: "nats.client",
|
Type: "nats.client",
|
||||||
Params: map[string]any{
|
Params: map[string]any{
|
||||||
"url": "nats://127.0.0.1:4222",
|
"url": "nats://127.0.0.1:4222",
|
||||||
@@ -25,6 +26,10 @@ func TestNATSClientFromRegistry(t *testing.T) {
|
|||||||
t.Fatalf("failed to create nats.client module: %s", err)
|
t.Fatalf("failed to create nats.client module: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if moduleInstance.Id() != "test" {
|
||||||
|
t.Fatalf("nats.client module has wrong id: %s", moduleInstance.Id())
|
||||||
|
}
|
||||||
|
|
||||||
if moduleInstance.Type() != "nats.client" {
|
if moduleInstance.Type() != "nats.client" {
|
||||||
t.Fatalf("nats.client module has wrong type: %s", moduleInstance.Type())
|
t.Fatalf("nats.client module has wrong type: %s", moduleInstance.Type())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ func TestPSNClientFromRegistry(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
moduleInstance, err := registration.New(config.ModuleConfig{
|
moduleInstance, err := registration.New(config.ModuleConfig{
|
||||||
|
Id: "test",
|
||||||
Type: "psn.client",
|
Type: "psn.client",
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -21,6 +22,10 @@ func TestPSNClientFromRegistry(t *testing.T) {
|
|||||||
t.Fatalf("failed to create psn.client module: %s", err)
|
t.Fatalf("failed to create psn.client module: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if moduleInstance.Id() != "test" {
|
||||||
|
t.Fatalf("psn.client module has wrong id: %s", moduleInstance.Id())
|
||||||
|
}
|
||||||
|
|
||||||
if moduleInstance.Type() != "psn.client" {
|
if moduleInstance.Type() != "psn.client" {
|
||||||
t.Fatalf("psn.client module has wrong type: %s", moduleInstance.Type())
|
t.Fatalf("psn.client module has wrong type: %s", moduleInstance.Type())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ func TestSerialClientFromRegistry(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
moduleInstance, err := registration.New(config.ModuleConfig{
|
moduleInstance, err := registration.New(config.ModuleConfig{
|
||||||
|
Id: "test",
|
||||||
Type: "serial.client",
|
Type: "serial.client",
|
||||||
Params: map[string]any{
|
Params: map[string]any{
|
||||||
"port": "/dev/ttyUSB0",
|
"port": "/dev/ttyUSB0",
|
||||||
@@ -26,6 +27,10 @@ func TestSerialClientFromRegistry(t *testing.T) {
|
|||||||
t.Fatalf("failed to create serial.client module: %s", err)
|
t.Fatalf("failed to create serial.client module: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if moduleInstance.Id() != "test" {
|
||||||
|
t.Fatalf("serial.client module has wrong id: %s", moduleInstance.Id())
|
||||||
|
}
|
||||||
|
|
||||||
if moduleInstance.Type() != "serial.client" {
|
if moduleInstance.Type() != "serial.client" {
|
||||||
t.Fatalf("serial.client module has wrong type: %s", moduleInstance.Type())
|
t.Fatalf("serial.client module has wrong type: %s", moduleInstance.Type())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ func TestSIPCallServerFromRegistry(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
moduleInstance, err := registration.New(config.ModuleConfig{
|
moduleInstance, err := registration.New(config.ModuleConfig{
|
||||||
|
Id: "test",
|
||||||
Type: "sip.call.server",
|
Type: "sip.call.server",
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -21,6 +22,10 @@ func TestSIPCallServerFromRegistry(t *testing.T) {
|
|||||||
t.Fatalf("failed to create sip.call.server module: %s", err)
|
t.Fatalf("failed to create sip.call.server module: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if moduleInstance.Id() != "test" {
|
||||||
|
t.Fatalf("sip.call.server module has wrong id: %s", moduleInstance.Id())
|
||||||
|
}
|
||||||
|
|
||||||
if moduleInstance.Type() != "sip.call.server" {
|
if moduleInstance.Type() != "sip.call.server" {
|
||||||
t.Fatalf("sip.call.server module has wrong type: %s", moduleInstance.Type())
|
t.Fatalf("sip.call.server module has wrong type: %s", moduleInstance.Type())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ func TestSIPDTMFServerFromRegistry(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
moduleInstance, err := registration.New(config.ModuleConfig{
|
moduleInstance, err := registration.New(config.ModuleConfig{
|
||||||
|
Id: "test",
|
||||||
Type: "sip.dtmf.server",
|
Type: "sip.dtmf.server",
|
||||||
Params: map[string]any{
|
Params: map[string]any{
|
||||||
"separator": "#",
|
"separator": "#",
|
||||||
@@ -24,6 +25,10 @@ func TestSIPDTMFServerFromRegistry(t *testing.T) {
|
|||||||
t.Fatalf("failed to create sip.dtmf.server module: %s", err)
|
t.Fatalf("failed to create sip.dtmf.server module: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if moduleInstance.Id() != "test" {
|
||||||
|
t.Fatalf("sip.dtmf.server module has wrong id: %s", moduleInstance.Id())
|
||||||
|
}
|
||||||
|
|
||||||
if moduleInstance.Type() != "sip.dtmf.server" {
|
if moduleInstance.Type() != "sip.dtmf.server" {
|
||||||
t.Fatalf("sip.dtmf.server module has wrong type: %s", moduleInstance.Type())
|
t.Fatalf("sip.dtmf.server module has wrong type: %s", moduleInstance.Type())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ func TestTCPClientFromRegistry(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
moduleInstance, err := registration.New(config.ModuleConfig{
|
moduleInstance, err := registration.New(config.ModuleConfig{
|
||||||
|
Id: "test",
|
||||||
Type: "net.tcp.client",
|
Type: "net.tcp.client",
|
||||||
Params: map[string]any{
|
Params: map[string]any{
|
||||||
"host": "localhost",
|
"host": "localhost",
|
||||||
@@ -26,6 +27,10 @@ func TestTCPClientFromRegistry(t *testing.T) {
|
|||||||
t.Fatalf("failed to create net.tcp.client module: %s", err)
|
t.Fatalf("failed to create net.tcp.client module: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if moduleInstance.Id() != "test" {
|
||||||
|
t.Fatalf("net.tcp.client module has wrong id: %s", moduleInstance.Id())
|
||||||
|
}
|
||||||
|
|
||||||
if moduleInstance.Type() != "net.tcp.client" {
|
if moduleInstance.Type() != "net.tcp.client" {
|
||||||
t.Fatalf("net.tcp.client module has wrong type: %s", moduleInstance.Type())
|
t.Fatalf("net.tcp.client module has wrong type: %s", moduleInstance.Type())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ func TestTCPServerFromRegistry(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
moduleInstance, err := registration.New(config.ModuleConfig{
|
moduleInstance, err := registration.New(config.ModuleConfig{
|
||||||
|
Id: "test",
|
||||||
Type: "net.tcp.server",
|
Type: "net.tcp.server",
|
||||||
Params: map[string]any{
|
Params: map[string]any{
|
||||||
"port": 8000.0,
|
"port": 8000.0,
|
||||||
@@ -25,6 +26,10 @@ func TestTCPServerFromRegistry(t *testing.T) {
|
|||||||
t.Fatalf("failed to create net.tcp.server module: %s", err)
|
t.Fatalf("failed to create net.tcp.server module: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if moduleInstance.Id() != "test" {
|
||||||
|
t.Fatalf("net.tcp.server module has wrong id: %s", moduleInstance.Id())
|
||||||
|
}
|
||||||
|
|
||||||
if moduleInstance.Type() != "net.tcp.server" {
|
if moduleInstance.Type() != "net.tcp.server" {
|
||||||
t.Fatalf("net.tcp.server module has wrong type: %s", moduleInstance.Type())
|
t.Fatalf("net.tcp.server module has wrong type: %s", moduleInstance.Type())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ func TestUDPClientFromRegistry(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
moduleInstance, err := registration.New(config.ModuleConfig{
|
moduleInstance, err := registration.New(config.ModuleConfig{
|
||||||
|
Id: "test",
|
||||||
Type: "net.udp.client",
|
Type: "net.udp.client",
|
||||||
Params: map[string]any{
|
Params: map[string]any{
|
||||||
"host": "localhost",
|
"host": "localhost",
|
||||||
@@ -26,6 +27,10 @@ func TestUDPClientFromRegistry(t *testing.T) {
|
|||||||
t.Fatalf("failed to create net.udp.client module: %s", err)
|
t.Fatalf("failed to create net.udp.client module: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if moduleInstance.Id() != "test" {
|
||||||
|
t.Fatalf("net.udp.client module has wrong id: %s", moduleInstance.Id())
|
||||||
|
}
|
||||||
|
|
||||||
if moduleInstance.Type() != "net.udp.client" {
|
if moduleInstance.Type() != "net.udp.client" {
|
||||||
t.Fatalf("net.udp.client module has wrong type: %s", moduleInstance.Type())
|
t.Fatalf("net.udp.client module has wrong type: %s", moduleInstance.Type())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ func TestUDPMulticastFromRegistry(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
moduleInstance, err := registration.New(config.ModuleConfig{
|
moduleInstance, err := registration.New(config.ModuleConfig{
|
||||||
|
Id: "test",
|
||||||
Type: "net.udp.multicast",
|
Type: "net.udp.multicast",
|
||||||
Params: map[string]any{
|
Params: map[string]any{
|
||||||
"ip": "236.10.10.10",
|
"ip": "236.10.10.10",
|
||||||
@@ -22,10 +23,14 @@ func TestUDPMulticastFromRegistry(t *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to create udp.multicast module: %s", err)
|
t.Fatalf("failed to create net.udp.multicast module: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if moduleInstance.Id() != "test" {
|
||||||
|
t.Fatalf("net.udp.multicast module has wrong id: %s", moduleInstance.Id())
|
||||||
}
|
}
|
||||||
|
|
||||||
if moduleInstance.Type() != "net.udp.multicast" {
|
if moduleInstance.Type() != "net.udp.multicast" {
|
||||||
t.Fatalf("udp.multicast module has wrong type: %s", moduleInstance.Type())
|
t.Fatalf("net.udp.multicast module has wrong type: %s", moduleInstance.Type())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ func TestUDPServerFromRegistry(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
moduleInstance, err := registration.New(config.ModuleConfig{
|
moduleInstance, err := registration.New(config.ModuleConfig{
|
||||||
|
Id: "test",
|
||||||
Type: "net.udp.server",
|
Type: "net.udp.server",
|
||||||
Params: map[string]any{
|
Params: map[string]any{
|
||||||
"port": 8000.0,
|
"port": 8000.0,
|
||||||
@@ -24,6 +25,10 @@ func TestUDPServerFromRegistry(t *testing.T) {
|
|||||||
t.Fatalf("failed to create udp.server module: %s", err)
|
t.Fatalf("failed to create udp.server module: %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if moduleInstance.Id() != "test" {
|
||||||
|
t.Fatalf("udp.server module has wrong id: %s", moduleInstance.Id())
|
||||||
|
}
|
||||||
|
|
||||||
if moduleInstance.Type() != "net.udp.server" {
|
if moduleInstance.Type() != "net.udp.server" {
|
||||||
t.Fatalf("net.udp.server module has wrong type: %s", moduleInstance.Type())
|
t.Fatalf("net.udp.server module has wrong type: %s", moduleInstance.Type())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user