@gameye/sdk
Version:
Node.js SDK for Gameye
25 lines • 902 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const test = require("blue-tape");
const stream_1 = require("stream");
const stream_wait_1 = require("./stream-wait");
test("stream-wait", async (t) => {
const stream = new stream_1.PassThrough({ objectMode: true });
const write = (chunk) => new Promise((resolve, reject) => stream.write(chunk, error => error ? reject(error) : resolve()));
const end = () => new Promise(resolve => stream.end(resolve));
write("aa");
write("bb");
write("cc");
{
const wait = stream_wait_1.streamWait(stream, (c) => c === "bb");
const chunk = await wait;
t.equal(chunk, "bb");
}
{
const wait = stream_wait_1.streamWait(stream, () => true);
const chunk = await wait;
t.equal(chunk, "cc");
}
await end();
});
//# sourceMappingURL=stream-wait.spec.js.map