TransWikia.com

How to match object value from fc::variant which is std::pair type in contract unit test via Boost test?

EOS.IO Asked by Artem Maluga on August 20, 2021

This is example of object singletone table which i trying to test:

{
      "rows": [{
          "account": "ins",
          "first_approve": {
            "first": "apk",
            "second": 1
          },
          "second_approve": {
            "first": "",
            "second": 0
          }
        }
      ],
      "more": false
}

Using testing library i try to check matching object:

REQUIRE_MATCHING_OBJECT(notary, mvo()("account", "ins")("first_approve", "")("second_approve", ""));

In which format i need add values to first_approve and second approve keys?
Also am i correct using:

get_row_by_account(code,scope,table,acc)

For singletone table?

One Answer

You can pass variant_object to initialize the other variant_object.

For example,

auto fa_obj = mvo()("first", "apk")("second", 1);

REQUIRE_MATCHING_OBJECT(notary, mvo()("account", "ins")("first_approve", fa_obj)...

Answered by conr2d on August 20, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP