Tests folder structure reorganisation.

This commit is contained in:
go-jet 2019-07-30 11:45:10 +02:00
parent d0533f73fb
commit 6bf9c32c07
19 changed files with 22 additions and 24 deletions

View file

@ -508,7 +508,7 @@ return result in one database call. Handler execution will be only proportional
ORM example replaced with jet will take just 30ms + 'result scan time' = 31ms (rough estimate).
With Jet you can even join the whole database and store the whole structured result in in one query call.
This is exactly what is being done in one of the tests: [TestJoinEverything](/tests/chinook_db_test.go#L40).
This is exactly what is being done in one of the tests: [TestJoinEverything](/tests/postgres/chinook_db_test.go#L40).
The whole test database is joined and query result(~10,000 rows) is stored in a structured variable in less than 0.7s.
##### How quickly bugs are found

View file

@ -95,7 +95,7 @@ FROM test_sample.all_types;
testutils.JsonPrint(dest)
testutils.AssertJSONFile(t, "./testdata/common_db_results/bool_operators.json", dest)
testutils.AssertJSONFile(t, "./testdata/common/bool_operators.json", dest)
}
var allTypesJson = `

View file

@ -1,4 +1,4 @@
package tests
package postgres
import (
. "github.com/go-jet/jet"
@ -240,9 +240,7 @@ LIMIT $5;
assert.NilError(t, err)
testutils.JsonPrint(dest)
testutils.AssertJSONFile(t, "./testdata/common_db_results/bool_operators.json", dest)
testutils.AssertJSONFile(t, "./testdata/common/bool_operators.json", dest)
}
func TestFloatOperators(t *testing.T) {

View file

@ -1,4 +1,4 @@
package tests
package postgres
import (
"context"
@ -102,7 +102,7 @@ func TestJoinEverything(t *testing.T) {
assert.NilError(t, err)
assert.Equal(t, len(dest), 275)
testutils.AssertJSONFile(t, "./testdata/joined_everything.json", dest)
testutils.AssertJSONFile(t, "./postgres/testdata/joined_everything.json", dest)
}
func TestSelfJoin(t *testing.T) {

View file

@ -1,4 +1,4 @@
package tests
package postgres
import (
"context"

View file

@ -1,4 +1,4 @@
package tests
package postgres
import (
"context"

View file

@ -1,4 +1,4 @@
package tests
package postgres
import (
"context"

View file

@ -1,4 +1,4 @@
package tests
package postgres
import (
"bytes"

View file

@ -1,4 +1,4 @@
package tests
package postgres
import (
"github.com/go-jet/jet/internal/testutils"
@ -62,5 +62,5 @@ func TestNorthwindJoinEverything(t *testing.T) {
assert.NilError(t, err)
//jsonSave("./testdata/northwind-all.json", dest)
testutils.AssertJSONFile(t, "./testdata/northwind-all.json", dest)
testutils.AssertJSONFile(t, "./postgres/testdata/northwind-all.json", dest)
}

View file

@ -1,4 +1,4 @@
package tests
package postgres
import (
. "github.com/go-jet/jet"

View file

@ -1,4 +1,4 @@
package tests
package postgres
import (
. "github.com/go-jet/jet"
@ -182,7 +182,7 @@ func TestScanToStruct(t *testing.T) {
err := query.Query(db, &dest)
assert.Error(t, err, `Scan: unable to scan type int32 into UUID, at struct field: InventoryID uuid.UUID of type tests.Inventory. `)
assert.Error(t, err, `Scan: unable to scan type int32 into UUID, at struct field: InventoryID uuid.UUID of type postgres.Inventory. `)
})
}

View file

@ -1,4 +1,4 @@
package tests
package postgres
import (
. "github.com/go-jet/jet"
@ -1459,7 +1459,7 @@ ORDER BY actor.actor_id ASC, film.film_id ASC;
assert.NilError(t, err)
//jsonSave("./testdata/quick-start-dest.json", dest)
testutils.AssertJSONFile(t, "./testdata/quick-start-dest.json", dest)
testutils.AssertJSONFile(t, "./postgres/testdata/quick-start-dest.json", dest)
var dest2 []struct {
model.Category
@ -1472,7 +1472,7 @@ ORDER BY actor.actor_id ASC, film.film_id ASC;
assert.NilError(t, err)
//jsonSave("./testdata/quick-start-dest2.json", dest2)
testutils.AssertJSONFile(t, "./testdata/quick-start-dest2.json", dest2)
testutils.AssertJSONFile(t, "./postgres/testdata/quick-start-dest2.json", dest2)
}
func TestQuickStartWithSubQueries(t *testing.T) {
@ -1524,7 +1524,7 @@ func TestQuickStartWithSubQueries(t *testing.T) {
assert.NilError(t, err)
//jsonSave("./testdata/quick-start-dest.json", dest)
testutils.AssertJSONFile(t, "./testdata/quick-start-dest.json", dest)
testutils.AssertJSONFile(t, "./postgres/testdata/quick-start-dest.json", dest)
var dest2 []struct {
model.Category
@ -1537,5 +1537,5 @@ func TestQuickStartWithSubQueries(t *testing.T) {
assert.NilError(t, err)
//jsonSave("./testdata/quick-start-dest2.json", dest2)
testutils.AssertJSONFile(t, "./testdata/quick-start-dest2.json", dest2)
testutils.AssertJSONFile(t, "./postgres/testdata/quick-start-dest2.json", dest2)
}

View file

@ -1,4 +1,4 @@
package tests
package postgres
import (
"context"

View file

@ -1,4 +1,4 @@
package tests
package postgres
import (
"github.com/go-jet/jet"