0

I am writing a truffle javascript test and I need to test if a key in a mapping was deleted. After deleting it, its values are equal to '0x0000000...' . How can I test in a truffle javascript test that that equals to zero?

  magicSmartContract.delete_card('33');
  deleted_card = await magicSmartContract.get_card('33');
  assert(deleted_card[0], 0);  // This

It is a js question I know, I am just wondering if there is an easy way to do this. deleted_card[0] is '0x0000000000000000000000000000000000000000' .

2

Like this?

var nullAddr = "0x0000...." // 40 x 0
assert.strictEqual(deleted_card, nullAddr, "card is not zero");

Hope it helps.

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