When I do truffle test, I get the following error. Advice, please.
(solc 0.5.1 )
CompileError: @openzeppelin/contracts/access/Ownable.sol:20:1: ParserError: Expected pragma, import directive or contract/interface/library definition.
abstract contract Ownable is Context {
^------^
// Fundraiser.sol(contruct)
pragma solidity >= 0.4.0 < 0.7.0;
import "@openzeppelin/contracts/access/Ownable.sol";
contract Fundraiser is Ownable {
string public name;
string public url;
string public imageURL;
string public description;
address payable public beneficiary;
address private 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;
transferOwnerShip(_custodian);
}
}
// test
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 custodian = accounts[0];
beforeEach(async () => {
fundraiser = await FundraiserContract.new(
name,
url,
imageURL,
description,
beneficiary,
owner
)
});
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.url();
assert.equal(actual, url, "url should match");
});
it("gets the beneficiary image url", async () => {
const actual = await fundraiser.imageURL();
assert.equal(actual, imageURL, "imageURL 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 addresses should match");
});
it("gets the owner", async () => {
const actual = await fundraiser.owner();
assert.equal(actual, owner, "bios should match");
});
});
});