Created
January 20, 2022 21:48
-
-
Save tjdevries/7f9b45be5c2648fbee12c84885494a1d to your computer and use it in GitHub Desktop.
Revisions
-
tjdevries created this gist
Jan 20, 2022 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,30 @@ func TestNoProjects(t *testing.T) { db := Setup(t) pr := &GormProjectRepository{DB: db} // Don't add any projects // Test allProjects := GetProjects(pr) if len(allProjects) > 0 { t.Errorf("Shouldn't have any projects, but got: %+v\n", allProjects) } } func TestOneProject(t *testing.T) { db := Setup(t) pr := &GormProjectRepository{DB: db} // Add one project this time. addProject(pr, "MyProject") allProjects := GetProjects(pr) if len(allProjects) != 1 { t.Errorf("Should have gotten one pro, but got: %+v\n", allProjects) } proj := allProjects[0] if pr.name != "MyProject" { t.Errorf("Should have gotten 'MyProject', but got '%+v'\n", proj) } }