Created
January 20, 2022 21:48
-
-
Save tjdevries/7f9b45be5c2648fbee12c84885494a1d to your computer and use it in GitHub Desktop.
This file contains 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 characters
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) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment