Skip to content

Commit

Permalink
Replace deprecated code in tests (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
johnrees authored May 24, 2021
1 parent 2336dcb commit 4932c71
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions tests/multisig.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe("multisig", () => {
const program = anchor.workspace.Multisig;

it("Tests the multisig program", async () => {
const multisig = new anchor.web3.Account();
const multisig = anchor.web3.Keypair.generate();
const [
multisigSigner,
nonce,
Expand All @@ -18,10 +18,10 @@ describe("multisig", () => {
);
const multisigSize = 200; // Big enough.

const ownerA = new anchor.web3.Account();
const ownerB = new anchor.web3.Account();
const ownerC = new anchor.web3.Account();
const ownerD = new anchor.web3.Account();
const ownerA = anchor.web3.Keypair.generate();
const ownerB = anchor.web3.Keypair.generate();
const ownerC = anchor.web3.Keypair.generate();
const ownerD = anchor.web3.Keypair.generate();
const owners = [ownerA.publicKey, ownerB.publicKey, ownerC.publicKey];

const threshold = new anchor.BN(2);
Expand All @@ -40,9 +40,9 @@ describe("multisig", () => {
});

let multisigAccount = await program.account.multisig(multisig.publicKey);
assert.equal(multisigAccount.nonce, nonce);
assert.strictEqual(multisigAccount.nonce, nonce);
assert.ok(multisigAccount.threshold.eq(new anchor.BN(2)));
assert.deepEqual(multisigAccount.owners, owners);
assert.deepStrictEqual(multisigAccount.owners, owners);
assert.ok(multisigAccount.ownerSetSeqno === 0);

const pid = program.programId;
Expand All @@ -63,7 +63,7 @@ describe("multisig", () => {
owners: newOwners,
});

const transaction = new anchor.web3.Account();
const transaction = anchor.web3.Keypair.generate();
const txSize = 1000; // Big enough, cuz I'm lazy.
await program.rpc.createTransaction(pid, accounts, data, {
accounts: {
Expand All @@ -84,10 +84,10 @@ describe("multisig", () => {
const txAccount = await program.account.transaction(transaction.publicKey);

assert.ok(txAccount.programId.equals(pid));
assert.deepEqual(txAccount.accounts, accounts);
assert.deepEqual(txAccount.data, data);
assert.deepStrictEqual(txAccount.accounts, accounts);
assert.deepStrictEqual(txAccount.data, data);
assert.ok(txAccount.multisig.equals(multisig.publicKey));
assert.equal(txAccount.didExecute, false);
assert.deepStrictEqual(txAccount.didExecute, false);
assert.ok(txAccount.ownerSetSeqno === 0);

// Other owner approves transactoin.
Expand Down Expand Up @@ -127,9 +127,9 @@ describe("multisig", () => {

multisigAccount = await program.account.multisig(multisig.publicKey);

assert.equal(multisigAccount.nonce, nonce);
assert.strictEqual(multisigAccount.nonce, nonce);
assert.ok(multisigAccount.threshold.eq(new anchor.BN(2)));
assert.deepEqual(multisigAccount.owners, newOwners);
assert.deepStrictEqual(multisigAccount.owners, newOwners);
assert.ok(multisigAccount.ownerSetSeqno === 1);
});
});

0 comments on commit 4932c71

Please sign in to comment.