Skip to content

Commit

Permalink
test: remove test for issue 1670 (#3690)
Browse files Browse the repository at this point in the history
* test: remove test for issue 1670

* fix another test

* add esbuild as devDependency
  • Loading branch information
Uzlopak authored Oct 6, 2024
1 parent 01abc4f commit a7c037c
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 19 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"main": "index.js",
"types": "index.d.ts",
"scripts": {
"build:node": "npx esbuild@0.19.10 index-fetch.js --bundle --platform=node --outfile=undici-fetch.js --define:esbuildDetection=1 --keep-names && node scripts/strip-comments.js",
"build:node": "esbuild index-fetch.js --bundle --platform=node --outfile=undici-fetch.js --define:esbuildDetection=1 --keep-names && node scripts/strip-comments.js",
"prebuild:wasm": "node build/wasm.js --prebuild",
"build:wasm": "node build/wasm.js --docker",
"generate-pem": "node scripts/generate-pem.js",
Expand Down Expand Up @@ -111,6 +111,7 @@
"c8": "^10.0.0",
"cross-env": "^7.0.3",
"dns-packet": "^5.4.0",
"esbuild": "^0.19.10",
"eslint": "^9.9.0",
"fast-check": "^3.17.1",
"https-pem": "^3.0.0",
Expand Down
10 changes: 0 additions & 10 deletions test/issue-1670.js

This file was deleted.

26 changes: 18 additions & 8 deletions test/node-fetch/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ const HeadersOrig = require('../../lib/web/fetch/headers.js').Headers
const ResponseOrig = require('../../lib/web/fetch/response.js').Response
const RequestOrig = require('../../lib/web/fetch/request.js').Request
const TestServer = require('./utils/server.js')
const { createServer } = require('node:http')
const { default: tspl } = require('@matteo.collina/tspl')

const {
Uint8Array: VMUint8Array
Expand Down Expand Up @@ -1617,15 +1619,23 @@ describe('node-fetch', () => {
})
})

it('should support http request', { timeout: 5000 }, function () {
const url = 'https://github.com/'
const options = {
method: 'HEAD'
}
return fetch(url, options).then(res => {
assert.strictEqual(res.status, 200)
assert.strictEqual(res.ok, true)
it('should support http request', { timeout: 5000 }, async function (t) {
t = tspl(t, { plan: 2 })
const server = createServer((req, res) => {
res.end()
})
after(() => server.close())
server.listen(0, () => {
const url = `http://localhost:${server.address().port}`
const options = {
method: 'HEAD'
}
fetch(url, options).then(res => {
t.strictEqual(res.status, 200)
t.strictEqual(res.ok, true)
})
})
await t.completed
})

it('should encode URLs as UTF-8', async () => {
Expand Down

0 comments on commit a7c037c

Please sign in to comment.