The TestChaincodeStub implementation of getObjectsByPartialCompositeKeyWithPagination ignores the limit and bookmark properties:
https://github.com/GalaChain/sdk/blob/main/chain-test/src/unit/TestChaincodeStub.ts#L256-L259
getStateByPartialCompositeKeyWithPagination(
indexKey: string,
keyParts: string[]
): Promise<StateQueryResponse<Iterators.StateQueryIterator>> & AsyncIterable<Iterators.KV> {
The above is missing the properties we see here:
https://github.com/GalaChain/sdk/blob/main/chaincode/src/utils/state.ts#L191C1-L206C5
export async function getObjectsByPartialCompositeKeyWithPagination<T extends ChainObject>(
ctx: GalaChainContext,
objectType: string,
attributes: string[],
constructor: ClassConstructor<Inferred<T, ChainObject>>,
bookmark: string | undefined,
limit: number = TOTAL_RESULTS_LIMIT
): Promise<{ results: Array<T>; metadata: QueryResponseMetadata }> {
// Uses default fabric call. No need for cache support, since Fabric disallows
// this call in submit queries.
const response = ctx.stub.getStateByPartialCompositeKeyWithPagination(
objectType,
attributes,
limit,
bookmark
);
When we call getObjectsByPartialCompositeKey using a mocked TestChaincodeStub, we're unable to mock scenarios where certain objects are retrieved (or not) due to limit or bookmark values.
The
TestChaincodeStubimplementation ofgetObjectsByPartialCompositeKeyWithPaginationignores thelimitandbookmarkproperties:https://github.com/GalaChain/sdk/blob/main/chain-test/src/unit/TestChaincodeStub.ts#L256-L259
The above is missing the properties we see here:
https://github.com/GalaChain/sdk/blob/main/chaincode/src/utils/state.ts#L191C1-L206C5
When we call
getObjectsByPartialCompositeKeyusing a mockedTestChaincodeStub, we're unable to mock scenarios where certain objects are retrieved (or not) due tolimitorbookmarkvalues.