Skip to content

Commit

Permalink
lint all test uri calls
Browse files Browse the repository at this point in the history
  • Loading branch information
arr00 committed Aug 31, 2023
1 parent 313b386 commit 1dce4ec
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
run: forge install

- name: "Run Foundry tests"
run: forge test -vvv --fork-url $FORK_URL --etherscan-api-key $ETHERSCAN_API_KEY
run: forge test -vvv --fork-url $FORK_URL --etherscan-api-key $ETHERSCAN_API_KEY --ffi
coverage:
runs-on: ubuntu-latest
steps:
Expand All @@ -39,7 +39,7 @@ jobs:
- name: Install dependencies
run: forge install
- name: "Run Foundry Coverage"
run: forge coverage --report lcov
run: forge coverage --report lcov --ffi
- name: "Upload coverage to Codecov"
uses: codecov/codecov-action@v3
lint:
Expand Down
13 changes: 10 additions & 3 deletions test/crowdfund/Crowdfund.t.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8;

import "forge-std/Test.sol";

import "../../contracts/gatekeepers/AllowListGateKeeper.sol";
import "../../contracts/globals/Globals.sol";
import "../../contracts/globals/LibGlobals.sol";
Expand All @@ -17,6 +15,7 @@ import "../TestUtils.sol";
import "./MockPartyFactory.sol";
import "./MockParty.sol";
import "./TestableCrowdfund.sol";
import { LintJSON } from "../utils/LintJSON.sol";

contract BadETHReceiver is ERC721Receiver {
// Does not implement `receive()`.
Expand All @@ -29,7 +28,7 @@ contract BadERC721Receiver {
receive() external payable {}
}

contract CrowdfundTest is Test, TestUtils {
contract CrowdfundTest is LintJSON, TestUtils {
event MockPartyFactoryCreateParty(
address caller,
address[] authorities,
Expand Down Expand Up @@ -1262,6 +1261,8 @@ contract CrowdfundTest is Test, TestUtils {

string memory tokenURI = cf.tokenURI(uint256(uint160(address(contributor1))));

_lintEncodedJSON(tokenURI);

// Uncomment for testing rendering:
// console.log(tokenURI);

Expand All @@ -1284,6 +1285,8 @@ contract CrowdfundTest is Test, TestUtils {
cf.contribute{ value: contributor1.balance }(delegate1, "");
string memory tokenURI = cf.tokenURI(uint256(uint160(address(contributor1))));

_lintEncodedJSON(tokenURI);

// Uncomment for testing rendering:
// console.log(tokenURI);

Expand All @@ -1303,6 +1306,8 @@ contract CrowdfundTest is Test, TestUtils {
cf.contribute{ value: contributor1.balance }(delegate1, "");
string memory tokenURI = cf.tokenURI(uint256(uint160(address(contributor1))));

_lintEncodedJSON(tokenURI);

// Uncomment for testing rendering:
// console.log(tokenURI);

Expand All @@ -1315,6 +1320,8 @@ contract CrowdfundTest is Test, TestUtils {

string memory contractURI = cf.contractURI();

_lintEncodedJSON(contractURI);

// Uncomment for testing rendering:
// console.log(contractURI);

Expand Down
6 changes: 6 additions & 0 deletions test/crowdfund/InitialETHCrowdfund.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1707,6 +1707,8 @@ contract InitialETHCrowdfundTest is LintJSON, TestUtils, ERC721Receiver {

string memory tokenURI = party.tokenURI(1);

_lintEncodedJSON(tokenURI);

// Uncomment for testing rendering:
// console.log(tokenURI);

Expand Down Expand Up @@ -1747,6 +1749,8 @@ contract InitialETHCrowdfundTest is LintJSON, TestUtils, ERC721Receiver {

string memory tokenURI = party.tokenURI(1);

_lintEncodedJSON(tokenURI);

// Uncomment for testing rendering:
// console.log(tokenURI);

Expand Down Expand Up @@ -1829,6 +1833,8 @@ contract InitialETHCrowdfundTest is LintJSON, TestUtils, ERC721Receiver {

string memory tokenURI = party.tokenURI(1);

_lintEncodedJSON(tokenURI);

// Uncomment for testing rendering:
// console.log(tokenURI);

Expand Down
14 changes: 10 additions & 4 deletions test/crowdfund/ReraiseETHCrowdfund.t.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8;

import "forge-std/Test.sol";

import "../../contracts/crowdfund/ReraiseETHCrowdfund.sol";
import "../../contracts/globals/Globals.sol";
import "../../contracts/utils/Proxy.sol";
Expand All @@ -13,10 +11,10 @@ import "../../contracts/renderers/RendererStorage.sol";
import "../../contracts/renderers/fonts/PixeldroidConsoleFont.sol";
import "../../contracts/distribution/TokenDistributor.sol";
import "../../contracts/gatekeepers/AllowListGateKeeper.sol";

import { LintJSON } from "../utils/LintJSON.sol";
import "../TestUtils.sol";

contract ReraiseETHCrowdfundTest is Test, TestUtils, ERC721Receiver {
contract ReraiseETHCrowdfundTest is LintJSON, TestUtils, ERC721Receiver {
event Transfer(address indexed owner, address indexed to, uint256 indexed tokenId);
event Contributed(
address indexed sender,
Expand Down Expand Up @@ -2175,6 +2173,8 @@ contract ReraiseETHCrowdfundTest is Test, TestUtils, ERC721Receiver {

string memory tokenURI = crowdfund.tokenURI(uint256(uint160(member)));

_lintEncodedJSON(tokenURI);

// Uncomment for testing rendering:
// console.log(tokenURI);

Expand Down Expand Up @@ -2214,6 +2214,8 @@ contract ReraiseETHCrowdfundTest is Test, TestUtils, ERC721Receiver {

string memory tokenURI = crowdfund.tokenURI(uint256(uint160(member)));

_lintEncodedJSON(tokenURI);

// Uncomment for testing rendering:
// console.log(tokenURI);

Expand Down Expand Up @@ -2253,6 +2255,8 @@ contract ReraiseETHCrowdfundTest is Test, TestUtils, ERC721Receiver {

string memory tokenURI = crowdfund.tokenURI(uint256(uint160(member)));

_lintEncodedJSON(tokenURI);

// Uncomment for testing rendering:
// console.log(tokenURI);

Expand Down Expand Up @@ -2292,6 +2296,8 @@ contract ReraiseETHCrowdfundTest is Test, TestUtils, ERC721Receiver {

string memory tokenURI = crowdfund.tokenURI(uint256(uint160(member)));

_lintEncodedJSON(tokenURI);

// Uncomment for testing rendering:
// console.log(tokenURI);

Expand Down
12 changes: 12 additions & 0 deletions test/party/PartyGovernanceNFT.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1264,6 +1264,8 @@ contract PartyGovernanceNFTTest is LintJSON, TestUtils {
// Get token URI
string memory tokenURI = party.tokenURI(tokenId);

_lintEncodedJSON(tokenURI);

// Uncomment for testing rendering:
// console.log(tokenURI);

Expand All @@ -1286,6 +1288,8 @@ contract PartyGovernanceNFTTest is LintJSON, TestUtils {
// Get token URI
string memory tokenURI = party.tokenURI(33);

_lintEncodedJSON(tokenURI);

// Uncomment for testing rendering:
// console.log(tokenURI);

Expand Down Expand Up @@ -1325,6 +1329,8 @@ contract PartyGovernanceNFTTest is LintJSON, TestUtils {
// Get token URI
string memory tokenURI = party.tokenURI(tokenId);

_lintEncodedJSON(tokenURI);

// Uncomment for testing rendering:
// console.log(tokenURI);

Expand Down Expand Up @@ -1356,6 +1362,8 @@ contract PartyGovernanceNFTTest is LintJSON, TestUtils {
// Get token URI
string memory tokenURI = party.tokenURI(tokenId);

_lintEncodedJSON(tokenURI);

// Uncomment for testing rendering:
// console.log(tokenURI);

Expand Down Expand Up @@ -1414,6 +1422,8 @@ contract PartyGovernanceNFTTest is LintJSON, TestUtils {

string memory contractURI = party.contractURI();

_lintEncodedJSON(contractURI);

// Uncomment for testing rendering:
// console.log(contractURI);

Expand Down Expand Up @@ -1447,6 +1457,8 @@ contract PartyGovernanceNFTTest is LintJSON, TestUtils {

string memory contractURI = party.contractURI();

_lintEncodedJSON(contractURI);

// Uncomment for testing rendering:
// console.log(contractURI);

Expand Down
1 change: 0 additions & 1 deletion test/utils/LintJSON.sol
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ contract LintJSON is Test {
inputs[0] = "node";
inputs[1] = "./js/lint-json.js";
bytes memory ffiResp = vm.ffi(inputs);
vm.removeFile("./out/lint-json.json");

uint256 resAsInt;
assembly {
Expand Down

0 comments on commit 1dce4ec

Please sign in to comment.