Skip to content

Commit

Permalink
test demonstrating option ordering insensitivity
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanj-square committed Jul 9, 2024
1 parent 3df338d commit 27845eb
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions backend/controller/sql/testdata/go/database/database_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,19 @@ func TestDatabase(t *testing.T) {
assert.Equal(t, "unit test 2", list[0])
}

func TestOptionOrdering(t *testing.T) {
ctx := ftltest.Context(
ftltest.WithDatabase(db), // <--- consumes DSNs
ftltest.WithProjectFile("ftl-project.toml"), // <--- provides DSNs
)

Insert(ctx, InsertRequest{Data: "unit test 1"})
list, err := getAll(ctx)
assert.NoError(t, err)
assert.Equal(t, 1, len(list))
assert.Equal(t, "unit test 1", list[0])
}

func getAll(ctx context.Context) ([]string, error) {
rows, err := db.Get(ctx).Query("SELECT data FROM requests ORDER BY created_at;")
if err != nil {
Expand Down

0 comments on commit 27845eb

Please sign in to comment.