Skip to content

Commit

Permalink
test this behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
J3fftw1 committed Jan 17, 2024
1 parent 5c6810b commit eca5434
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,9 @@ void testCannotOpenInvOfBrokenBlock() {
// TODO: Create an event for open inventory so this isn't guess work
Assertions.assertTrue(BlockMenuPreset.isInventory(electricFurnace.getId()));
Assertions.assertTrue(BlockStorage.getStorage(block.getWorld()).hasInventory(block.getLocation()));
// TODO(future): Check viewers - MockBukkit does not implement this today

// Assert player has the inventory open
Assertions.assertEquals(1, BlockStorage.getInventory(block).toInventory().getViewers().size());

// Break the block
BlockBreakEvent blockBreakEvent = new BlockBreakEvent(block, player);
Expand All @@ -129,6 +131,9 @@ void testCannotOpenInvOfBrokenBlock() {
// Assert the block is queued for removal
Assertions.assertTrue(Slimefun.getTickerTask().isDeletedSoon(block.getLocation()));

// Assert that the inventory was closed
Assertions.assertEquals(0, BlockStorage.getInventory(block).toInventory().getViewers().size());

// Clear event queue since we'll be running duplicate events
server.getPluginManager().clearEvents();

Expand Down

0 comments on commit eca5434

Please sign in to comment.