0

truffle testを行なったのですが、ひとつだけ、どうしてもパスしません。
(address型は2つあり、address payable public beneficiaryはパスし、
もうひとつのaddress public custodianがパスしません)。
アドバイスいただけると助かります。

Fundraiser.sol(スマートコントラクトのコード)

pragma solidity >0.4.23 <0.7.0;

contract Fundraiser{
string public name;
string public url;
string public imageURL;
string public description;
address payable public beneficiary;
//これだけパスしない
address public custodian;    

constructor(
string memory _name,
string memory _url,
string memory _imageURL,
string memory _description,
address payable _beneficiary,
address _custodian
)

public
  {
    name = _name;
    url = _url;
    imageURL = _imageURL;
    description = _description;
    beneficiary= _beneficiary;
    custodian = _custodian;


   }
 }

test/fundraiser_test.js(テストのコード)

const FundraiserContract = artifacts.require("Fundraiser");
contract("Fundraiser", accounts => {
let fundraiser;
const name =  "Beneficiary Name";
const url = "beneficiaryname.org";
const imageURL="https://placeKitten.com/600/350";
const description = "Beneficiary description";

const beneficiary = accounts[1];
const cunstodian = accounts[0];


beforeEach(async () => {
fundraiser = await FundraiserContract.new(
 name,
 url,
 imageURL,
 description,
 beneficiary,
 cunstodian
 )
});

 describe("initialization", () => {

 it("gets the beneficiary name", async () => {
 const actual = await fundraiser.name();
 assert.equal(actual, name, "names should match");
 });

 it("gets the beneficiary url", async () => {
 const actual = await fundraiser.imageURL();
 assert.equal(actual, imageURL, "imageURL should match");
 });

 it("gets the beneficiary image url", async () => {
 const actual = await fundraiser.name();
 assert.equal(actual, name, "names should match");
 });

 it("gets the beneficiary description", async () => {
 const actual = await fundraiser.description();
 assert.equal(actual, description, "description should match");
 });

 it("gets the beneficiary", async () => {
 const actual = await fundraiser.beneficiary();
 assert.equal(actual, beneficiary, "beneficiary should match");
 });

 it("gets the cunstodian", async () => {
 const actual = await fundraiser.cunstodian();
 assert.equal(actual, cunstodian, "cunstodian should match");
 });

  });
});;

truffle testの結果

Compiled successfully using:

  • solc: 0.5.16+commit.9c3226ce.Emscripten.clang

Contract: Fundraiser
initialization
✔ gets the beneficiary name
✔ gets the beneficiary url
✔ gets the beneficiary image url
✔ gets the beneficiary description
✔ gets the beneficiary
1) gets the cunstodian
No events were emitted

5 passing (191ms)
1 failing

  1. Contract: Fundraiser
    initialization
    gets the cunstodian:
    TypeError: fundraiser.cunstodian is not a function
    at Context. (test/fundraiser_test.js:54:38)
    at processImmediate (node:internal/timers:466:21)

0

この質問に回答するには、ログインする必要があります。

のタグが付いた他の質問を参照する。