CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
PrismarineJS

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: PrismarineJS/mineflayer
Path: blob/master/test/externalTests/exampleBlockFinder.js
Views: 789
1
const assert = require('assert')
2
3
module.exports = () => async (bot) => {
4
await bot.test.runExample('examples/blockfinder.js', async (name) => {
5
assert.strictEqual(name, 'finder')
6
await bot.test.wait(2000)
7
await bot.test.tellAndListen(name, 'find dirt', (message) => {
8
const matches = message.match(/I found ([0-9]+) (.+?) blocks in (.+?) ms/)
9
if (matches.length !== 4 || matches[1] === '0' || matches[2] !== 'dirt' || parseFloat(matches[3]) > 500) {
10
assert.fail(`Unexpected message: ${message}`) // error
11
}
12
return true // stop listening
13
})
14
})
15
}
16
17