feat: add decodeUnchecked to borsh-schema.ts (#17620)

This commit is contained in:
Lieu Zheng Hong
2021-06-02 19:43:01 +08:00
committed by GitHub
parent bbcdf073ba
commit d47990e753
2 changed files with 12 additions and 1 deletions

View File

@ -228,4 +228,11 @@ describe('PublicKey', function () {
const decoded = PublicKey.decode(encoded);
expect(decoded.equals(publicKey)).to.be.true;
});
it('canBeDeserializedUncheckedWithBorsh', () => {
const publicKey = Keypair.generate().publicKey;
const encoded = Buffer.concat([publicKey.encode(), new Uint8Array(10)]);
const decoded = PublicKey.decodeUnchecked(encoded);
expect(decoded.equals(publicKey)).to.be.true;
});
});