From 7948a69f9dd8677a4e3bc4cea3ba44e789536bd0 Mon Sep 17 00:00:00 2001 From: Dimitris Marlagkoutsos Date: Fri, 20 Sep 2024 10:56:51 +0100 Subject: [PATCH] test(cli): Fix failing cli tests (#2453) Closes: https://github.com/endojs/endo/issues/2409 Refs: https://github.com/endojs/endo/pull/2384 ## Description This PR updates the readme to properly document the `list` cli command and fixes the failing tests ### Security Considerations none ### Scaling Considerations none ### Documentation Considerations none ### Testing Considerations none ### Compatibility Considerations none ### Upgrade Considerations none --- packages/cli/demo/README.md | 4 ++-- packages/cli/test/demo/index.test.js | 6 +++--- packages/cli/test/demo/mailboxes-are-symmetric.js | 9 ++++++--- packages/cli/test/demo/names-in-transit.js | 4 ++-- packages/cli/test/demo/sending-messages.js | 6 +++--- 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/packages/cli/demo/README.md b/packages/cli/demo/README.md index bbf07a3b34..38419e29e8 100644 --- a/packages/cli/demo/README.md +++ b/packages/cli/demo/README.md @@ -206,7 +206,7 @@ and adopt the "doubler" object into our own store. > endo inbox --as alice-agent 0. "HOST" sent "Please enjoy this @doubler." > endo adopt --as alice-agent 0 doubler -> endo list --as alice-agent +> endo list alice-agent doubler > endo dismiss --as alice-agent 0 ``` @@ -230,7 +230,7 @@ Then, alice adopts "counter", giving it their own name, "redoubler". > endo inbox --as alice-agent 1. "HOST" sent "Please enjoy this @counter." > endo adopt --as alice-agent 1 counter --name redoubler -> endo list --as alice-agent +> endo list alice-agent redoubler > endo dismiss --as alice-agent 1 ``` diff --git a/packages/cli/test/demo/index.test.js b/packages/cli/test/demo/index.test.js index a531c7a99c..817c64664c 100644 --- a/packages/cli/test/demo/index.test.js +++ b/packages/cli/test/demo/index.test.js @@ -37,7 +37,7 @@ test.serial( ), ); -test.serial.failing( +test.serial( 'sending-messages', makeSectionTest( $({ cwd: 'demo' }), @@ -49,7 +49,7 @@ test.serial.failing( ), ); -test.serial.failing( +test.serial( 'names-in-transit', makeSectionTest( $({ cwd: 'demo' }), @@ -62,7 +62,7 @@ test.serial.failing( ), ); -test.serial.failing( +test.serial( 'mailboxes-are-symmetric', makeSectionTest( $({ cwd: 'demo' }), diff --git a/packages/cli/test/demo/mailboxes-are-symmetric.js b/packages/cli/test/demo/mailboxes-are-symmetric.js index 342d1bf2df..5bfa044194 100644 --- a/packages/cli/test/demo/mailboxes-are-symmetric.js +++ b/packages/cli/test/demo/mailboxes-are-symmetric.js @@ -7,8 +7,11 @@ export const section = async (execa, testLine) => { execa`endo send HOST --as alice-agent ${'This is the @doubler you sent me.'}`, ); await testLine(execa`endo inbox`, { - stdout: /^0\. "alice" sent "This is the @doubler you sent me\."/, + stdout: /3\. "alice" sent "This is the @doubler you sent me\."/, + }); + await testLine(execa`endo adopt 3 doubler doubler-from-alice`); + await testLine(execa`endo dismiss 3`); + await testLine(execa`endo inbox`, { + stdout: /^(?!3\. "alice" sent "This is the @doubler you sent me\.").*/, }); - await testLine(execa`endo adopt 0 doubler doubler-from-alice`); - await testLine(execa`endo dismiss 0`); }; diff --git a/packages/cli/test/demo/names-in-transit.js b/packages/cli/test/demo/names-in-transit.js index 6f711a312d..0a19187708 100644 --- a/packages/cli/test/demo/names-in-transit.js +++ b/packages/cli/test/demo/names-in-transit.js @@ -10,8 +10,8 @@ export const section = async (execa, testLine) => { stdout: /^1\. "HOST" sent "Please enjoy this @counter\."/, }); await testLine(execa`endo adopt --as alice-agent 1 counter --name redoubler`); - await testLine(execa`endo list --as alice-agent`, { - stdout: 'redoubler', + await testLine(execa`endo list alice-agent`, { + stdout: /redoubler/, }); await testLine(execa`endo dismiss --as alice-agent 1`); }; diff --git a/packages/cli/test/demo/sending-messages.js b/packages/cli/test/demo/sending-messages.js index 38522e1e6b..f4784e3a0c 100644 --- a/packages/cli/test/demo/sending-messages.js +++ b/packages/cli/test/demo/sending-messages.js @@ -11,8 +11,8 @@ export const section = async (execa, testLine) => { stdout: /^0\. "HOST" sent "Please enjoy this @doubler\."/, }); await testLine(execa`endo adopt --as alice-agent 0 doubler`); - await testLine(execa`endo list --as alice-agent`, { - stdout: 'doubler', + await testLine(execa`endo list alice-agent`, { + stdout: /doubler/, }); await testLine(execa`endo dismiss --as alice-agent 0`); }; @@ -22,7 +22,7 @@ export const context = { setup: async execa => { await execa`endo mkguest alice alice-agent`; await execa`endo send alice ${'Please enjoy this @doubler.'}`; - await execa`endo adopt alice-agent 0 doubler`; + await execa`endo adopt --as alice-agent 0 doubler`; await execa`endo dismiss --as alice-agent 0`; }, };