diff --git a/packages/w3up-client/test/client.test.js b/packages/w3up-client/test/client.test.js index 90edb8b02..472477dea 100644 --- a/packages/w3up-client/test/client.test.js +++ b/packages/w3up-client/test/client.test.js @@ -22,7 +22,7 @@ import { toCAR } from './helpers/car.js' import { mockService, mockServiceConf } from './helpers/mocks.js' import { File } from './helpers/shims.js' import { Client } from '../src/client.js' -import { validateAuthorization } from './helpers/utils.js' +import { validateAuthorization, setupBlobAddResponse } from './helpers/utils.js' import { getFilecoinOfferResponse } from './helpers/filecoin.js' describe('Client', () => { @@ -43,19 +43,10 @@ describe('Client', () => { assert.equal(invocation.capabilities.length, 1) assert.equal(capability.can, BlobCapabilities.add.can) assert.equal(capability.with, alice.currentSpace()?.did()) - - return { - ok: { - status: 'upload', - headers: { 'x-test': 'true' }, - url: 'http://localhost:9200', - link: /** @type {import('@web3-storage/upload-client/types').CARLink} */ ( - invocation.capabilities[0].nb?.link - ), - with: space.did(), - allocated: capability.nb.size, - }, - } + return setupBlobAddResponse( + { issuer: space, with: space, proofs: [], audience: alice.agent }, + invocation + ) }), }, filecoin: { @@ -112,8 +103,8 @@ describe('Client', () => { }, }) - assert(service.store.add.called) - assert.equal(service.store.add.callCount, 1) + assert(service.blob.add.called) + assert.equal(service.blob.add.callCount, 1) assert(service.upload.add.called) assert.equal(service.upload.add.callCount, 1) @@ -219,8 +210,8 @@ describe('Client', () => { }, }) - assert(service.store.add.called) - assert.equal(service.store.add.callCount, 1) + assert(service.blob.add.called) + assert.equal(service.blob.add.callCount, 1) assert(service.upload.add.called) assert.equal(service.upload.add.callCount, 1) @@ -311,8 +302,8 @@ describe('Client', () => { }, }) - assert(service.store.add.called) - assert.equal(service.store.add.callCount, 1) + assert(service.blob.add.called) + assert.equal(service.blob.add.callCount, 1) assert(service.upload.add.called) assert.equal(service.upload.add.callCount, 1) })