Update test.
This commit is contained in:
parent
14bd3b6c3b
commit
73d7e4823c
1 changed files with 36 additions and 8 deletions
|
|
@ -388,7 +388,7 @@ LIMIT 15;
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://github.com/go-jet/jet/issues/226
|
// https://github.com/go-jet/jet/issues/226
|
||||||
func TestGroupingBug226(t *testing.T) {
|
func TestDuplicateSlicesInDestination(t *testing.T) {
|
||||||
|
|
||||||
type Staffs struct {
|
type Staffs struct {
|
||||||
StaffList []model.Staff
|
StaffList []model.Staff
|
||||||
|
|
@ -397,8 +397,9 @@ func TestGroupingBug226(t *testing.T) {
|
||||||
type MyStore struct {
|
type MyStore struct {
|
||||||
model.Store
|
model.Store
|
||||||
|
|
||||||
StaffList []model.Staff
|
StaffList []model.Staff
|
||||||
Staffs Staffs
|
StaffList2 []model.Staff
|
||||||
|
Staffs Staffs
|
||||||
}
|
}
|
||||||
|
|
||||||
stmt := SELECT(
|
stmt := SELECT(
|
||||||
|
|
@ -438,6 +439,21 @@ func TestGroupingBug226(t *testing.T) {
|
||||||
"Picture": "iVBORw0KWgo="
|
"Picture": "iVBORw0KWgo="
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"StaffList2": [
|
||||||
|
{
|
||||||
|
"StaffID": 1,
|
||||||
|
"FirstName": "Mike",
|
||||||
|
"LastName": "Hillyer",
|
||||||
|
"AddressID": 3,
|
||||||
|
"Email": "Mike.Hillyer@sakilastaff.com",
|
||||||
|
"StoreID": 1,
|
||||||
|
"Active": true,
|
||||||
|
"Username": "Mike",
|
||||||
|
"Password": "8cb2237d0679ca88db6464eac60da96345513964",
|
||||||
|
"LastUpdate": "2006-05-16T16:13:11.79328Z",
|
||||||
|
"Picture": "iVBORw0KWgo="
|
||||||
|
}
|
||||||
|
],
|
||||||
"Staffs": {
|
"Staffs": {
|
||||||
"StaffList": [
|
"StaffList": [
|
||||||
{
|
{
|
||||||
|
|
@ -476,6 +492,21 @@ func TestGroupingBug226(t *testing.T) {
|
||||||
"Picture": null
|
"Picture": null
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"StaffList2": [
|
||||||
|
{
|
||||||
|
"StaffID": 2,
|
||||||
|
"FirstName": "Jon",
|
||||||
|
"LastName": "Stephens",
|
||||||
|
"AddressID": 4,
|
||||||
|
"Email": "Jon.Stephens@sakilastaff.com",
|
||||||
|
"StoreID": 2,
|
||||||
|
"Active": true,
|
||||||
|
"Username": "Jon",
|
||||||
|
"Password": "8cb2237d0679ca88db6464eac60da96345513964",
|
||||||
|
"LastUpdate": "2006-05-16T16:13:11.79328Z",
|
||||||
|
"Picture": null
|
||||||
|
}
|
||||||
|
],
|
||||||
"Staffs": {
|
"Staffs": {
|
||||||
"StaffList": [
|
"StaffList": [
|
||||||
{
|
{
|
||||||
|
|
@ -543,15 +574,13 @@ ORDER BY city.city_id, address.address_id, customer.customer_id;
|
||||||
Customers []struct {
|
Customers []struct {
|
||||||
model.Customer
|
model.Customer
|
||||||
|
|
||||||
Address []model.Address
|
Address model.Address
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err := stmt.Query(db, &dest)
|
err := stmt.Query(db, &dest)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
testutils.PrintJson(dest)
|
|
||||||
|
|
||||||
require.Equal(t, len(dest), 2)
|
require.Equal(t, len(dest), 2)
|
||||||
require.Equal(t, dest[0].City.City, "London")
|
require.Equal(t, dest[0].City.City, "London")
|
||||||
require.Equal(t, dest[1].City.City, "York")
|
require.Equal(t, dest[1].City.City, "York")
|
||||||
|
|
@ -572,7 +601,7 @@ func TestExecution2(t *testing.T) {
|
||||||
ID int32 `sql:"primary_key"`
|
ID int32 `sql:"primary_key"`
|
||||||
LastName *string
|
LastName *string
|
||||||
|
|
||||||
Address []MyAddress
|
Address MyAddress
|
||||||
}
|
}
|
||||||
|
|
||||||
type MyCity struct {
|
type MyCity struct {
|
||||||
|
|
@ -622,7 +651,6 @@ ORDER BY city.city_id, address.address_id, customer.customer_id;
|
||||||
require.Equal(t, len(dest[0].Customers), 2)
|
require.Equal(t, len(dest[0].Customers), 2)
|
||||||
require.Equal(t, *dest[0].Customers[0].LastName, "Hoffman")
|
require.Equal(t, *dest[0].Customers[0].LastName, "Hoffman")
|
||||||
require.Equal(t, *dest[0].Customers[1].LastName, "Vines")
|
require.Equal(t, *dest[0].Customers[1].LastName, "Vines")
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestExecution3(t *testing.T) {
|
func TestExecution3(t *testing.T) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue