From ad2f94c472e1cdcd66c07ac78a2e1739ac7505b4 Mon Sep 17 00:00:00 2001 From: achingbrain Date: Fri, 20 Sep 2024 17:52:41 +0200 Subject: [PATCH] chore: tests --- examples/js-libp2p-example-pubsub/test/test-2.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/examples/js-libp2p-example-pubsub/test/test-2.js b/examples/js-libp2p-example-pubsub/test/test-2.js index 60d7559..9f3605f 100644 --- a/examples/js-libp2p-example-pubsub/test/test-2.js +++ b/examples/js-libp2p-example-pubsub/test/test-2.js @@ -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 + } + } }