Skip to content
This repository has been archived by the owner on Oct 21, 2019. It is now read-only.

Commit

Permalink
Add basic team tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bobheadxi committed Jun 26, 2018
1 parent 9b6e70e commit 9fba720
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions data/team_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package data

import (
"testing"

"github.com/stretchr/testify/assert"
"github.com/ubclaunchpad/rocket/model"
)

func TestCreateGetAndDeleteTeam(t *testing.T) {
if testing.Short() {
t.Skip("skipping integration test")
}
dal, cleanupFunc, err := newTestDBConnection()
assert.Nil(t, err)
defer cleanupFunc()

// Create a new team
team := &model.Team{
Name: "team-bob",
GithubTeamID: 1234,
Platform: "winning",
Members: []*model.Member{&model.Member{
SlackID: "1234",
Name: "Little Bruno",
Position: "A REAL GUY",
}},
}
err = dal.CreateTeam(team)
assert.Nil(t, err)

// Get team by name
teamGetByName := &model.Team{Name: "team-bob"}
err = dal.GetTeamByName(teamGetByName)
assert.Nil(t, err)
assert.Equal(t, team.Platform, teamGetByName.Platform)

// Get team by ID
teamGetByID := &model.Team{GithubTeamID: 1234}
err = dal.GetTeamByGithubID(teamGetByID)
assert.Nil(t, err)
assert.Equal(t, team.Platform, teamGetByID.Platform)

// Delete team
teamDeleteByID := &model.Team{Name: "team-bob"}
err = dal.DeleteTeamByName(teamDeleteByID)
assert.Nil(t, err)

// Attempt to get
err = dal.GetTeamByGithubID(teamGetByID)
assert.NotNil(t, err)
}

0 comments on commit 9fba720

Please sign in to comment.