chore: add qe and integrations with rabbit mq

This commit is contained in:
d3m0k1d
2026-04-29 14:26:59 +03:00
parent fe740da06b
commit d3a2fe0f9c
18 changed files with 1823 additions and 47 deletions
@@ -0,0 +1,64 @@
package handlers
import (
"context"
"testing"
"gitea.d3m0k1d.ru/d3m0k1d/rostpoliplast/backend/internal/storage"
)
type mockRepo struct {
storage.Repository
baleTypes []storage.BaleType
bales []storage.Bale
}
func (r *mockRepo) GetBaleTypes(ctx context.Context) ([]storage.BaleType, error) {
return r.baleTypes, nil
}
func (r *mockRepo) GetBales(ctx context.Context) ([]storage.Bale, error) {
return r.bales, nil
}
func TestBaleTypeHandlers_HasRoutes(t *testing.T) {
h := &BaleTypeHandlers{}
if h == nil {
t.Error("BaleTypeHandler is nil")
}
}
func TestBaleHandlers_HasRoutes(t *testing.T) {
h := &BaleHandlers{}
if h == nil {
t.Error("BaleHandler is nil")
}
}
func TestTypesFieldMappings(t *testing.T) {
bt := storage.BaleType{
ID: 1,
Type: "test",
Weight: 10.0,
}
if bt.Type != "test" {
t.Errorf("expected type 'test', got %s", bt.Type)
}
if bt.Weight != 10.0 {
t.Errorf("expected weight 10.0, got %f", bt.Weight)
}
}
func TestBaleFieldMappings(t *testing.T) {
b := storage.Bale{
ID: 1,
TypeID: 1,
Type: "standard",
}
if b.TypeID != 1 {
t.Errorf("expected typeId 1, got %d", b.TypeID)
}
if b.Type != "standard" {
t.Errorf("expected type 'standard', got %s", b.Type)
}
}