feature/pubsub #7
@@ -899,6 +899,15 @@
|
||||
"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": {
|
||||
"type": "object",
|
||||
"description": "Cart aggregate (actor state)",
|
||||
@@ -933,11 +942,7 @@
|
||||
}
|
||||
},
|
||||
"userId": { "type": "string" },
|
||||
"confirmationViewCount": { "type": "integer" },
|
||||
"confirmationLastViewedAt": {
|
||||
"type": "string",
|
||||
"format": "date-time"
|
||||
},
|
||||
"confirmation": { "$ref": "#/components/schemas/ConfirmationStatus" },
|
||||
"checkoutOrderId": { "type": "string" },
|
||||
"checkoutStatus": { "type": "string" },
|
||||
"checkoutCountry": { "type": "string" },
|
||||
|
||||
@@ -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