Skip to content

Commit

Permalink
chore: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
achingbrain committed Sep 20, 2024
1 parent 4463a14 commit ad2f94c
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions examples/js-libp2p-example-pubsub/test/test-2.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,16 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url))
export async function test () {
process.stdout.write('2.js\n')

await waitForOutput('node3 received: orange', 'node', [path.join(__dirname, '../2.js')], {
cwd: __dirname
})
try {
await waitForOutput('node3 received: car', 'node', [path.join(__dirname, '../2.js')], {
cwd: __dirname,
timeout: 2000
})

throw new Error('Matched content when should not have')
} catch (err) {
if (err.message !== 'Timed out' && !err.message.includes('Did not see')) {
throw err
}
}
}

0 comments on commit ad2f94c

Please sign in to comment.