forked from nodejs/undici
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: migrate a batch of tests to node test runner (nodejs#2742)
- Loading branch information
Showing
11 changed files
with
446 additions
and
347 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,31 @@ | ||
'use strict' | ||
|
||
const { test } = require('tap') | ||
const { tspl } = require('@matteo.collina/tspl') | ||
const { test, after } = require('node:test') | ||
const { Client } = require('..') | ||
const net = require('node:net') | ||
|
||
// TODO: move to test/node-test/client-connect.js | ||
test('parser error', (t) => { | ||
t.plan(2) | ||
test('parser error', async (t) => { | ||
t = tspl(t, { plan: 2 }) | ||
|
||
const server = net.createServer() | ||
server.once('connection', (socket) => { | ||
socket.write('asd\n\r213123') | ||
}) | ||
t.teardown(server.close.bind(server)) | ||
after(() => server.close()) | ||
|
||
server.listen(0, () => { | ||
const client = new Client(`http://localhost:${server.address().port}`) | ||
t.teardown(client.destroy.bind(client)) | ||
after(() => client.destroy()) | ||
|
||
client.request({ path: '/', method: 'GET' }, (err) => { | ||
t.ok(err) | ||
client.close((err) => { | ||
t.error(err) | ||
t.ifError(err) | ||
}) | ||
}) | ||
}) | ||
|
||
await t.completed | ||
}) |
Oops, something went wrong.