Ensure apiAt.<section>.<method>.key(...) passes through the correct arguments (#5283)
This commit is contained in:
@@ -46,6 +46,11 @@ export const NO_RAW_ARGS: RawArgs = {
|
||||
keys: []
|
||||
};
|
||||
|
||||
/** @internal */
|
||||
function filterDefined (a: unknown): boolean {
|
||||
return !isUndefined(a);
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
function assertArgs ({ method, section }: CreateItemFn, { args, keys }: RawArgs): void {
|
||||
if (!Array.isArray(args)) {
|
||||
@@ -112,11 +117,6 @@ export function createKeyRaw (registry: Registry, itemFn: CreateItemBase, args:
|
||||
);
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
function filterDefined (a: unknown): boolean {
|
||||
return !isUndefined(a);
|
||||
}
|
||||
|
||||
/** @internal */
|
||||
function createKey (registry: Registry, itemFn: CreateItemFn, args: RawArgs): Uint8Array {
|
||||
assertArgs(itemFn, args);
|
||||
|
||||
@@ -36,6 +36,10 @@ describe('decorateStorage', (): void => {
|
||||
expect(() => query.timestamp.now()).not.toThrow();
|
||||
});
|
||||
|
||||
it('should return a value if the storage function has the correct arguments', (): void => {
|
||||
expect(() => query.staking.erasStakers(1, keyring.alice.address)).not.toThrow();
|
||||
});
|
||||
|
||||
it('should return the correct length-prefixed storage key', (): void => {
|
||||
expect(
|
||||
u8aToHex(query.system.account(keyring.alice.address))
|
||||
|
||||
Reference in New Issue
Block a user