Skip to content

Commit

Permalink
failing tests for new implementation of add-program
Browse files Browse the repository at this point in the history
  • Loading branch information
plaintextpaco committed Nov 14, 2022
1 parent d533d3c commit b3e2776
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 4 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@
"@ethersproject/wallet": "5.7.0",
"@openzeppelin/contracts": "4.6.0",
"@rari-capital/solmate": "6.4.0",
"@types/chai-as-promised": "^7.1.5",
"@uniswap/lib": "https://github.com/Uniswap/solidity-lib",
"@uniswap/v2-periphery": "https://github.com/Uniswap/v2-periphery",
"alchemist": "https://github.com/itirabasso/alchemist",
"chai-as-promised": "^7.1.1",
"ds-auth": "https://github.com/dapphub/ds-auth",
"ds-math": "https://github.com/dapphub/ds-math",
"ds-test": "https://github.com/dapphub/ds-test",
Expand Down
39 changes: 36 additions & 3 deletions test/deployments.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { expect } from "chai";
import chai, { expect } from "chai";
import { AbiCoder } from "ethers/lib/utils";
import { deployments, ethers, run } from "hardhat";
import {
Expand All @@ -10,7 +10,9 @@ import {
RewardPoolFactory,
} from "../typechain-types";
import { GEYSER_V2_VANITY_ADDRESS } from "../constants";
import chaiAsPromised from "chai-as-promised";
import { DAYS } from "./utils";
chai.use(chaiAsPromised);

describe("Aludel factory deployments", function () {
describe("WHEN deploying a template set", () => {
Expand Down Expand Up @@ -58,22 +60,53 @@ describe("Aludel factory deployments", function () {
);
preexistingProgram = (await ethersFactory.deploy()) as Aludel;
});

describe("WHEN adding it with the add-program task, AND passing al parameters", () => {
beforeEach(async () => {
await run("add-program", {
aludelFactory: factory.address,
program: preexistingProgram.address,
template: GEYSER_V2_VANITY_ADDRESS,
name: "some name",
stakingTokenUrl: "http://buy.here",
startTime: "69",
startTime: 69,
});
});
it("THEN it is listed", async () => {
const program = await factory.programs(preexistingProgram.address);
expect(program.name).to.eq("some name");
});
});

it("WHEN adding it with the add-program task, AND omitting the template THEN it fails because the template is not optional", async () => {
await expect(
run("add-program", {
program: preexistingProgram.address,
name: "some name",
stakingTokenUrl: "http://buy.here",
startTime: 69,
})
).to.be.rejectedWith(
"HH306: The 'template' parameter expects a value, but none was passed"
);
});

describe("WHEN adding it with the add-program task, AND omitting the startTime", () => {
beforeEach(async () => {
await run("add-program", {
program: preexistingProgram.address,
template: GEYSER_V2_VANITY_ADDRESS,
name: "some name",
stakingTokenUrl: "http://buy.here",
});
});
it("THEN the current timestamp is used", async () => {
const program = await factory.programs(preexistingProgram.address);
const currentTime = Date.now() / 1000;
// we're going to have bigger problems on the epochalipse
expect(program.startTime.toNumber()).to.be.lt(currentTime);
expect(program.startTime.toNumber()).to.be.gt(currentTime - 20);
});
});
});

describe("GIVEN a PowerSwitchFactory, a CrucibleFactory, a RewardPoolFactory, and some other stuff", () => {
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1326,7 +1326,7 @@
"@types/node" "*"
"@types/responselike" "*"

"@types/chai-as-promised@^7.1.3":
"@types/chai-as-promised@^7.1.3", "@types/chai-as-promised@^7.1.5":
version "7.1.5"
resolved "https://registry.yarnpkg.com/@types/chai-as-promised/-/chai-as-promised-7.1.5.tgz#6e016811f6c7a64f2eed823191c3a6955094e255"
integrity sha512-jStwss93SITGBwt/niYrkf2C+/1KTeZCZl1LaeezTlqppAKeoQC7jxyqYuP72sxBGKCIbw7oHgbYssIRzT5FCQ==
Expand Down

0 comments on commit b3e2776

Please sign in to comment.