Skip to content

Commit

Permalink
test: add test to ensure backwards compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
yangli-io committed Feb 17, 2022
1 parent f476158 commit 8260d8d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion web3.js/src/publickey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ export class PublicKey extends Struct {
* Async version of findProgramAddressSync
* For backwards compatibility
*/
static async findProgramAddress(
static async findProgramAddress(
seeds: Array<Buffer | Uint8Array>,
programId: PublicKey,
): Promise<[PublicKey, number]> {
Expand Down
11 changes: 10 additions & 1 deletion web3.js/test/publickey.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,12 @@ describe('PublicKey', function () {
),
).to.be.true;
}

// Should work in promise mode, for backwards compatibility
PublicKey.createProgramAddress(
[Buffer.from('', 'utf8'), Buffer.from([1])],
programId,
).then();
});

it('findProgramAddress', async () => {
Expand All @@ -218,6 +224,9 @@ describe('PublicKey', function () {
),
),
).to.be.true;

// Should work in promise mode, for backwards compatibility
PublicKey.findProgramAddress([Buffer.from('', 'utf8')], programId).then();
});

it('isOnCurve', () => {
Expand Down Expand Up @@ -246,4 +255,4 @@ describe('PublicKey', function () {
const decoded = PublicKey.decodeUnchecked(encoded);
expect(decoded.equals(publicKey)).to.be.true;
});
});
});

0 comments on commit 8260d8d

Please sign in to comment.