github.com/hyperledger/burrow@v0.34.5-0.20220512172541-77f09336001d/js/src/test/46.test.ts (about)

     1  import * as assert from 'assert';
     2  import { compile } from '../contracts/compile';
     3  import { client } from './test';
     4  
     5  describe('#46', function () {
     6    it('#46', async () => {
     7      const source = `
     8        pragma solidity >=0.0.0;
     9        contract Test{
    10  
    11          string _name;
    12  
    13          function setName(string memory newname) public {
    14            _name = newname;
    15          }
    16  
    17          function getNameConstant() public view returns (string memory) {
    18            return _name;
    19          }
    20  
    21          function getName() public view returns (string memory) {
    22            return _name;
    23          }
    24        }
    25      `;
    26  
    27      const contract = compile(source, 'Test');
    28      return contract
    29        .deploy(client)
    30        .then((instance: any) =>
    31          instance.setName('Batman').then(() => Promise.all([instance.getNameConstant(), instance.getName()])),
    32        )
    33        .then(([constant, nonConstant]) => {
    34          assert.strictEqual(constant[0], nonConstant[0]);
    35        });
    36    });
    37  });