Expand setMeta to actually set (with tests) (#318)
This commit is contained in:
@@ -42,4 +42,14 @@ describe('pair', () => {
|
||||
)
|
||||
).toEqual(false);
|
||||
});
|
||||
|
||||
it('allows setting/getting of meta', () => {
|
||||
keyring.bob.setMeta({ foo: 'bar', something: 'else' });
|
||||
|
||||
expect(keyring.bob.getMeta()).toMatchObject({ foo: 'bar', something: 'else' });
|
||||
|
||||
keyring.bob.setMeta({ something: 'thing' });
|
||||
|
||||
expect(keyring.bob.getMeta()).toMatchObject({ foo: 'bar', something: 'thing' });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -91,8 +91,8 @@ export default function createPair (type: KeyringPairType, { publicKey, seed }:
|
||||
},
|
||||
publicKey: (): Uint8Array =>
|
||||
publicKey,
|
||||
setMeta: (_meta: KeyringPair$Meta): void => {
|
||||
meta = meta;
|
||||
setMeta: (additional: KeyringPair$Meta): void => {
|
||||
meta = { ...meta, ...additional };
|
||||
},
|
||||
sign: (message: Uint8Array): Uint8Array =>
|
||||
sign(type, message, { publicKey, secretKey }),
|
||||
|
||||
Reference in New Issue
Block a user