Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
adamgall committed Jun 25, 2024
1 parent a1ccd71 commit 62ec3bf
Showing 1 changed file with 55 additions and 11 deletions.
66 changes: 55 additions & 11 deletions test/DecentHats.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ const executeSafeTransaction = async ({
};

describe("DecentHats", () => {
let dao1: SignerWithAddress;
let dao2: SignerWithAddress;
let dao: SignerWithAddress;

let keyValuePairs: KeyValuePairs;
let gnosisSafe: GnosisSafeL2;
Expand All @@ -77,7 +76,7 @@ describe("DecentHats", () => {
beforeEach(async () => {
const signers = await hre.ethers.getSigners();
const [deployer] = signers;
[, dao1, dao2] = signers;
[, dao] = signers;

const hats = await new MockHats__factory(deployer).deploy();
keyValuePairs = await new KeyValuePairs__factory(deployer).deploy();
Expand All @@ -94,7 +93,7 @@ describe("DecentHats", () => {

const createGnosisSetupCalldata =
GnosisSafeL2__factory.createInterface().encodeFunctionData("setup", [
[dao1.address],
[dao.address],
1,
ethers.ZeroAddress,
ethers.ZeroHash,
Expand Down Expand Up @@ -136,7 +135,7 @@ describe("DecentHats", () => {
"enableModule",
[decentHatsAddress]
),
signers: [dao1],
signers: [dao],
});
});

Expand All @@ -160,9 +159,41 @@ describe("DecentHats", () => {
transactionData:
DecentHats__factory.createInterface().encodeFunctionData(
"createAndDeclareTree",
["", ""]
[
"",
"",
{
eligibility: ethers.ZeroAddress,
maxSupply: 1,
toggle: ethers.ZeroAddress,
details: "",
imageURI: "",
isMutable: false,
wearer: ethers.ZeroAddress,
},
[
{
eligibility: ethers.ZeroAddress,
maxSupply: 1,
toggle: ethers.ZeroAddress,
details: "",
imageURI: "",
isMutable: false,
wearer: ethers.ZeroAddress,
},
{
eligibility: ethers.ZeroAddress,
maxSupply: 1,
toggle: ethers.ZeroAddress,
details: "",
imageURI: "",
isMutable: false,
wearer: ethers.ZeroAddress,
},
],
]
),
signers: [dao1],
signers: [dao],
});
});

Expand All @@ -179,7 +210,7 @@ describe("DecentHats", () => {
.withArgs(decentHatsAddress);
});

it("Emits a hatsTreeId ValueUpdated event", async () => {
it("Emits some hatsTreeId ValueUpdated events", async () => {
await expect(createAndDeclareTreeTx)
.to.emit(keyValuePairs, "ValueUpdated")
.withArgs(gnosisSafeAddress, "hatsTreeId", "0");
Expand All @@ -195,9 +226,22 @@ describe("DecentHats", () => {
transactionData:
DecentHats__factory.createInterface().encodeFunctionData(
"createAndDeclareTree",
["", ""]
[
"",
"",
{
eligibility: ethers.ZeroAddress,
maxSupply: 1,
toggle: ethers.ZeroAddress,
details: "",
imageURI: "",
isMutable: false,
wearer: ethers.ZeroAddress,
},
[],
]
),
signers: [dao1],
signers: [dao],
});
});

Expand All @@ -217,7 +261,7 @@ describe("DecentHats", () => {
it("Creates Top Hats with sequential IDs", async () => {
await expect(createAndDeclareTreeTx2)
.to.emit(keyValuePairs, "ValueUpdated")
.withArgs(gnosisSafeAddress, "hatsTreeId", "1");
.withArgs(gnosisSafeAddress, "hatsTreeId", "4");
});
});
});
Expand Down

0 comments on commit 62ec3bf

Please sign in to comment.