Skip to content

Commit

Permalink
chore: fix getArtifactPath flaky test (#9339)
Browse files Browse the repository at this point in the history
  • Loading branch information
grandizzy authored Nov 18, 2024
1 parent e649e62 commit 44c86e7
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions testdata/default/cheats/GetArtifactPath.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,15 @@ contract GetArtifactPathTest is DSTest {
DummyForGetArtifactPath dummy = new DummyForGetArtifactPath();
bytes memory dummyCreationCode = type(DummyForGetArtifactPath).creationCode;

string memory root = vm.projectRoot();
string memory path = vm.getArtifactPathByCode(dummyCreationCode);

string memory expectedPath =
string.concat(root, "/out/default/GetArtifactPath.t.sol/DummyForGetArtifactPath.json");

assertEq(path, expectedPath);
assertTrue(vm.contains(path, "/out/default/GetArtifactPath.t.sol/DummyForGetArtifactPath.json"));
}

function testGetArtifactPathByDeployedCode() public {
DummyForGetArtifactPath dummy = new DummyForGetArtifactPath();
bytes memory dummyRuntimeCode = address(dummy).code;

string memory root = vm.projectRoot();
string memory path = vm.getArtifactPathByDeployedCode(dummyRuntimeCode);

string memory expectedPath =
string.concat(root, "/out/default/GetArtifactPath.t.sol/DummyForGetArtifactPath.json");

assertEq(path, expectedPath);
assertTrue(vm.contains(path, "/out/default/GetArtifactPath.t.sol/DummyForGetArtifactPath.json"));
}
}

0 comments on commit 44c86e7

Please sign in to comment.