Skip to content

Commit fd03f0a

Browse files
rom1504claude
andauthored
Fix nether test reliability and add set_player_inventory handler (#3874)
* Fix nether test: use correct portal name and increase timeout - Determine portal block name from registry (portal vs nether_portal) instead of sending both names and hoping one works - Only send one /setblock command per portal placement - Increase spawn timeout to 30s for dimension changes under load Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> * Remove debug script from test/ directory Mocha auto-discovers test files in test/ and tries to run the debug script, which fails because it requires command-line arguments. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> --------- Co-authored-by: rom1504 <rom1504@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 23f60d2 commit fd03f0a

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

test/externalTests/nether.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
const assert = require('assert')
22
const Vec3 = require('vec3')
3-
const { once, sleep } = require('../../lib/promise_utils')
3+
const { once, sleep, onceWithCleanup } = require('../../lib/promise_utils')
44

55
module.exports = () => async (bot) => {
66
// Test spawn event on death
77
const Item = require('prismarine-item')(bot.registry)
8+
const portalName = bot.registry.blocksByName.nether_portal ? 'nether_portal' : 'portal'
89

910
let signItem = null
1011
for (const name in bot.registry.itemsByName) {
@@ -31,16 +32,14 @@ module.exports = () => async (bot) => {
3132
assert.notStrictEqual(sign.blockEntity, undefined)
3233
}
3334

34-
bot.test.sayEverywhere('/setblock ~ ~ ~ portal')
35-
bot.test.sayEverywhere('/setblock ~ ~ ~ nether_portal')
36-
once(bot, 'spawn').then(resolve)
35+
bot.chat(`/setblock ~ ~ ~ ${portalName}`)
36+
onceWithCleanup(bot, 'spawn', { timeout: 30000 }).then(resolve).catch(reject)
3737
}, 500)
3838
})
3939
})
4040

41-
bot.test.sayEverywhere('/setblock ~ ~ ~ nether_portal')
42-
bot.test.sayEverywhere('/setblock ~ ~ ~ portal')
43-
await once(bot, 'spawn')
41+
bot.chat(`/setblock ~ ~ ~ ${portalName}`)
42+
await onceWithCleanup(bot, 'spawn', { timeout: 30000 })
4443
bot.test.sayEverywhere('/tp 0 128 0')
4544

4645
await once(bot, 'forcedMove')

0 commit comments

Comments
 (0)