mirror of
https://github.com/warmbly/warmbly.git
synced 2026-11-28 08:05:45 +00:00
18 lines
600 B
Go
18 lines
600 B
Go
package repository
|
|
|
|
import "testing"
|
|
|
|
func TestBindOrgParamRenumbersOnlyTheOrganizationPlaceholder(t *testing.T) {
|
|
cases := map[string]string{
|
|
`organization_id = $1`: `organization_id = $2`,
|
|
`email_id IN (SELECT id FROM email_accounts WHERE organization_id = $1)`: `email_id IN (SELECT id FROM email_accounts WHERE organization_id = $2)`,
|
|
`org_id = $1 AND x = $10`: `org_id = $2 AND x = $10`,
|
|
`a = $1 OR b = $1`: `a = $2 OR b = $2`,
|
|
}
|
|
for in, want := range cases {
|
|
if got := bindOrgParam(in, 2); got != want {
|
|
t.Errorf("bindOrgParam(%q) = %q, want %q", in, got, want)
|
|
}
|
|
}
|
|
}
|