Browse Source

Fix tests.

master
Gisle Aune 5 years ago
parent
commit
9feb4575c9
  1. 6
      .drone.yml
  2. 28
      database/drivers/bolt/activity_test.go

6
.drone.yml

@ -8,7 +8,7 @@ steps:
image: golang:1.11 image: golang:1.11
commands: commands:
- go mod download - go mod download
- CGO_ENABLED=0 go build -ldflags "-w -s" -o /build/lektura main.go
- CGO_ENABLED=0 go build -ldflags "-w -s" -o main.go
when: when:
event: event:
exclude: exclude:
@ -18,7 +18,7 @@ steps:
image: golang:1.12 image: golang:1.12
commands: commands:
- go mod download - go mod download
- CGO_ENABLED=0 go build -ldflags "-w -s" -o /build/lektura main.go
- CGO_ENABLED=0 go build -ldflags "-w -s" main.go
when: when:
event: event:
exclude: exclude:
@ -28,7 +28,7 @@ steps:
image: golang:1.13 image: golang:1.13
commands: commands:
- go mod download - go mod download
- CGO_ENABLED=0 go build -ldflags "-w -s" -o /build/lektura main.go
- CGO_ENABLED=0 go build -ldflags "-w -s" -o main.go
when: when:
event: event:
exclude: exclude:

28
database/drivers/bolt/activity_test.go

@ -30,9 +30,9 @@ func TestActivityRepository(t *testing.T) {
UserID: testUser1.ID, UserID: testUser1.ID,
Icon: "cube", Icon: "cube",
SubActivities: []models.SubActivity{ SubActivities: []models.SubActivity{
{ID: "S1001", Name: "Practice", UnitName: "minute", Multiplier: 15},
{ID: "S1002", Name: "Tutorial", UnitName: "minute", Multiplier: 20},
{ID: "S1003", Name: "Scene", UnitName: "minute", Multiplier: 30},
{ID: "S1001", Name: "Practice", UnitName: "minute", Value: 15},
{ID: "S1002", Name: "Tutorial", UnitName: "minute", Value: 20},
{ID: "S1003", Name: "Scene", UnitName: "minute", Value: 30},
}, },
} }
testActivity2 := models.Activity{ testActivity2 := models.Activity{
@ -41,11 +41,11 @@ func TestActivityRepository(t *testing.T) {
UserID: testUser2.ID, UserID: testUser2.ID,
Icon: "dice-d20", Icon: "dice-d20",
SubActivities: []models.SubActivity{ SubActivities: []models.SubActivity{
{ID: "S2001", Name: "Writing", UnitName: "word", Multiplier: 1},
{ID: "S2002", Name: "Planning", UnitName: "word", Multiplier: 2},
{ID: "S2003", Name: "Publish", UnitName: "word", Multiplier: 1},
{ID: "S2003", Name: "Write & Publish", UnitName: "word", Multiplier: 3},
{ID: "S2004", Name: "IRC RP", UnitName: "minute", Multiplier: 6.6},
{ID: "S2001", Name: "Writing", UnitName: "word", Value: 1},
{ID: "S2002", Name: "Planning", UnitName: "word", Value: 2},
{ID: "S2003", Name: "Publish", UnitName: "word", Value: 1},
{ID: "S2003", Name: "Write & Publish", UnitName: "word", Value: 3},
{ID: "S2004", Name: "IRC RP", UnitName: "minute", Value: 6.6},
}, },
} }
testActivity3 := models.Activity{ testActivity3 := models.Activity{
@ -54,15 +54,15 @@ func TestActivityRepository(t *testing.T) {
UserID: testUser1.ID, UserID: testUser1.ID,
Icon: "code", Icon: "code",
SubActivities: []models.SubActivity{ SubActivities: []models.SubActivity{
{ID: "S3001", Name: "Rust NameGen", UnitName: "minute", Multiplier: 20},
{ID: "S3002", Name: "Learn GoLang", UnitName: "minute", Multiplier: 25},
{ID: "S3001", Name: "Rust NameGen", UnitName: "minute", Value: 20},
{ID: "S3002", Name: "Learn GoLang", UnitName: "minute", Value: 25},
}, },
} }
testActivities := []*models.Activity{&testActivity1, &testActivity2, &testActivity3} testActivities := []*models.Activity{&testActivity1, &testActivity2, &testActivity3}
testActivity3Update := models.ActivityUpdate{ testActivity3Update := models.ActivityUpdate{
SetName: strPtr("Programming"), SetName: strPtr("Programming"),
AddSub: &models.SubActivity{Name: "Website Rewrite", UnitName: "minute", Multiplier: 15},
EditSub: &models.SubActivity{ID: "S3001", Name: "Rust SetName Generator", UnitName: "minute", Multiplier: 22},
AddSub: &models.SubActivity{Name: "Website Rewrite", UnitName: "minute", Value: 15},
EditSub: &models.SubActivity{ID: "S3001", Name: "Rust SetName Generator", UnitName: "minute", Value: 22},
RemoveSub: strPtr("S3002"), RemoveSub: strPtr("S3002"),
} }
testActivity3Updated := models.Activity{ testActivity3Updated := models.Activity{
@ -71,8 +71,8 @@ func TestActivityRepository(t *testing.T) {
UserID: testUser1.ID, UserID: testUser1.ID,
Icon: "code", Icon: "code",
SubActivities: []models.SubActivity{ SubActivities: []models.SubActivity{
{ID: "S3001", Name: "Rust SetName Generator", UnitName: "minute", Multiplier: 22},
{Name: "Website Rewrite", UnitName: "minute", Multiplier: 15},
{ID: "S3001", Name: "Rust SetName Generator", UnitName: "minute", Value: 22},
{Name: "Website Rewrite", UnitName: "minute", Value: 15},
}, },
} }

Loading…
Cancel
Save