21 lines
589 B
Go
21 lines
589 B
Go
package queries_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
m "fiskerinc.com/modules/common"
|
|
"fiskerinc.com/modules/db/queries"
|
|
)
|
|
|
|
func TestCreateSelectQuery(t *testing.T) {
|
|
ratePlanDB := queries.RatePlanTmobile{}
|
|
ratePlanModel := []m.RatePlanTMobile{}
|
|
|
|
q := ratePlanDB.CreateSelectQuery("US", &ratePlanModel)
|
|
q_str := queryToString(q)
|
|
expected := `SELECT "r"."country", "r"."product_id", "r"."plan_name", "r"."created_at", "r"."updated_at" FROM "rate_plan_tmobile" AS "r" WHERE (country = 'US')`
|
|
if q_str != expected {
|
|
t.Errorf("Expected the query string %s, but got %s.", expected, q_str)
|
|
}
|
|
}
|