Skip to content

Commit

Permalink
test: add delay for nc init
Browse files Browse the repository at this point in the history
  • Loading branch information
antongolub committed Dec 15, 2024
1 parent 0d720ff commit df6096a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions test/cli.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,14 +126,15 @@ describe('cli', () => {
test('scripts from https', async () => {
const server = $`cat ${path.resolve('test/fixtures/echo.http')} | nc -l 8080`
const out =
await $`node build/cli.js --verbose http://127.0.0.1:8080/echo.mjs`
await $`sleep 10 && node build/cli.js --verbose http://127.0.0.1:8080/echo.mjs`
assert.match(out.stderr, /test/)
await server.kill()
})

test('scripts from https not ok', async () => {
const server = $`echo $'HTTP/1.1 500\n\n' | nc -l 8081`
const out = await $`node build/cli.js http://127.0.0.1:8081`.nothrow()
const out =
await $`sleep 10 && node build/cli.js http://127.0.0.1:8081`.nothrow()
assert.match(out.stderr, /Error: Can't get/)
await server.kill()
})
Expand Down

0 comments on commit df6096a

Please sign in to comment.