Skip to content

Commit

Permalink
removing command from stdout and updating tests
Browse files Browse the repository at this point in the history
Signed-off-by: Amber Torrise <amber.torrise@broadcom.com>
  • Loading branch information
ATorrise committed Aug 4, 2023
1 parent 3d81e91 commit 8af2db4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion packages/zosuss/__tests__/__unit__/Shell.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,12 @@ function checkMockFunctionsWithCommand(command: string) {
expect(mockConnect).toBeCalled();
expect(mockShell).toBeCalled();

// Check the stream.end() fucntion is called with an argument containing the SSH command
// Check the stream.end() function is called with an argument containing the SSH command
expect(mockStreamWrite.mock.calls[0][0]).toMatch(command);
expect(mockStreamEnd).toHaveBeenCalled();
expect(stdoutHandler).toHaveBeenCalledWith("stdout data\n");
expect(stdoutHandler).toHaveBeenCalledWith("\rerror");
expect(stdoutHandler).not.toContain("$")

Check warning on line 69 in packages/zosuss/__tests__/__unit__/Shell.unit.test.ts

View workflow job for this annotation

GitHub Actions / lint

Missing semicolon
}

describe("Shell", () => {
Expand Down
6 changes: 4 additions & 2 deletions packages/zosuss/src/Shell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,10 @@ export class Shell {
dataToPrint = "";
isUserCommand = false;
} else if (isUserCommand) {
// print out the user command result
stdoutHandler(dataToPrint);
// don't print out command, just print result
if (!dataToPrint.match(new RegExp("\\$"))){
stdoutHandler(dataToPrint);
}
dataToPrint = "";
}
}
Expand Down

0 comments on commit 8af2db4

Please sign in to comment.