develop #1

Merged
p1r0 merged 2 commits from DECA/DECANFT-SC:develop into develop 2023-11-30 06:53:58 +00:00
1 changed files with 21 additions and 5 deletions
Showing only changes of commit 13567f6c15 - Show all commits

View File

@ -1,7 +1,7 @@
// SPDX-License-Identifier: UNLICENSED // SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.23; pragma solidity ^0.8.23;
import {Test, console2} from "forge-std/Test.sol"; import {Test, console} from "forge-std/Test.sol";
import {DCO2s} from "../src/DCO2s.sol"; import {DCO2s} from "../src/DCO2s.sol";
contract DCO2sTest is Test { contract DCO2sTest is Test {
@ -19,14 +19,32 @@ contract DCO2sTest is Test {
} }
// @notice: here we test getting the Base and full URIS // @notice: here we test getting the Base and full URIS
//function testGetURI() public {} function testGetURI() public {
string memory _baseURL = "https://gateway.decentralizedscience.org/ipfs/";
string memory URI = "bafkreibc6p3y36yjmeqqnttqfrpb2yttxa6aonoywxwdxl7nqym4jj3jwa";
dco2sc.safeMint(address(1), URI);
string memory tokenURI = dco2sc.tokenURI(0);
console.log(tokenURI);
assertEq(tokenURI, string.concat(_baseURL,URI));
}
// @notice: checkFailed token Index
function testFailTokenIndex() public {
dco2sc.tokenURI(0);
}
// @notice: checkFailed token Index
//function testTokenIndex() public {
// vm.expectRevert(bytes("ERC721NonexistentToken(0)"));
// dco2sc.tokenURI(0);
//}
// @notice use the basic Enumerable properties // @notice use the basic Enumerable properties
// function testEnumerable() public {} // function testEnumerable() public {}
// @notice: testFailMintToZeroAddress test that cannot safe mint to address 0 // @notice: testFailMintToZeroAddress test that cannot safe mint to address 0
function testFailMintToZeroAddress() public { function testFailMintToZeroAddress() public {
dco2sc.safeMint(address(0),"qnttqfrpb2yttxa6aonoywxwdxl7nqym4jj3jwa"); dco2sc.safeMint(address(0),"bafkreibc6p3y36yjmeqqnttqfrpb2yttxa6aonoywxwdxl7nqym4jj3jwa");
} }
// @notice testMintAll mints all the NFTs URIS and distribute to wallets // @notice testMintAll mints all the NFTs URIS and distribute to wallets
@ -111,8 +129,6 @@ contract DCO2sTest is Test {
// } // }
// } // }
} }