Skip to content

Commit 2f50b3b

Browse files
authored
chore(site): remove dbmem from tests (#18802)
Related to #15109.
1 parent 8e038db commit 2f50b3b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

site/site_test.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ import (
2727
"github.com/coder/coder/v2/coderd/database"
2828
"github.com/coder/coder/v2/coderd/database/db2sdk"
2929
"github.com/coder/coder/v2/coderd/database/dbgen"
30-
"github.com/coder/coder/v2/coderd/database/dbmem"
3130
"github.com/coder/coder/v2/coderd/database/dbtestutil"
3231
"github.com/coder/coder/v2/coderd/database/dbtime"
3332
"github.com/coder/coder/v2/coderd/httpmw"
@@ -46,7 +45,7 @@ func TestInjection(t *testing.T) {
4645
},
4746
}
4847
binFs := http.FS(fstest.MapFS{})
49-
db := dbmem.New()
48+
db, _ := dbtestutil.NewDB(t)
5049
handler := site.New(&site.Options{
5150
Telemetry: telemetry.NewNoop(),
5251
BinFS: binFs,
@@ -73,13 +72,17 @@ func TestInjection(t *testing.T) {
7372
// This will update as part of the request!
7473
got.LastSeenAt = user.LastSeenAt
7574

75+
// json.Unmarshal doesn't parse the timezone correctly
76+
got.CreatedAt = got.CreatedAt.In(user.CreatedAt.Location())
77+
got.UpdatedAt = got.UpdatedAt.In(user.CreatedAt.Location())
78+
7679
require.Equal(t, db2sdk.User(user, []uuid.UUID{}), got)
7780
}
7881

7982
func TestInjectionFailureProducesCleanHTML(t *testing.T) {
8083
t.Parallel()
8184

82-
db := dbmem.New()
85+
db, _ := dbtestutil.NewDB(t)
8386

8487
// Create an expired user with a refresh token, but provide no OAuth2
8588
// configuration so that refresh is impossible, this should result in

0 commit comments

Comments
 (0)