Skip to content

Commit

Permalink
updating tests to dc-polyfill
Browse files Browse the repository at this point in the history
  • Loading branch information
crysmags committed Feb 22, 2024
1 parent 1ae78df commit 08b3a89
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@
]
},
"dependencies": {
"@fastify/busboy": "^2.0.0"
"@fastify/busboy": "^2.0.0",
"dc-polyfill": "^0.1.3"
}
}
15 changes: 7 additions & 8 deletions test/node-test/diagnostics-channel/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ const { tspl } = require('@matteo.collina/tspl')
const { describe, test, before, after } = require('node:test')
const { fetch } = require('../../..')

let diagnosticsChannel
let dc
let skip = false
try {
diagnosticsChannel = require('node:diagnostics_channel')
dc = require('dc-polyfill')
} catch {
skip = true
}
Expand All @@ -34,8 +34,7 @@ describe('diagnosticsChannel for fetch', { skip }, () => {
t = tspl(t, { plan: 42 })

let startCalled = 0

diagnosticsChannel.channel('undici:fetch:start').subscribe(({ input, init }) => {
dc.channel('tracing:undici:fetch:start').subscribe(({ input, init }) => {
startCalled += 1
if (init.redirect) {
t.strictEqual(input, 'badrequest')
Expand All @@ -47,7 +46,7 @@ describe('diagnosticsChannel for fetch', { skip }, () => {
})

let endCalled = 0
diagnosticsChannel.channel('undici:fetch:end').subscribe(({ input, init, result, error }) => {
dc.channel('tracing:undici:fetch:end').subscribe(({ input, init, result, error }) => {
endCalled += 1
if (init.redirect) {
t.strictEqual(input, 'badrequest')
Expand All @@ -60,7 +59,7 @@ describe('diagnosticsChannel for fetch', { skip }, () => {
})

let asyncStartCalled = 0
diagnosticsChannel.channel('undici:fetch:asyncStart').subscribe(({ input, init, result, error }) => {
dc.channel('tracing:undici:fetch:asyncStart').subscribe(({ input, init, result, error }) => {
asyncStartCalled += 1
if (init.redirect) {
t.strictEqual(input, 'badrequest')
Expand All @@ -73,7 +72,7 @@ describe('diagnosticsChannel for fetch', { skip }, () => {
})

let asyncEndCalled = 0
diagnosticsChannel.channel('undici:fetch:asyncEnd').subscribe(async ({ input, init, result, error }) => {
dc.channel('tracing:undici:fetch:asyncEnd').subscribe(async ({ input, init, result, error }) => {
asyncEndCalled += 1
if (init.redirect) {
t.strictEqual(input, 'badrequest')
Expand All @@ -91,7 +90,7 @@ describe('diagnosticsChannel for fetch', { skip }, () => {
})

let errorCalled = 0
diagnosticsChannel.channel('undici:fetch:error').subscribe(async ({ input, init, error }) => {
dc.channel('tracing:undici:fetch:error').subscribe(async ({ input, init, error }) => {
errorCalled += 1
if (init.redirect) {
t.strictEqual(input, 'badrequest')
Expand Down

0 comments on commit 08b3a89

Please sign in to comment.