Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion bindings/js/test/integration.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,22 @@ test("echo roundtrip drives a real session", async () => {
await su.waitCommand();
await su.expectText("hello-sdk", { strict: false });
await su.expectExitCode(0);

const state = await su.state();
// Read next to the snapshot it is compared against. The shell draws its
// next prompt after the command finishes, which moves the cursor, and
// these two calls read it separately: with other calls in between, the
// prompt lands between them and they disagree by its width.
//
// `waitIdle` is not the barrier it looks like here, since the screen is
// quiet *because* the prompt has not started, so idle arrives first.
assert.deepEqual(await su.getCursor(), state.cursor);
assert.ok(state.cols > 0);
assert.match(await su.text(), /hello-sdk/);
assert.match(await su.getCommand(), /echo hello-sdk/);
assert.match(await su.getOutput(), /hello-sdk/);
assert.equal(await su.getExitCode(), 0);
assert.equal(typeof (await su.getCwd()), "string");
assert.deepEqual(await su.getCursor(), state.cursor);
assert.deepEqual(await su.getSize(), { cols: state.cols, rows: state.rows });

await su.resize(92, 26);
Expand Down
Loading