fix: scope project skills by tenant
CI / build-and-test (push) Failing after 20s
CI / build-and-test (pull_request) Failing after 14s

This commit is contained in:
SG Command
2026-08-18 00:16:35 +02:00
parent d7c0205c50
commit 912b87404f
3 changed files with 75 additions and 7 deletions
+32
View File
@@ -0,0 +1,32 @@
package store
import (
"context"
"testing"
"git.warky.dev/wdevs/amcs/internal/tenancy"
)
func TestProjectSkillTenantWhere(t *testing.T) {
args := []any{int64(1), int64(2), true}
where := projectSkillTenantWhere(tenancy.WithTenantKey(context.Background(), "tenant-a"), &args, "p", "s")
if where != " and p.tenant_id = $4 and s.tenant_id = $4" {
t.Fatalf("where = %q", where)
}
if len(args) != 4 || args[3] != "tenant-a" {
t.Fatalf("args = %#v", args)
}
}
func TestProjectSkillTenantWhereWithoutTenant(t *testing.T) {
args := []any{int64(1), int64(2)}
where := projectSkillTenantWhere(context.Background(), &args, "p", "s")
if where != "" {
t.Fatalf("where = %q, want empty", where)
}
if len(args) != 2 {
t.Fatalf("args = %#v", args)
}
}