You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
77 lines
1.5 KiB
77 lines
1.5 KiB
2 months ago
|
package mq
|
||
|
|
||
|
import (
|
||
|
"github.com/streadway/amqp"
|
||
|
"matchmaking-system/internal/conf"
|
||
|
"matchmaking-system/internal/data/mq/consumer"
|
||
|
"matchmaking-system/internal/data/mq/producers"
|
||
|
"reflect"
|
||
|
"testing"
|
||
|
)
|
||
|
|
||
|
func TestNewMqConsumer(t *testing.T) {
|
||
|
type args struct {
|
||
|
c *conf.Data
|
||
|
}
|
||
|
tests := []struct {
|
||
|
name string
|
||
|
args args
|
||
|
want *consumer.Consumer
|
||
|
}{
|
||
|
// TODO: Add test cases.
|
||
|
}
|
||
|
for _, tt := range tests {
|
||
|
t.Run(tt.name, func(t *testing.T) {
|
||
|
if got := NewMqConsumer(tt.args.c); !reflect.DeepEqual(got, tt.want) {
|
||
|
t.Errorf("NewMqConsumer() = %v, want %v", got, tt.want)
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func TestNewMqProducer(t *testing.T) {
|
||
|
type args struct {
|
||
|
c *conf.Data
|
||
|
}
|
||
|
tests := []struct {
|
||
|
name string
|
||
|
args args
|
||
|
want *producers.Producer
|
||
|
}{
|
||
|
// TODO: Add test cases.
|
||
|
}
|
||
|
for _, tt := range tests {
|
||
|
t.Run(tt.name, func(t *testing.T) {
|
||
|
if got := NewMqProducer(tt.args.c); !reflect.DeepEqual(got, tt.want) {
|
||
|
t.Errorf("NewMqProducer() = %v, want %v", got, tt.want)
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
}
|
||
|
|
||
|
func Test_initMq(t *testing.T) {
|
||
|
type args struct {
|
||
|
address string
|
||
|
}
|
||
|
tests := []struct {
|
||
|
name string
|
||
|
args args
|
||
|
want *amqp.Connection
|
||
|
wantErr bool
|
||
|
}{
|
||
|
// TODO: Add test cases.
|
||
|
}
|
||
|
for _, tt := range tests {
|
||
|
t.Run(tt.name, func(t *testing.T) {
|
||
|
got, err := initMq(tt.args.address)
|
||
|
if (err != nil) != tt.wantErr {
|
||
|
t.Errorf("initMq() error = %v, wantErr %v", err, tt.wantErr)
|
||
|
return
|
||
|
}
|
||
|
if !reflect.DeepEqual(got, tt.want) {
|
||
|
t.Errorf("initMq() got = %v, want %v", got, tt.want)
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
}
|