chore: Add more objects to dbgen (#6013)

* chore: Add WorkspaceApps to dbgen

* GitSSHKey, UserLink, GitAuthLink
This commit is contained in:
Steven Masley
2023-02-03 03:34:35 -06:00
committed by GitHub
parent fd2f9dc176
commit aab9e3a0f7
2 changed files with 79 additions and 0 deletions

View File

@ -44,6 +44,16 @@ func TestGenerator(t *testing.T) {
require.Equal(t, exp, must(db.GetUserLinkByLinkedID(context.Background(), exp.LinkedID)))
})
t.Run("GitAuthLink", func(t *testing.T) {
t.Parallel()
db := dbfake.New()
exp := dbgen.GitAuthLink(t, db, database.GitAuthLink{})
require.Equal(t, exp, must(db.GetGitAuthLink(context.Background(), database.GetGitAuthLinkParams{
ProviderID: exp.ProviderID,
UserID: exp.UserID,
})))
})
t.Run("WorkspaceResource", func(t *testing.T) {
t.Parallel()
db := dbfake.New()
@ -51,6 +61,13 @@ func TestGenerator(t *testing.T) {
require.Equal(t, exp, must(db.GetWorkspaceResourceByID(context.Background(), exp.ID)))
})
t.Run("WorkspaceApp", func(t *testing.T) {
t.Parallel()
db := dbfake.New()
exp := dbgen.WorkspaceApp(t, db, database.WorkspaceApp{})
require.Equal(t, exp, must(db.GetWorkspaceAppsByAgentID(context.Background(), exp.AgentID))[0])
})
t.Run("WorkspaceResourceMetadatum", func(t *testing.T) {
t.Parallel()
db := dbfake.New()
@ -159,6 +176,13 @@ func TestGenerator(t *testing.T) {
exp := dbgen.User(t, db, database.User{})
require.Equal(t, exp, must(db.GetUserByID(context.Background(), exp.ID)))
})
t.Run("SSHKey", func(t *testing.T) {
t.Parallel()
db := dbfake.New()
exp := dbgen.GitSSHKey(t, db, database.GitSSHKey{})
require.Equal(t, exp, must(db.GetGitSSHKey(context.Background(), exp.UserID)))
})
}
func must[T any](value T, err error) T {