Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 48 additions & 8 deletions input/chainsync/block_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,30 @@ func TestNewBlockContext(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
blockContext := NewBlockContext(tc.block, tc.networkMagic)
assert.Equal(t, tc.expectedEra, blockContext.Era, "Era should match")
assert.Equal(t, tc.expectedBlock, blockContext.BlockNumber, "Block number should match")
assert.Equal(t, tc.expectedSlot, blockContext.SlotNumber, "Slot number should match")
assert.Equal(t, tc.networkMagic, blockContext.NetworkMagic, "Network magic should match")
assert.Equal(
t,
tc.expectedEra,
blockContext.Era,
"Era should match",
)
assert.Equal(
t,
tc.expectedBlock,
blockContext.BlockNumber,
"Block number should match",
)
assert.Equal(
t,
tc.expectedSlot,
blockContext.SlotNumber,
"Slot number should match",
)
assert.Equal(
t,
tc.networkMagic,
blockContext.NetworkMagic,
"Network magic should match",
)
})
}
}
Expand Down Expand Up @@ -244,10 +264,30 @@ func TestNewBlockContextEdgeCases(t *testing.T) {
for _, tc := range testCases {
t.Run(tc.name, func(t *testing.T) {
blockContext := NewBlockContext(tc.block, tc.networkMagic)
assert.Equal(t, tc.expectedEra, blockContext.Era, "Era should match")
assert.Equal(t, tc.block.BlockNumber(), blockContext.BlockNumber, "Block number should match")
assert.Equal(t, tc.block.SlotNumber(), blockContext.SlotNumber, "Slot number should match")
assert.Equal(t, tc.networkMagic, blockContext.NetworkMagic, "Network magic should match")
assert.Equal(
t,
tc.expectedEra,
blockContext.Era,
"Era should match",
)
assert.Equal(
t,
tc.block.BlockNumber(),
blockContext.BlockNumber,
"Block number should match",
)
assert.Equal(
t,
tc.block.SlotNumber(),
blockContext.SlotNumber,
"Slot number should match",
)
assert.Equal(
t,
tc.networkMagic,
blockContext.NetworkMagic,
"Network magic should match",
)
})
}
}
6 changes: 5 additions & 1 deletion input/chainsync/chainsync_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ func TestHandleRollBackward(t *testing.T) {

// Verify that the status was updated correctly
assert.Equal(t, uint64(12345), c.status.SlotNumber)
assert.Equal(t, uint64(0), c.status.BlockNumber) // BlockNumber should be 0 after rollback
assert.Equal(
t,
uint64(0),
c.status.BlockNumber,
) // BlockNumber should be 0 after rollback
assert.Equal(t, "0102030405", c.status.BlockHash)
assert.Equal(t, uint64(67890), c.status.TipSlotNumber)
assert.Equal(t, "060708090a", c.status.TipBlockHash)
Expand Down
Loading