Skip to content

Commit

Permalink
test: re-enable some skipped integration tests
Browse files Browse the repository at this point in the history
The execution tests and some harder problems remain skipped but the
broad basic integration tests are re-enabled including:

* library
* module params
* static calls
* useModule
* contract
  • Loading branch information
kanej committed Aug 28, 2023
1 parent a3c4cfa commit 62a4d73
Show file tree
Hide file tree
Showing 21 changed files with 43 additions and 42 deletions.
5 changes: 1 addition & 4 deletions packages/hardhat-plugin/test/calls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { assert } from "chai";

import { useEphemeralIgnitionProject } from "./use-ignition-project";

// eslint-disable-next-line no-only-tests/no-only-tests
describe.only("calls", () => {
describe("calls", () => {
useEphemeralIgnitionProject("minimal-new-api");

it("should be able to call contracts", async function () {
Expand Down Expand Up @@ -173,6 +172,4 @@ describe.only("calls", () => {
);
});
});

it("should note fail if call fails");
});
3 changes: 1 addition & 2 deletions packages/hardhat-plugin/test/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import { assert } from "chai";
import { KeyListOf } from "./type-helper";
import { useEphemeralIgnitionProject } from "./use-ignition-project";

// eslint-disable-next-line no-only-tests/no-only-tests
describe.only("config", () => {
describe("config", () => {
describe("loading", () => {
useEphemeralIgnitionProject("with-config");

Expand Down
3 changes: 1 addition & 2 deletions packages/hardhat-plugin/test/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { assert } from "chai";

import { useEphemeralIgnitionProject } from "./use-ignition-project";

// eslint-disable-next-line no-only-tests/no-only-tests
describe.only("contract deploys", () => {
describe("contract deploys", () => {
useEphemeralIgnitionProject("minimal-new-api");

it("should be able to deploy a contract", async function () {
Expand Down
4 changes: 2 additions & 2 deletions packages/hardhat-plugin/test/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { useEphemeralIgnitionProject } from "./use-ignition-project";
describe("events", () => {
useEphemeralIgnitionProject("minimal-new-api");

it("should be able to use the output of a readEvent in a contract at", async function () {
it.skip("should be able to use the output of a readEvent in a contract at", async function () {
const moduleDefinition = buildModule("FooModule", (m) => {
const account1 = m.getAccount(1);

Expand All @@ -32,7 +32,7 @@ describe("events", () => {
assert.equal(await result.foo.x(), Number(1));
});

it("should be able to use the output of a readEvent in an artifact contract at", async function () {
it.skip("should be able to use the output of a readEvent in an artifact contract at", async function () {
const artifact = await this.hre.artifacts.readArtifact("Foo");

const moduleDefinition = buildModule("FooModule", (m) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
* First deploy a working contract, then reuse it from a subsequent module
* with a passed in artifact.
*/
describe("execution - deploy contractAt from artifact", function () {
describe.skip("execution - deploy contractAt from artifact", function () {
// TODO: rename back to minimal api once execution switched over
useEphemeralIgnitionProject("minimal-new-api");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ describe("execution - deploy contract at", function () {
// TODO: rename back to minimal api once execution switched over
useEphemeralIgnitionProject("minimal-new-api");

it("should deploy a contract that is callable", async function () {
it.skip("should deploy a contract that is callable", async function () {
const moduleDefinition = buildModule("FooModule", (m) => {
const foo = m.contract("Foo");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ describe("execution - error on pending user transactions", () => {
"error-on-rerun-with-replaced-pending-user-transaction"
);

it("should error if a transaction is in flight for an account used in the deploy", async function () {
it.skip("should error if a transaction is in flight for an account used in the deploy", async function () {
// Setup a module with a contract deploy on accounts[2]
const moduleDefinition = buildModule("FooModule", (m) => {
const account2 = m.getAccount(2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe("execution - error on rerun with replaced pending user transaction", ()
"error-on-rerun-with-replaced-pending-user-transaction"
);

it("should error on the second run", async function () {
it.skip("should error on the second run", async function () {
const moduleDefinition = buildModule("FooModule", (m) => {
const account2 = m.getAccount(2);

Expand Down Expand Up @@ -55,7 +55,7 @@ describe("execution - error on rerun with replaced pending user transaction", ()
const [, , signer2] = await this.hre.ethers.getSigners();
const FooFactory = await this.hre.ethers.getContractFactory("Foo");
FooFactory.connect(signer2).deploy({
gasPrice: this.hre.ethers.utils.parseUnits("500", "gwei"),
gasPrice: this.hre.ethers.parseUnits("500", "gwei"),
nonce: 2, // same nonce as foo3
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
describe("execution - error on transaction dropped", () => {
useFileIgnitionProject("minimal-new-api", "error-on-transaction-dropped");

it("should error on the drop being detected", async function () {
it.skip("should error on the drop being detected", async function () {
// Setup a module with two contract deploys (foo1 and foo2) over 2 batches
const moduleDefinition = buildModule("FooModule", (m) => {
const account2 = m.getAccount(2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
describe("execution - error on user transaction sent", () => {
useFileIgnitionProject("minimal-new-api", "error-on-user-transaction-sent");

it("should error on the drop being detected", async function () {
it.skip("should error on the drop being detected", async function () {
const moduleDefinition = buildModule("FooModule", (m) => {
const account2 = m.getAccount(2);

Expand Down Expand Up @@ -50,7 +50,7 @@ describe("execution - error on user transaction sent", () => {
const [, , signer2] = await this.hre.ethers.getSigners();
const FooFactory = await this.hre.ethers.getContractFactory("Foo");
FooFactory.connect(signer2).deploy({
gasPrice: this.hre.ethers.utils.parseUnits("500", "gwei"),
gasPrice: this.hre.ethers.parseUnits("500", "gwei"),
});

// Process block 1 with foo1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe("execution - rerun with dropped ignition transactions", () => {
"rerun-with-dropped-ignition-transactions"
);

it("should deploy successfully on second run", async function () {
it.skip("should deploy successfully on second run", async function () {
const moduleDefinition = buildModule("FooModule", (m) => {
const foo = m.contract("Foo", []);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ describe("execution - rerun with now complete ignition transactions", () => {
"rerun-with-now-complete-ignition-transactions"
);

it("should complete the run on the second attempt", async function () {
it.skip("should complete the run on the second attempt", async function () {
// Setup a module with 6 foo contracts deployed in pairs of 2 over 3 batches
const moduleDefinition = buildModule("FooModule", (m) => {
const account2 = m.getAccount(2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe("execution - rerun with pending ignition transactions", () => {
"rerun-with-pending-ignition-transactions"
);

it("should complete the run on the second attempt", async function () {
it.skip("should complete the run on the second attempt", async function () {
const moduleDefinition = buildModule("FooModule", (m) => {
const account2 = m.getAccount(2);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ describe("execution - rerun with replaced confirmed user transaction", () => {
"rerun-with-replaced-confirmed-user-transaction"
);

it("should deploy user interfered transaction on second run", async function () {
it.skip("should deploy user interfered transaction on second run", async function () {
const moduleDefinition = buildModule("FooModule", (m) => {
const account2 = m.getAccount(2);

Expand Down Expand Up @@ -50,7 +50,7 @@ describe("execution - rerun with replaced confirmed user transaction", () => {
const [, , signer2] = await this.hre.ethers.getSigners();
const FooFactory = await this.hre.ethers.getContractFactory("Foo");
const userDeployedContractPromise = FooFactory.connect(signer2).deploy({
gasPrice: this.hre.ethers.utils.parseUnits("500", "gwei"),
gasPrice: this.hre.ethers.parseUnits("500", "gwei"),
nonce: 2,
});

Expand Down
12 changes: 7 additions & 5 deletions packages/hardhat-plugin/test/existing-contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ describe("existing contract", () => {

const firstResult = await this.deploy(firstModuleDefinition);

assert.isDefined(firstResult.bar.address);
assert.isDefined(firstResult.usesContract.address);
const barAddress: string = firstResult.bar.address;
const usesContractAddress: string = firstResult.usesContract.address;
const barAddress: string = await firstResult.bar.getAddress();
const usesContractAddress: string =
await firstResult.usesContract.getAddress();

const secondModuleDefinition = buildModule("SecondModule", (m) => {
const bar = m.contractAt("Bar", barAddress, barArtifact);
Expand All @@ -51,6 +50,9 @@ describe("existing contract", () => {

const usedAddress = await result.usesContract.contractAddress();

assert.equal(usedAddress, result.bar.address);
assert.equal(
usedAddress.toLowerCase(),
(await result.bar.getAddress()).toLowerCase()
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,12 @@ contract FooFactory {
function isDeployed() public pure returns (bool output) {
return true;
}

function getDeployed() public view returns (address output) {
return allDeployed[0];
}

function getDeployed(uint256 value) public view returns (address output) {
return allDeployed[value];
}
}
6 changes: 2 additions & 4 deletions packages/hardhat-plugin/test/libraries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { assert } from "chai";

import { useEphemeralIgnitionProject } from "./use-ignition-project";

// TODO: fix libraries in execution
describe("libraries", () => {
useEphemeralIgnitionProject("minimal-new-api");

Expand Down Expand Up @@ -75,11 +74,10 @@ describe("libraries", () => {

const libDeployResult = await this.deploy(libraryModuleDefinition);

const libAddress = libDeployResult.rubbishMath.address;
const libAbi = libDeployResult.rubbishMath.abi;
const libAddress = await libDeployResult.rubbishMath.getAddress();

const moduleDefinition = buildModule("ConsumingLibModule", (m) => {
const rubbishMath = m.contractAt("RubbishMath", libAddress, libAbi);
const rubbishMath = m.contractAt("RubbishMath", libAddress);

const dependsOnLib = m.contract("DependsOnLib", [], {
libraries: {
Expand Down
3 changes: 1 addition & 2 deletions packages/hardhat-plugin/test/load-module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import { loadModule } from "../src/load-module";

import { useEphemeralIgnitionProject } from "./use-ignition-project";

// eslint-disable-next-line no-only-tests/no-only-tests
describe.only("loadModule", function () {
describe("loadModule", function () {
useEphemeralIgnitionProject("user-modules");

it("should return the module given the module name", () => {
Expand Down
7 changes: 3 additions & 4 deletions packages/hardhat-plugin/test/params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,7 @@ describe("module parameters", () => {
});
});

// TODO: bring back with parameter validation
describe.skip("validation", () => {
describe("params validation", () => {
useEphemeralIgnitionProject("minimal-new-api");

it("should throw if no parameters object provided", async function () {
Expand All @@ -101,7 +100,7 @@ describe.skip("validation", () => {

await assert.isRejected(
deployPromise,
'No parameters object provided to deploy options, but module requires parameter "MyNumber"'
"Module parameter 'MyNumber' requires a value but was given none"
);
});

Expand All @@ -128,7 +127,7 @@ describe.skip("validation", () => {

await assert.isRejected(
deployPromise,
'No parameter provided for "MyNumber"'
"Module parameter 'MyNumber' requires a value but was given none"
);
});
});
3 changes: 1 addition & 2 deletions packages/hardhat-plugin/test/plan/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import path from "path";

import { useEphemeralIgnitionProject } from "../use-ignition-project";

// eslint-disable-next-line no-only-tests/no-only-tests
describe.only("plan", () => {
describe("plan", () => {
// TODO: rename back to minimal api once execution switched over
useEphemeralIgnitionProject("minimal-new-api");

Expand Down
5 changes: 3 additions & 2 deletions packages/hardhat-plugin/test/static-calls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,16 @@ describe("static calls", () => {
assert.equal(await result.foo.x(), Number(1));
});

it("should be able to use the output of a static call function in a contract at (with function signature)", async function () {
// TODO: this needs more investigation
it.skip("should be able to use the output of a static call function in a contract at (with function signature)", async function () {
const moduleDefinition = buildModule("FooModule", (m) => {
const account1 = m.getAccount(1);

const fooFactory = m.contract("FooFactory", [], { from: account1 });

const createCall = m.call(fooFactory, "create", []);

const newAddress = m.staticCall(fooFactory, "allDeployed(uint256)", [0], {
const newAddress = m.staticCall(fooFactory, "getDeployed(uint256)", [0], {
after: [createCall],
});

Expand Down

0 comments on commit 62a4d73

Please sign in to comment.