diff --git a/packages/w3up-client/src/client.js b/packages/w3up-client/src/client.js index 42b6af9f4..860889742 100644 --- a/packages/w3up-client/src/client.js +++ b/packages/w3up-client/src/client.js @@ -315,12 +315,14 @@ export class Client extends Base { id: { did: () => /** @type {`did:${string}:${string}`} */ ( + /* c8 ignore next - default prod gateway id is not used in tests */ process.env.DEFAULT_GATEWAY_ID ?? 'did:web:w3s.link' ), }, codec: CAR.outbound, channel: HTTP.open({ url: new URL( + /* c8 ignore next - default prod gateway url is not used in tests */ process.env.DEFAULT_GATEWAY_URL ?? 'https://freeway.dag.haus' ), }), diff --git a/packages/w3up-client/test/client.test.js b/packages/w3up-client/test/client.test.js index 198779c59..401267a18 100644 --- a/packages/w3up-client/test/client.test.js +++ b/packages/w3up-client/test/client.test.js @@ -658,7 +658,6 @@ export const testClient = { }, 'should authorize the Storacha Gateway Service when no Gateway Services are provided': async (assert, { mail, grantAccess, connection }) => { - Test // Step 1: Create a client for Alice and login const aliceClient = new Client( await AgentData.create({ diff --git a/packages/w3up-client/test/helpers/gateway-server.js b/packages/w3up-client/test/helpers/gateway-server.js index d5df5b83d..34dd7c814 100644 --- a/packages/w3up-client/test/helpers/gateway-server.js +++ b/packages/w3up-client/test/helpers/gateway-server.js @@ -14,28 +14,29 @@ const server = createServer(async (req, res) => { if (req.method === 'OPTIONS') return res.end() if (req.method === 'POST') { - console.time('Service Setup') const service = getContentServeMockService() const server = createUcantoServer(gateway, service) - console.timeEnd('Service Setup') - console.time('Collect Request Body') const bodyBuffer = Buffer.concat(await collect(req)) - console.timeEnd('Collect Request Body') - console.time('Server Request') + const reqHeaders = /** @type {Record} */ ( + Object.fromEntries(Object.entries(req.headers)) + ) + const { headers, body, status } = await server.request({ body: new Uint8Array( bodyBuffer.buffer, bodyBuffer.byteOffset, bodyBuffer.byteLength ), - headers: /** @type {Record} */ ( - Object.fromEntries(Object.entries(req.headers)) - ), + headers: reqHeaders, }) - console.timeEnd('Server Request') - return new Response(body, { headers, status: status ?? 200 }) + + for (const [key, value] of Object.entries(headers)) { + res.setHeader(key, value) + } + res.writeHead(status ?? 200) + res.end(body) } res.end() }) diff --git a/packages/w3up-client/test/mocks/service.js b/packages/w3up-client/test/mocks/service.js index 0d199d5bf..58d8a2e9f 100644 --- a/packages/w3up-client/test/mocks/service.js +++ b/packages/w3up-client/test/mocks/service.js @@ -13,7 +13,7 @@ export function getContentServeMockService(result = { ok: {} }) { return { access: { delegate: Server.provide(AccessCaps.Access.delegate, async (data) => { - console.log('Access Caps Delegate', data) + // console.log('Access Caps Delegate', data) return result }), },