0

This is my test file:

const assert = require('assert');

const TOKEN_WASM_PATH = './contracts/group/group.wasm';
const TOKEN_ABI_PATH = './contracts/group/group.abi';

describe("EOSIO Group", function (eoslime) {

    this.timeout(15000);

    let groupContract;
        let groupTable;
        let adminAccount;

    before(async () => {
            adminAccount = await eoslime.Account.load('groupaccount','myPK','active');
    });

    before(async () => {
        groupContract = eoslime.Contract.at(TOKEN_ABI_PATH, 'group', adminAccount);
        groupTable = groupContract.groups;
    });

    it("Should create a new group", async () => {
             await groupContract.upsertgroup("group2", "Assistant", "normal user include all users", "Common", 1,{ from: adminAccount.name });
    });

It is giving error on eoslime test:

1) EOSIO Group
     UnhandledPromiseRejectionWarning: Error: Provided String is not an instance of BaseAccount
      Should create a new group:
    TypeError: groupContract.upsertgroup is not a function
     at Context.it (tests/example-tests.js:37:27)

Contract name is "group", it is deployed on the account which is loaded here in before(). So, I don't need to deploy it here again. Only access contract and call its actions. Please help.

0

I found solution on Github. The first problem was eoslime was not installed properly (locally). So, I changed the project directory and installed eoslime in that directory again. Second, the changes in code. Added:

const eoslime = require('eoslime').init();

Changed:

contract = await eoslime.Contract.at(CONTRACT_NAME,adminAccount)

It solves all errors.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.