Skip to content

Commit

Permalink
refactor: prefix unused params with underscores (#326)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs authored Jan 7, 2025
1 parent 67a6fe5 commit 6d888c8
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 89 deletions.
2 changes: 1 addition & 1 deletion lib/response.js
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ function generatePayload (response) {
// Throws away all written data to prevent response from buffering payload
function getNullSocket () {
return new Writable({
write (chunk, encoding, callback) {
write (_chunk, _encoding, callback) {
setImmediate(callback)
}
})
Expand Down
8 changes: 4 additions & 4 deletions test/async-await.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const { test } = require('node:test')
const inject = require('../index')

test('basic async await', async t => {
const dispatch = function (req, res) {
const dispatch = function (_req, res) {
res.writeHead(200, { 'Content-Type': 'text/plain' })
res.end('hello')
}
Expand All @@ -18,15 +18,15 @@ test('basic async await', async t => {
})

test('basic async await (errored)', async t => {
const dispatch = function (req, res) {
const dispatch = function (_req, res) {
res.connection.destroy(new Error('kaboom'))
}

await t.assert.rejects(() => inject(dispatch, { method: 'GET', url: 'http://example.com:8080/hello' }), Error)
})

test('chainable api with async await', async t => {
const dispatch = function (req, res) {
const dispatch = function (_req, res) {
res.writeHead(200, { 'Content-Type': 'text/plain' })
res.end('hello')
}
Expand All @@ -41,7 +41,7 @@ test('chainable api with async await', async t => {
})

test('chainable api with async await without end()', async t => {
const dispatch = function (req, res) {
const dispatch = function (_req, res) {
res.writeHead(200, { 'Content-Type': 'text/plain' })
res.end('hello')
}
Expand Down
Loading

0 comments on commit 6d888c8

Please sign in to comment.