Skip to content

Commit

Permalink
test: add delayed pipe() test
Browse files Browse the repository at this point in the history
  • Loading branch information
antongolub committed Oct 2, 2024
1 parent 4cdef35 commit 4159751
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion test/core.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ describe('core', () => {
assert.equal(p.cmd, "echo $'#bar' --t 1")
})

test.only('stdio() works', async () => {
test('stdio() works', async () => {
let p = $`printf foo`
await p
// assert.throws(() => p.stdin)
Expand Down Expand Up @@ -384,6 +384,20 @@ describe('core', () => {
assert.equal(stdout, 'HELLO WORLD\n')
})

it('supports multipiping', async () => {
const result = $`echo 1; sleep 1; echo 2; sleep 1; echo 3`
const piped1 = result.pipe`cat`
let piped2

setTimeout(() => {
piped2 = result.pipe`cat`
}, 1500)

await piped1
assert.equal((await piped1).toString(), '1\n2\n3\n')
assert.equal((await piped2).toString(), '1\n2\n3\n')
})

test.skip('throws if already resolved', async (t) => {
let ok = true
let p = $`echo "Hello"`
Expand Down

0 comments on commit 4159751

Please sign in to comment.