diff --git a/packages/modules/packages/bridge/packages/http/src/spec/HttpBridge.caching.spec.ts b/packages/modules/packages/bridge/packages/http/src/spec/HttpBridge.caching.spec.ts index 49a52ce6b27..a0072fc97e7 100644 --- a/packages/modules/packages/bridge/packages/http/src/spec/HttpBridge.caching.spec.ts +++ b/packages/modules/packages/bridge/packages/http/src/spec/HttpBridge.caching.spec.ts @@ -153,16 +153,19 @@ describe('HttpBridge.caching', () => { for (const command of commands.filter(isQueryBoundWitness)) { // Ensure the query is addressed to the destination const { destination: commandDestination } = command.$meta as { destination?: string[] } - // TODO: Check supported query using index of query => payload_schemas - if (divinerQuery && commandDestination?.includes(destination.address)) { - // Get the associated payloads - const commandPayloads = await PayloadBuilder.toDataHashMap(await commandArchivist.get(command.payload_hashes)) - const query = commandPayloads?.[command.query] as Payload - // If the destination can process this type of query - if (destination.queries.includes(query.schema)) { - // Issue the query against module - response = await destination.query(command, Object.values(commandPayloads)) - expect(response).toBeDefined() + if (commandDestination && commandDestination?.includes(destination.address)) { + // Find the query + const queryIndex = command.payload_hashes.indexOf(command.query) + if (queryIndex !== -1) { + const querySchema = command.payload_schemas[queryIndex] + if (destination.queries.includes(querySchema)) { + // Get the associated payloads + const commandPayloads = await commandArchivist.get(command.payload_hashes) + // If the destination can process this type of query + // Issue the query against module + response = await destination.query(command, commandPayloads) + expect(response).toBeDefined() + } } } }