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) } }