Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.subscribe(null, null, () => {
expect(outgoingMessages.length).toBe(8);
expect(outgoingMessages[0]).toEqual(stdoutMsg(`Downloading inputs. Hold on.${newLine()}`));
// tslint:disable-next-line
expect(outgoingMessages[1]).toEqual(
stdoutMsg(
`${ansi.cursor.down(3)}\rDownloading ${bold(inputs[0].url)} to ${bold('./inputs/' + inputs[0].name)}`
)
);
expect(outgoingMessages[2]).toEqual(
stdoutMsg(
`${ansi.cursor.down(3)}\rDownloading ${bold(inputs[1].url)} to ${bold('./inputs/' + inputs[1].name)}`
)
);
// jump 5 lines up after both captions are written
expect(outgoingMessages[3]).toEqual(stdoutMsg(ansi.cursor.up(5)));
// tslint:disable-next-line
expect(outgoingMessages[4]).toEqual(
stdoutMsg(
ansi.cursor.down(downloader.relativeOffset(0)) +
`progress 1st file` +
ansi.cursor.up(downloader.relativeOffset(0))
)
`${ansi.cursor.down(3)}\rDownloading ${bold(inputs[0].url)} to ${bold('./inputs/' + inputs[0].name)}`
)
);
expect(outgoingMessages[2]).toEqual(
stdoutMsg(
`${ansi.cursor.down(3)}\rDownloading ${bold(inputs[1].url)} to ${bold('./inputs/' + inputs[1].name)}`
)
);
// jump 5 lines up after both captions are written
expect(outgoingMessages[3]).toEqual(stdoutMsg(ansi.cursor.up(5)));
// tslint:disable-next-line
expect(outgoingMessages[4]).toEqual(
stdoutMsg(
ansi.cursor.down(downloader.relativeOffset(0)) +
`progress 1st file` +
ansi.cursor.up(downloader.relativeOffset(0))
)
);
expect(outgoingMessages[5]).toEqual(
stdoutMsg(
ansi.cursor.down(downloader.relativeOffset(1)) +
`progress 2nd file` +
ansi.cursor.up(downloader.relativeOffset(1))
)
);
// jump 9 lines down and write a new line after both downloads completed
expect(outgoingMessages[6]).toEqual(stdoutMsg(ansi.cursor.down(9) + newLine()));
expect(outgoingMessages[7]).toEqual(stdoutMsg(`Finished downloading inputs${newLine()}`));
done();
});
});
const writeCaption = (value: LabInput) =>
`${ansi.cursor.down(this.lineHeight)}\rDownloading ${bold(value.url)} to ${bold('./inputs/' + value.name)}`;
function column (n, msg) {
process.stdout.write(ansi.cursor.horizontalAbsolute(n) + msg)
}
map(msg => {
const offset = this.relativeOffset(index);
msg.str = ansi.cursor.down(offset) + msg.str + ansi.cursor.up(offset);
return msg;
})
)