more updates
This commit is contained in:
@@ -674,29 +674,26 @@ func TestConfirmationViewed(t *testing.T) {
|
||||
g := newTestGrain()
|
||||
|
||||
// Initial state
|
||||
if g.ConfirmationViewCount != 0 {
|
||||
t.Fatalf("initial view count should be 0, got %d", g.ConfirmationViewCount)
|
||||
}
|
||||
if !g.ConfirmationLastViewedAt.IsZero() {
|
||||
t.Fatalf("initial last viewed should be zero")
|
||||
if g.Confirmation != nil {
|
||||
t.Fatalf("confirmation should be nil, got %d", g.Confirmation)
|
||||
}
|
||||
|
||||
// First view
|
||||
applyOK(t, reg, g, msgConfirmationViewed())
|
||||
if g.ConfirmationViewCount != 1 {
|
||||
t.Fatalf("view count should be 1, got %d", g.ConfirmationViewCount)
|
||||
if g.Confirmation.ViewCount != 1 {
|
||||
t.Fatalf("view count should be 1, got %d", g.Confirmation.ViewCount)
|
||||
}
|
||||
if g.ConfirmationLastViewedAt.IsZero() {
|
||||
if g.Confirmation.LastViewedAt.IsZero() {
|
||||
t.Fatalf("ConfirmationLastViewedAt not set")
|
||||
}
|
||||
firstTime := g.ConfirmationLastViewedAt
|
||||
firstTime := g.Confirmation.LastViewedAt
|
||||
|
||||
// Second view
|
||||
applyOK(t, reg, g, msgConfirmationViewed())
|
||||
if g.ConfirmationViewCount != 2 {
|
||||
t.Fatalf("view count should be 2, got %d", g.ConfirmationViewCount)
|
||||
if g.Confirmation.ViewCount != 2 {
|
||||
t.Fatalf("view count should be 2, got %d", g.Confirmation.ViewCount)
|
||||
}
|
||||
if g.ConfirmationLastViewedAt == firstTime {
|
||||
if g.Confirmation.LastViewedAt == firstTime {
|
||||
t.Fatalf("ConfirmationLastViewedAt should have updated")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user