Skip to content

Commit

Permalink
commit 2'
Browse files Browse the repository at this point in the history
  • Loading branch information
rmeena840 committed Oct 10, 2022
1 parent 5fd44ac commit d9fc12a
Show file tree
Hide file tree
Showing 73 changed files with 1,072 additions and 1,072 deletions.
44 changes: 22 additions & 22 deletions examples/dao/test/happy-path.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ describe("DAO - Happy Paths", function () {

describe("Add proposal", function () {
let proposalParams, addProposalTx;
this.beforeEach(() => {
this.beforeEach(function () {
setUpCtx();

proposalParams = [
Expand Down Expand Up @@ -104,7 +104,7 @@ describe("DAO - Happy Paths", function () {
ctx.optInToDAOApp(ctx.proposalLsig.address()); // opt-in
});

it("should save proposal config in proposalLsig for ALGO transfer (type == 1)", () => {
it("should save proposal config in proposalLsig for ALGO transfer (type == 1)", function () {
ctx.executeTx(addProposalTx);
ctx.syncAccounts();

Expand Down Expand Up @@ -153,7 +153,7 @@ describe("DAO - Happy Paths", function () {
assert.deepEqual(ctx.proposalLsigAcc.getLocalState(ctx.daoAppID, "amount"), BigInt(2e6));
});

it("should save proposal config in proposalLsig for ASA transfer (type == 2)", () => {
it("should save proposal config in proposalLsig for ASA transfer (type == 2)", function () {
addProposalTx[0].appArgs = [
...proposalParams.splice(0, 8),
`int:${ProposalType.ASA_TRANSFER}`, // type
Expand Down Expand Up @@ -185,7 +185,7 @@ describe("DAO - Happy Paths", function () {
assert.deepEqual(ctx.proposalLsigAcc.getLocalState(ctx.daoAppID, "amount"), 10n);
});

it("should save proposal config in proposalLsig for message (type == 3)", () => {
it("should save proposal config in proposalLsig for message (type == 3)", function () {
addProposalTx[0].appArgs = [
...proposalParams.splice(0, 8),
`int:${ProposalType.MESSAGE}`, // type
Expand All @@ -202,7 +202,7 @@ describe("DAO - Happy Paths", function () {
});

describe("Deposit Vote Token", function () {
this.beforeAll(() => {
this.beforeAll(function () {
setUpCtx();
ctx.optInToDAOApp(ctx.proposalLsig.address()); // opt-in
ctx.addProposal();
Expand All @@ -224,7 +224,7 @@ describe("DAO - Happy Paths", function () {
ctx.syncAccounts();
};

it("should accept token deposit", () => {
it("should accept token deposit", function () {
const beforeBal = ctx.depositAcc.getAssetHolding(ctx.govTokenID).amount;

_depositVoteToken(ctx.voterA.account, 6);
Expand All @@ -236,7 +236,7 @@ describe("DAO - Happy Paths", function () {
assert.deepEqual(ctx.depositAcc.getAssetHolding(ctx.govTokenID).amount, beforeBal + 6n);
});

it("should accept multiple token deposit by same & different accounts", () => {
it("should accept multiple token deposit by same & different accounts", function () {
const beforeBal = ctx.depositAcc.getAssetHolding(ctx.govTokenID).amount;
const initialADeposit = ctx.voterA.getLocalState(ctx.daoAppID, "deposit");

Expand Down Expand Up @@ -271,7 +271,7 @@ describe("DAO - Happy Paths", function () {
);
});

it('should allow token deposit by any "from" account', () => {
it('should allow token deposit by any "from" account', function () {
const beforeBal = ctx.depositAcc.getAssetHolding(ctx.govTokenID).amount;
const initialADeposit = ctx.voterA.getLocalState(ctx.daoAppID, "deposit");

Expand All @@ -296,7 +296,7 @@ describe("DAO - Happy Paths", function () {

describe("Vote", function () {
let registerVoteParam;
this.beforeEach(() => {
this.beforeEach(function () {
registerVoteParam = {
type: types.TransactionType.CallApp,
sign: types.SignType.SecretKey,
Expand Down Expand Up @@ -328,7 +328,7 @@ describe("DAO - Happy Paths", function () {
);
});

it("should allow voterA to register deposited tokens as votes", () => {
it("should allow voterA to register deposited tokens as votes", function () {
ctx.executeTx(registerVoteParam);
ctx.syncAccounts();

Expand All @@ -344,7 +344,7 @@ describe("DAO - Happy Paths", function () {
assert.equal(ctx.proposalLsigAcc.getLocalState(ctx.daoAppID, "yes"), 6n);
});

it("should allow voterB to register gov tokens as votes after voterA", () => {
it("should allow voterB to register gov tokens as votes after voterA", function () {
const yesVotes = ctx.proposalLsigAcc.getLocalState(ctx.daoAppID, "yes");
const key = new Uint8Array([
...parsing.stringToBytes("p_"),
Expand Down Expand Up @@ -373,7 +373,7 @@ describe("DAO - Happy Paths", function () {
assert.equal(ctx.proposalLsigAcc.getLocalState(ctx.daoAppID, "yes"), yesVotes + 6n + 4n);
});

it("should allow voting if already set proposal_id is different", () => {
it("should allow voting if already set proposal_id is different", function () {
// vote by A
ctx.executeTx(registerVoteParam);
ctx.syncAccounts();
Expand All @@ -392,7 +392,7 @@ describe("DAO - Happy Paths", function () {

describe("Execute", function () {
let executeProposalTx;
this.beforeEach(() => {
this.beforeEach(function () {
ctx.syncAccounts();
executeProposalTx = [
{
Expand Down Expand Up @@ -442,7 +442,7 @@ describe("DAO - Happy Paths", function () {
ctx.runtime.setRoundAndTimestamp(10, votingEnd + 10);
});

it("should execute proposal for type == 1 (ALGO TRANSFER)", () => {
it("should execute proposal for type == 1 (ALGO TRANSFER)", function () {
const beforeProposerBal = ctx.proposer.balance();
ctx.executeTx(executeProposalTx);
ctx.syncAccounts();
Expand All @@ -454,7 +454,7 @@ describe("DAO - Happy Paths", function () {
assert.equal(ctx.proposer.balance(), beforeProposerBal + BigInt(2e6) - 2000n);
});

it("should execute proposal for type == 2 (ASA TRANSFER)", () => {
it("should execute proposal for type == 2 (ASA TRANSFER)", function () {
const config = {
type: BigInt(ProposalType.ASA_TRANSFER),
from: parsing.addressToPk(ctx.daoFundLsig.address()),
Expand Down Expand Up @@ -492,7 +492,7 @@ describe("DAO - Happy Paths", function () {
);
});

it("should execute proposal for type == 3 (MESSAGE)", () => {
it("should execute proposal for type == 3 (MESSAGE)", function () {
const config = {
type: BigInt(ProposalType.MESSAGE),
msg: parsing.stringToBytes("my-message"),
Expand All @@ -514,7 +514,7 @@ describe("DAO - Happy Paths", function () {
assert.equal(ctx.proposalLsigAcc.getLocalState(ctx.daoAppID, "executed"), 1n);
});

it("should allow anyone to execute proposal", () => {
it("should allow anyone to execute proposal", function () {
executeProposalTx[0].fromAccount = ctx.voterA.account;

assert.doesNotThrow(() => ctx.executeTx(executeProposalTx));
Expand All @@ -529,7 +529,7 @@ describe("DAO - Happy Paths", function () {
this.beforeAll(resetCtx);

let withdrawVoteDepositTx;
this.beforeEach(() => {
this.beforeEach(function () {
withdrawVoteDepositTx = mkWithdrawVoteDepositTx(
ctx.daoAppID,
ctx.govTokenID,
Expand All @@ -538,7 +538,7 @@ describe("DAO - Happy Paths", function () {
);
});

it("should allow withdrawal after voting is over", () => {
it("should allow withdrawal after voting is over", function () {
// set current time after voting over
ctx.runtime.setRoundAndTimestamp(10, votingEnd + 10);
ctx.syncAccounts();
Expand Down Expand Up @@ -581,7 +581,7 @@ describe("DAO - Happy Paths", function () {
describe("Clear Vote Record", function () {
this.beforeAll(resetCtx);

it("should clear voting record if proposal is not active", () => {
it("should clear voting record if proposal is not active", function () {
// set current time after voting over
ctx.runtime.setRoundAndTimestamp(10, votingEnd + 10);

Expand Down Expand Up @@ -619,7 +619,7 @@ describe("DAO - Happy Paths", function () {
});

describe("Close Proposal", function () {
this.beforeAll(() => {
this.beforeAll(function () {
// set up context
setUpCtx();

Expand All @@ -632,7 +632,7 @@ describe("DAO - Happy Paths", function () {
ctx.addProposal();
});

it("should close proposal if proposal is recorded & voting is not active", () => {
it("should close proposal if proposal is recorded & voting is not active", function () {
// set current time after executeBefore
ctx.runtime.setRoundAndTimestamp(10, executeBefore + 10);

Expand Down
4 changes: 2 additions & 2 deletions examples/inner-tx-create-assets/test/groupTxn.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe("Group txn", function () {
let runtime;
let creator;
let proxyAppInfo;
this.beforeEach(() => {
this.beforeEach(function () {
runtime = new Runtime([]);
[creator] = runtime.defaultAccounts();
proxyAppInfo = runtime.deployApp(
Expand All @@ -26,7 +26,7 @@ describe("Group txn", function () {
);
});

it("Should create new app and asset from group id", () => {
it("Should create new app and asset from group id", function () {
// first tx in group: deploy new app
// the same code is used for coordinator contract
const createAppTxnParam = {
Expand Down
4 changes: 2 additions & 2 deletions examples/inner-tx-create-assets/test/innerTxn.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe("Group txn", function () {
let runtime;
let creator;
let proxyAppInfo;
this.beforeEach(() => {
this.beforeEach(function () {
runtime = new Runtime([]);
[creator] = runtime.defaultAccounts();
proxyAppInfo = runtime.deployApp(
Expand Down Expand Up @@ -36,7 +36,7 @@ describe("Group txn", function () {
runtime.executeTx([paymentTxnParam]);
});

it("Should create new app and asset from inner txn", () => {
it("Should create new app and asset from inner txn", function () {
// create asset and log new asset id
const masterTxnParam = {
type: types.TransactionType.CallApp,
Expand Down
6 changes: 3 additions & 3 deletions examples/permissioned-token-freezing/test/asset-txfer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ describe("Test for transferring asset using custom logic", function () {
}
}

it("should transfer 1000 Assets from Alice to Bob according to custom logic", () => {
it("should transfer 1000 Assets from Alice to Bob according to custom logic", function () {
/**
* This test demonstrates how to transfer assets from account A to B using custom logic
* based on a smart contract. Asset is actually transferred by the clawback address (an escrow
Expand Down Expand Up @@ -230,7 +230,7 @@ describe("Test for transferring asset using custom logic", function () {
assert.equal(afterBobAssets, prevBobAssets + 1000n); // Bob received 1000 GLD
});

it("should fail on set level if sender is not creator", () => {
it("should fail on set level if sender is not creator", function () {
// opt in to app
runtime.optInToApp(alice.address, applicationId, {}, {});
runtime.optInToApp(bob.address, applicationId, {}, {});
Expand Down Expand Up @@ -263,7 +263,7 @@ describe("Test for transferring asset using custom logic", function () {
}
});

it("should reject transaction if minimum level is not set correctly", () => {
it("should reject transaction if minimum level is not set correctly", function () {
assetId = runtime.deployASA("gold", {
creator: { ...alice.account, name: "alice" },
}).assetIndex;
Expand Down
Loading

0 comments on commit d9fc12a

Please sign in to comment.