update signature of doublemap storage function, add e2e test cases (#957)

* update signature of doublemap storage function

* add test cases

* update doublemap implementation

* update implementation

* remove duplicate test case

* update test cases
This commit is contained in:
Alex Wang
2019-06-12 16:45:45 +12:00
committed by Ian He
parent 51ed24bf5e
commit 249c120e42
7 changed files with 241 additions and 44 deletions
@@ -79,7 +79,7 @@ describe('createFunction', () => {
it('should return correct key', () => {
const result = storageFn(['5DXUeE5N5LtkW97F2PzqYPyqNkxqSWESdGSPTX6AvkUAhwKP', '5DXUeE5N5LtkW97F2PzqYPyqNkxqSWESdGSPTX6AvkUAhwKP']);
expect(u8aToHex(result)).toEqual('0x00fa40e72d7173e69ee54b980345ea01cb81e64258502e0247af4303dee91ec0aec2ecd3a60ab080cff7b52a8f6d543b');
expect(u8aToHex(result)).toEqual('0xc000fa40e72d7173e69ee54b980345ea01cb81e64258502e0247af4303dee91ec0aec2ecd3a60ab080cff7b52a8f6d543b');
});
it('needs two arguments', () => {
@@ -58,7 +58,7 @@ export default function createFunction (section: Text | string, method: Text | s
const param1Hashed = hasher(param1Encoded);
const param2Hashed = key2Hasher(createType(type2, arg[1]).toU8a(true));
return u8aConcat(param1Hashed, param2Hashed);
return Compact.addLengthPrefix(u8aConcat(param1Hashed, param2Hashed));
}
if (meta.type.isMap) {