diff --git a/packages/eslint-config-w3up/index.js b/packages/eslint-config-w3up/index.js index f96997c3b..c120a791a 100644 --- a/packages/eslint-config-w3up/index.js +++ b/packages/eslint-config-w3up/index.js @@ -1,61 +1,60 @@ 'use strict' module.exports = { - "extends": [ - "eslint:recommended", - "plugin:@typescript-eslint/recommended", - "plugin:jsdoc/recommended", + extends: [ + 'eslint:recommended', + 'plugin:@typescript-eslint/recommended', + 'plugin:jsdoc/recommended', ], rules: { - "@typescript-eslint/no-unused-vars": "off", - "@typescript-eslint/ban-ts-comment": "off", - + '@typescript-eslint/no-unused-vars': 'off', + '@typescript-eslint/ban-ts-comment': 'off', + /** * many of these rules are inherited from hd-scripts. * It may be useful over time to remove these rules * and juse use plugin:jsdoc/recommended defaults. * But that might require updating src. */ - "jsdoc/check-values": "off", - "jsdoc/check-tag-names": "off", - "jsdoc/require-jsdoc": [ - "warn", + 'jsdoc/check-values': 'off', + 'jsdoc/check-tag-names': 'off', + 'jsdoc/require-jsdoc': [ + 'warn', { - "publicOnly": true - } + publicOnly: true, + }, ], - "jsdoc/require-returns": "off", - "jsdoc/require-returns-type": "off", - "jsdoc/require-throws": "off", - "jsdoc/require-yields": "off", - "jsdoc/require-param-description": "off", - "jsdoc/require-property-description": "off", - "jsdoc/require-returns-description": "off", - "jsdoc/valid-types": "off", - "jsdoc/tag-lines": [ - "error", - "any", + 'jsdoc/require-returns': 'off', + 'jsdoc/require-returns-type': 'off', + 'jsdoc/require-throws': 'off', + 'jsdoc/require-yields': 'off', + 'jsdoc/require-param-description': 'off', + 'jsdoc/require-property-description': 'off', + 'jsdoc/require-returns-description': 'off', + 'jsdoc/valid-types': 'off', + 'jsdoc/tag-lines': [ + 'error', + 'any', { - "startLines": 1 - } + startLines: 1, + }, ], - "jsdoc/no-undefined-types": [ - "error", + 'jsdoc/no-undefined-types': [ + 'error', { - "definedTypes": [ - "ArrayLike", - "AsyncIterable", - "AsyncIterableIterator", - "Iterable", - "IterableIterator", - "Generator", - "CryptoKeyPair", - "NodeJS", - "ErrorOptions", - "IDBTransactionMode" - ] - } - ] - - } + definedTypes: [ + 'ArrayLike', + 'AsyncIterable', + 'AsyncIterableIterator', + 'Iterable', + 'IterableIterator', + 'Generator', + 'CryptoKeyPair', + 'NodeJS', + 'ErrorOptions', + 'IDBTransactionMode', + ], + }, + ], + }, } diff --git a/packages/filecoin-api/src/aggregator/api.ts b/packages/filecoin-api/src/aggregator/api.ts index 3c3a587bb..7a6b1ae01 100644 --- a/packages/filecoin-api/src/aggregator/api.ts +++ b/packages/filecoin-api/src/aggregator/api.ts @@ -19,7 +19,11 @@ export type BufferQueue = Queue export type BufferStore = Store export type AggregateStore = Store export type PieceAcceptQueue = Queue -export type InclusionStore = QueryableStore +export type InclusionStore = QueryableStore< + InclusionRecordKey, + InclusionRecord, + InclusionRecordQueryByGroup +> export type AggregateOfferQueue = Queue export interface ServiceContext { diff --git a/packages/filecoin-api/src/aggregator/buffer-reducing.js b/packages/filecoin-api/src/aggregator/buffer-reducing.js index 7bb792fe9..e7de30d45 100644 --- a/packages/filecoin-api/src/aggregator/buffer-reducing.js +++ b/packages/filecoin-api/src/aggregator/buffer-reducing.js @@ -45,7 +45,9 @@ export async function handleBufferReducingWithAggregate({ pieces: aggregateInfo.addedBufferedPieces, group, } - const piecesBlock = await CBOR.write(aggregateInfo.addedBufferedPieces.map(bf => bf.piece)) + const piecesBlock = await CBOR.write( + aggregateInfo.addedBufferedPieces.map((bf) => bf.piece) + ) const aggregateBlock = await CBOR.write(aggregateReducedBuffer) // Store buffered pieces for aggregate diff --git a/packages/filecoin-api/src/aggregator/service.js b/packages/filecoin-api/src/aggregator/service.js index 78a4e3112..0e3eab520 100644 --- a/packages/filecoin-api/src/aggregator/service.js +++ b/packages/filecoin-api/src/aggregator/service.js @@ -77,7 +77,7 @@ export const pieceAccept = async ({ capability }, context) => { } } - // Get buffered pieces + // Get buffered pieces const [{ aggregate, inclusion }] = getInclusionRes.ok const getAggregateRes = await context.aggregateStore.get({ aggregate }) if (getAggregateRes.error) { diff --git a/packages/filecoin-api/src/deal-tracker/api.ts b/packages/filecoin-api/src/deal-tracker/api.ts index 810c72bb4..db7f0495c 100644 --- a/packages/filecoin-api/src/deal-tracker/api.ts +++ b/packages/filecoin-api/src/deal-tracker/api.ts @@ -2,7 +2,11 @@ import type { Signer } from '@ucanto/interface' import { PieceLink } from '@web3-storage/data-segment' import { QueryableStore } from '../types.js' -export type DealStore = QueryableStore +export type DealStore = QueryableStore< + DealRecordKey, + DealRecord, + DealRecordQueryByPiece +> export interface ServiceContext { /** diff --git a/packages/filecoin-api/src/dealer/api.ts b/packages/filecoin-api/src/dealer/api.ts index 6bcc6c3f3..f350e165c 100644 --- a/packages/filecoin-api/src/dealer/api.ts +++ b/packages/filecoin-api/src/dealer/api.ts @@ -44,7 +44,8 @@ export interface AggregateUpdatedStatusEventContext { dealerService: ServiceConfig } -export interface CronContext extends Pick {} +export interface CronContext + extends Pick {} export interface AggregateRecord { /** diff --git a/packages/filecoin-api/src/dealer/events.js b/packages/filecoin-api/src/dealer/events.js index c035a9123..e18a47fd5 100644 --- a/packages/filecoin-api/src/dealer/events.js +++ b/packages/filecoin-api/src/dealer/events.js @@ -141,7 +141,7 @@ async function updateApprovedDeals({ { aggregate: deal.aggregate }, { status: 'accepted', - updatedAt: new Date().toISOString() + updatedAt: new Date().toISOString(), } ) diff --git a/packages/filecoin-api/src/dealer/service.js b/packages/filecoin-api/src/dealer/service.js index b5ab32426..882bf7343 100644 --- a/packages/filecoin-api/src/dealer/service.js +++ b/packages/filecoin-api/src/dealer/service.js @@ -8,10 +8,7 @@ import * as DealerCaps from '@web3-storage/capabilities/filecoin/dealer' import { DealTracker } from '@web3-storage/filecoin-client' // eslint-disable-next-line no-unused-vars import * as API from '../types.js' -import { - StoreOperationFailed, - DecodeBlockOperationFailed, -} from '../errors.js' +import { StoreOperationFailed, DecodeBlockOperationFailed } from '../errors.js' /** * @param {API.Input} input @@ -112,17 +109,19 @@ export const aggregateAccept = async ({ capability }, context) => { const deals = Object.keys(info.out.ok.deals || {}) if (!deals.length) { return { - error: new Server.Failure('no deals were obtained for given aggregate CID') + error: new Server.Failure( + 'no deals were obtained for given aggregate CID' + ), } } - + // For receipts, we only care about first deal // TODO: We need to revisit this with renewals const deal = { dataType: 0n, dataSource: { - dealID: BigInt(deals[0]) - } + dealID: BigInt(deals[0]), + }, } return { diff --git a/packages/filecoin-api/src/storefront/api.ts b/packages/filecoin-api/src/storefront/api.ts index 4a06ed0de..3ffd7da56 100644 --- a/packages/filecoin-api/src/storefront/api.ts +++ b/packages/filecoin-api/src/storefront/api.ts @@ -18,7 +18,11 @@ import { ServiceConfig, } from '../types.js' -export type PieceStore = UpdatableAndQueryableStore> +export type PieceStore = UpdatableAndQueryableStore< + PieceRecordKey, + PieceRecord, + Pick +> export type FilecoinSubmitQueue = Queue export type PieceOfferQueue = Queue export type TaskStore = Store diff --git a/packages/filecoin-api/src/storefront/events.js b/packages/filecoin-api/src/storefront/events.js index 8b2981bbd..a74eaeeaf 100644 --- a/packages/filecoin-api/src/storefront/events.js +++ b/packages/filecoin-api/src/storefront/events.js @@ -29,7 +29,7 @@ export const handleFilecoinSubmitMessage = async (context, message) => { } if (hasRes.ok) { return { - ok: {} + ok: {}, } } diff --git a/packages/filecoin-api/src/storefront/service.js b/packages/filecoin-api/src/storefront/service.js index 42c25c1cd..8d756c7ab 100644 --- a/packages/filecoin-api/src/storefront/service.js +++ b/packages/filecoin-api/src/storefront/service.js @@ -5,10 +5,7 @@ import * as StorefrontCaps from '@web3-storage/capabilities/filecoin/storefront' import * as AggregatorCaps from '@web3-storage/capabilities/filecoin/aggregator' // eslint-disable-next-line no-unused-vars import * as API from '../types.js' -import { - QueueOperationFailed, - StoreOperationFailed, -} from '../errors.js' +import { QueueOperationFailed, StoreOperationFailed } from '../errors.js' /** * @param {API.Input} input diff --git a/packages/filecoin-api/test/aggregator.spec.js b/packages/filecoin-api/test/aggregator.spec.js index 2c9838707..a496bb4ad 100644 --- a/packages/filecoin-api/test/aggregator.spec.js +++ b/packages/filecoin-api/test/aggregator.spec.js @@ -25,15 +25,9 @@ describe('Aggregator', () => { // resources /** @type {Map} */ const queuedMessages = new Map() + const { pieceQueue } = getQueues(queuedMessages) const { - pieceQueue, - } = getQueues(queuedMessages) - const { - aggregator: { - pieceStore, - aggregateStore, - inclusionStore, - }, + aggregator: { pieceStore, aggregateStore, inclusionStore }, } = getStoreImplementations() await test( @@ -55,7 +49,7 @@ describe('Aggregator', () => { inclusionStore, pieceQueue, queuedMessages, - validateAuthorization + validateAuthorization, } ) }) @@ -138,7 +132,7 @@ describe('Aggregator', () => { minAggregateSize: 2 ** 34, minUtilizationFactor: 4, }, - validateAuthorization + validateAuthorization, } ) }) diff --git a/packages/filecoin-api/test/context/queue-implementations.js b/packages/filecoin-api/test/context/queue-implementations.js index 2785a2210..7064f0114 100644 --- a/packages/filecoin-api/test/context/queue-implementations.js +++ b/packages/filecoin-api/test/context/queue-implementations.js @@ -1,7 +1,7 @@ import { Queue } from './queue.js' /** - * @param {Map} queuedMessages + * @param {Map} queuedMessages */ export const getQueueImplementations = ( queuedMessages, @@ -26,7 +26,7 @@ export const getQueueImplementations = ( return { storefront: { filecoinSubmitQueue, - pieceOfferQueue - } + pieceOfferQueue, + }, } } diff --git a/packages/filecoin-api/test/context/service.js b/packages/filecoin-api/test/context/service.js index 1c4c089c3..e614af6da 100644 --- a/packages/filecoin-api/test/context/service.js +++ b/packages/filecoin-api/test/context/service.js @@ -227,7 +227,7 @@ export function getConnection(id, service) { id: id, service, codec: CAR.inbound, - validateAuthorization + validateAuthorization, }) const connection = Client.connect({ id: id, diff --git a/packages/filecoin-api/test/context/store-implementations.js b/packages/filecoin-api/test/context/store-implementations.js index 5c47f336e..2225543f5 100644 --- a/packages/filecoin-api/test/context/store-implementations.js +++ b/packages/filecoin-api/test/context/store-implementations.js @@ -170,15 +170,18 @@ export const getStoreImplementations = ( /** @type {Set} */ items, /** @type {Partial} */ search ) => { - return Array.from(items).filter((i) => i.status === search.status || i.aggregate.equals(search.aggregate)) + return Array.from(items).filter( + (i) => + i.status === search.status || i.aggregate.equals(search.aggregate) + ) }, updateFn: ( /** @type {Set} */ items, /** @type {DealerAggregateRecordKey} */ key, /** @type {Partial} */ item ) => { - const itemToUpdate = Array.from(items).find( - (i) => i.aggregate.equals(key.aggregate) + const itemToUpdate = Array.from(items).find((i) => + i.aggregate.equals(key.aggregate) ) if (!itemToUpdate) { throw new Error('not found') diff --git a/packages/filecoin-api/test/deal-tracker.spec.js b/packages/filecoin-api/test/deal-tracker.spec.js index 17ca68120..f3c10e26d 100644 --- a/packages/filecoin-api/test/deal-tracker.spec.js +++ b/packages/filecoin-api/test/deal-tracker.spec.js @@ -43,7 +43,7 @@ describe('deal-tracker', () => { assert.fail(error) }, }, - validateAuthorization + validateAuthorization, } ) }) diff --git a/packages/filecoin-api/test/dealer.spec.js b/packages/filecoin-api/test/dealer.spec.js index cf2804800..30ffb77d5 100644 --- a/packages/filecoin-api/test/dealer.spec.js +++ b/packages/filecoin-api/test/dealer.spec.js @@ -57,7 +57,7 @@ describe('Dealer', () => { audience: dealTrackerSigner, }, }, - validateAuthorization + validateAuthorization, } ) }) @@ -122,7 +122,7 @@ describe('Dealer', () => { }, }, service, - validateAuthorization + validateAuthorization, } ) }) diff --git a/packages/filecoin-api/test/events/aggregator.js b/packages/filecoin-api/test/events/aggregator.js index bba0a694d..04ca2ec0d 100644 --- a/packages/filecoin-api/test/events/aggregator.js +++ b/packages/filecoin-api/test/events/aggregator.js @@ -681,8 +681,14 @@ export const test = { if (!inclusionProof.ok) { throw new Error() } - assert.deepEqual(BigInt(message.inclusion.subtree[0]), inclusionProof.ok?.[0][0]) - assert.deepEqual(BigInt(message.inclusion.index[0]), inclusionProof.ok?.[1][0]) + assert.deepEqual( + BigInt(message.inclusion.subtree[0]), + inclusionProof.ok?.[0][0] + ) + assert.deepEqual( + BigInt(message.inclusion.index[0]), + inclusionProof.ok?.[1][0] + ) assert.deepEqual(message.inclusion.subtree[1], inclusionProof.ok?.[0][1]) assert.deepEqual(message.inclusion.index[1], inclusionProof.ok?.[1][1]) @@ -755,7 +761,7 @@ export const test = { } const block = await CBOR.write(buffer) const piecesBlock = await CBOR.write(pieces.map((p) => p.link)) - + // Put buffer record const putBufferRes = await context.bufferStore.put({ buffer, @@ -835,14 +841,26 @@ export const test = { assert.ok(hasStoredInclusion.ok?.piece.equals(piece)) assert.equal(hasStoredInclusion.ok?.group, group) assert.ok(hasStoredInclusion.ok?.insertedAt) - // @ts-ignore - assert.deepEqual(BigInt(message.inclusion.subtree[0]), BigInt(hasStoredInclusion.ok?.inclusion.subtree[0])) - // @ts-ignore - assert.deepEqual(BigInt(message.inclusion.index[0]), BigInt(hasStoredInclusion.ok?.inclusion.index[0])) - // @ts-ignore - assert.deepEqual(message.inclusion.subtree[1], hasStoredInclusion.ok?.inclusion.subtree[1]) - // @ts-ignore - assert.deepEqual(message.inclusion.index[1], hasStoredInclusion.ok?.inclusion.index[1]) + assert.deepEqual( + BigInt(message.inclusion.subtree[0]), + // @ts-ignore + BigInt(hasStoredInclusion.ok?.inclusion.subtree[0]) + ) + assert.deepEqual( + BigInt(message.inclusion.index[0]), + // @ts-ignore + BigInt(hasStoredInclusion.ok?.inclusion.index[0]) + ) + assert.deepEqual( + message.inclusion.subtree[1], + // @ts-ignore + hasStoredInclusion.ok?.inclusion.subtree[1] + ) + assert.deepEqual( + message.inclusion.index[1], + // @ts-ignore + hasStoredInclusion.ok?.inclusion.index[1] + ) }, 'handles piece accept message errors when fails to store on inclusion store': wichMockableContext( diff --git a/packages/filecoin-api/test/events/dealer.js b/packages/filecoin-api/test/events/dealer.js index f176ef807..8874b4b91 100644 --- a/packages/filecoin-api/test/events/dealer.js +++ b/packages/filecoin-api/test/events/dealer.js @@ -246,7 +246,7 @@ export const test = { // Validate stores const storedDealAfterCron = await context.aggregateStore.get({ - aggregate: aggregate.link.link() + aggregate: aggregate.link.link(), }) assert.ok(storedDealAfterCron.ok) assert.equal(storedDealAfterCron.ok?.status, 'accepted') diff --git a/packages/filecoin-api/test/lib.js b/packages/filecoin-api/test/lib.js index 42b46553f..a7ad52c2f 100644 --- a/packages/filecoin-api/test/lib.js +++ b/packages/filecoin-api/test/lib.js @@ -15,21 +15,21 @@ export const test = { ...StorefrontService.test, }, aggregator: { - ...AggregatorService.test + ...AggregatorService.test, }, dealer: { ...DealerService.test, }, dealTracker: { - ...DealTrackerService.test - } + ...DealTrackerService.test, + }, }, events: { storefront: { ...StorefrontEvents.test, }, aggregator: { - ...AggregatorEvents.test + ...AggregatorEvents.test, }, dealer: { ...DealerEvents.test, diff --git a/packages/filecoin-api/test/services/aggregator.js b/packages/filecoin-api/test/services/aggregator.js index b15e4cf6a..6160e7e26 100644 --- a/packages/filecoin-api/test/services/aggregator.js +++ b/packages/filecoin-api/test/services/aggregator.js @@ -286,7 +286,7 @@ export const test = { piece, group, }, - expiration: Infinity + expiration: Infinity, }) const response = await pieceAcceptInv.execute(connection) @@ -318,7 +318,7 @@ export const test = { aggregate: aggregate.link, pieces: piecesBlock.cid, }, - expiration: Infinity + expiration: Infinity, }) .delegate() assert.ok(response.fx.join) diff --git a/packages/filecoin-api/test/services/dealer.js b/packages/filecoin-api/test/services/dealer.js index 395824e02..1f218040a 100644 --- a/packages/filecoin-api/test/services/dealer.js +++ b/packages/filecoin-api/test/services/dealer.js @@ -218,71 +218,70 @@ export const test = { ) assert.equal(BigInt(response.out.ok.dataType), BigInt(deal.dataType)) }, - 'aggregate/accept fails if not able to invoke deal info': - withMockableContext( - async (assert, context) => { - const { storefront } = await getServiceContext() - const connection = connect({ - id: context.id, - channel: createServer(context), - }) - - // Generate piece for test - const { pieces, aggregate } = await randomAggregate(100, 128) - const offer = pieces.map((p) => p.link) - const piecesBlock = await CBOR.write(offer) + 'aggregate/accept fails if not able to invoke deal info': withMockableContext( + async (assert, context) => { + const { storefront } = await getServiceContext() + const connection = connect({ + id: context.id, + channel: createServer(context), + }) - // aggregator invocation - const pieceAddInv = Dealer.aggregateAccept.invoke({ - issuer: storefront, - audience: connection.id, - with: storefront.did(), - nb: { - aggregate: aggregate.link, - pieces: piecesBlock.cid, - }, - }) - pieceAddInv.attach(piecesBlock) + // Generate piece for test + const { pieces, aggregate } = await randomAggregate(100, 128) + const offer = pieces.map((p) => p.link) + const piecesBlock = await CBOR.write(offer) - const response = await pieceAddInv.execute(connection) - assert.ok(response.out.error) - }, - async (context) => { - /** - * Mock deal tracker to fail - */ - const dealTrackerSigner = await Signer.generate() - const service = mockService({ - deal: { - info: Server.provideAdvanced({ - capability: DealTrackerCaps.dealInfo, - handler: async ({ invocation, context }) => { - return { - error: new Server.Failure(), - } - }, - }), - }, - }) - const dealTrackerConnection = getConnection( - dealTrackerSigner, - service - ).connection + // aggregator invocation + const pieceAddInv = Dealer.aggregateAccept.invoke({ + issuer: storefront, + audience: connection.id, + with: storefront.did(), + nb: { + aggregate: aggregate.link, + pieces: piecesBlock.cid, + }, + }) + pieceAddInv.attach(piecesBlock) - return { - ...context, - service, - dealTrackerService: { - connection: dealTrackerConnection, - invocationConfig: { - issuer: context.id, - with: context.id.did(), - audience: dealTrackerSigner, + const response = await pieceAddInv.execute(connection) + assert.ok(response.out.error) + }, + async (context) => { + /** + * Mock deal tracker to fail + */ + const dealTrackerSigner = await Signer.generate() + const service = mockService({ + deal: { + info: Server.provideAdvanced({ + capability: DealTrackerCaps.dealInfo, + handler: async ({ invocation, context }) => { + return { + error: new Server.Failure(), + } }, + }), + }, + }) + const dealTrackerConnection = getConnection( + dealTrackerSigner, + service + ).connection + + return { + ...context, + service, + dealTrackerService: { + connection: dealTrackerConnection, + invocationConfig: { + issuer: context.id, + with: context.id.did(), + audience: dealTrackerSigner, }, - } + }, } - ), + } + ), } async function getServiceContext() { diff --git a/packages/filecoin-api/test/storefront.spec.js b/packages/filecoin-api/test/storefront.spec.js index e5e76084d..8bd534a00 100644 --- a/packages/filecoin-api/test/storefront.spec.js +++ b/packages/filecoin-api/test/storefront.spec.js @@ -4,7 +4,12 @@ import * as Signer from '@ucanto/principal/ed25519' import * as StorefrontService from './services/storefront.js' import * as StorefrontEvents from './events/storefront.js' -import { getMockService, getConnection, getStoreImplementations, getQueueImplementations } from './context/service.js' +import { + getMockService, + getConnection, + getStoreImplementations, + getQueueImplementations, +} from './context/service.js' import { validateAuthorization } from './utils.js' describe('storefront', () => { @@ -24,7 +29,7 @@ describe('storefront', () => { /** @type {Map} */ const queuedMessages = new Map() const { - storefront: { filecoinSubmitQueue, pieceOfferQueue } + storefront: { filecoinSubmitQueue, pieceOfferQueue }, } = getQueueImplementations(queuedMessages) const { storefront: { pieceStore, receiptStore, taskStore }, @@ -50,7 +55,7 @@ describe('storefront', () => { taskStore, receiptStore, queuedMessages, - validateAuthorization + validateAuthorization, } ) }) @@ -119,7 +124,7 @@ describe('storefront', () => { assert.fail(error) }, }, - validateAuthorization + validateAuthorization, } ) }) diff --git a/packages/upload-api/src/provider-add.js b/packages/upload-api/src/provider-add.js index fa2f44d05..1a42dd44d 100644 --- a/packages/upload-api/src/provider-add.js +++ b/packages/upload-api/src/provider-add.js @@ -17,7 +17,12 @@ export const provide = (ctx) => */ export const add = async ( { capability, invocation }, - { provisionsStorage: provisions, rateLimitsStorage: rateLimits, plansStorage, requirePaymentPlan } + { + provisionsStorage: provisions, + rateLimitsStorage: rateLimits, + plansStorage, + requirePaymentPlan, + } ) => { const { nb: { consumer, provider }, diff --git a/packages/upload-api/test/handlers/provider-add.spec.js b/packages/upload-api/test/handlers/provider-add.spec.js index b08038897..1ede178b6 100644 --- a/packages/upload-api/test/handlers/provider-add.spec.js +++ b/packages/upload-api/test/handlers/provider-add.spec.js @@ -260,7 +260,7 @@ describe(`provider/add`, () => { it('provider/add fails if plans are required and a plan has not been configured', async () => { const { space, agent, account, ...context } = await setup({ - requirePaymentPlan: true + requirePaymentPlan: true, }) const { service } = context @@ -280,8 +280,14 @@ describe(`provider/add`, () => { }) .execute(context.connection) - assert.ok(addResult.out.error, 'Expected error provisioning without adding a plan') - assert.equal(addResult.out.error.message, `Account identified by ${account.did()} has not selected a payment plan`) + assert.ok( + addResult.out.error, + 'Expected error provisioning without adding a plan' + ) + assert.equal( + addResult.out.error.message, + `Account identified by ${account.did()} has not selected a payment plan` + ) } finally { cleanupContext(context) } diff --git a/packages/upload-api/test/helpers/context.js b/packages/upload-api/test/helpers/context.js index d6e3e59da..acefa960b 100644 --- a/packages/upload-api/test/helpers/context.js +++ b/packages/upload-api/test/helpers/context.js @@ -28,7 +28,9 @@ import { UsageStorage } from '../storage/usage-storage.js' * @param {{fail(error:unknown): unknown}} [options.assert] * @returns {Promise} */ -export const createContext = async (options = { requirePaymentPlan: false }) => { +export const createContext = async ( + options = { requirePaymentPlan: false } +) => { const requirePaymentPlan = options.requirePaymentPlan const storeTable = new StoreTable() const uploadTable = new UploadTable()