feature/pubsub #7
@@ -899,6 +899,15 @@
|
|||||||
"outlet": { "type": "string", "nullable": true }
|
"outlet": { "type": "string", "nullable": true }
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"ConfirmationStatus": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"code": { "type": "string", "nullable": true },
|
||||||
|
"viewCount": { "type": "integer" },
|
||||||
|
"lastViewedAt": { "type": "string", "format": "date-time" }
|
||||||
|
},
|
||||||
|
"required": ["viewCount", "lastViewedAt"]
|
||||||
|
},
|
||||||
"CartGrain": {
|
"CartGrain": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"description": "Cart aggregate (actor state)",
|
"description": "Cart aggregate (actor state)",
|
||||||
@@ -933,11 +942,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"userId": { "type": "string" },
|
"userId": { "type": "string" },
|
||||||
"confirmationViewCount": { "type": "integer" },
|
"confirmation": { "$ref": "#/components/schemas/ConfirmationStatus" },
|
||||||
"confirmationLastViewedAt": {
|
|
||||||
"type": "string",
|
|
||||||
"format": "date-time"
|
|
||||||
},
|
|
||||||
"checkoutOrderId": { "type": "string" },
|
"checkoutOrderId": { "type": "string" },
|
||||||
"checkoutStatus": { "type": "string" },
|
"checkoutStatus": { "type": "string" },
|
||||||
"checkoutCountry": { "type": "string" },
|
"checkoutCountry": { "type": "string" },
|
||||||
|
|||||||
@@ -674,29 +674,26 @@ func TestConfirmationViewed(t *testing.T) {
|
|||||||
g := newTestGrain()
|
g := newTestGrain()
|
||||||
|
|
||||||
// Initial state
|
// Initial state
|
||||||
if g.ConfirmationViewCount != 0 {
|
if g.Confirmation != nil {
|
||||||
t.Fatalf("initial view count should be 0, got %d", g.ConfirmationViewCount)
|
t.Fatalf("confirmation should be nil, got %d", g.Confirmation)
|
||||||
}
|
|
||||||
if !g.ConfirmationLastViewedAt.IsZero() {
|
|
||||||
t.Fatalf("initial last viewed should be zero")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// First view
|
// First view
|
||||||
applyOK(t, reg, g, msgConfirmationViewed())
|
applyOK(t, reg, g, msgConfirmationViewed())
|
||||||
if g.ConfirmationViewCount != 1 {
|
if g.Confirmation.ViewCount != 1 {
|
||||||
t.Fatalf("view count should be 1, got %d", g.ConfirmationViewCount)
|
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")
|
t.Fatalf("ConfirmationLastViewedAt not set")
|
||||||
}
|
}
|
||||||
firstTime := g.ConfirmationLastViewedAt
|
firstTime := g.Confirmation.LastViewedAt
|
||||||
|
|
||||||
// Second view
|
// Second view
|
||||||
applyOK(t, reg, g, msgConfirmationViewed())
|
applyOK(t, reg, g, msgConfirmationViewed())
|
||||||
if g.ConfirmationViewCount != 2 {
|
if g.Confirmation.ViewCount != 2 {
|
||||||
t.Fatalf("view count should be 2, got %d", g.ConfirmationViewCount)
|
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")
|
t.Fatalf("ConfirmationLastViewedAt should have updated")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user