In Diorama tests I have a js call to a function which internally calls the update_entity
function:
let res1 = await alice.call("app1", "update_entity", {status: "st1"});
Then I check a result:
let res2 = await alice.call("app1", "get_entity", {addr: res1.Ok});
t.deepEqual(res2.Ok, "st1", "status is st1 - good");
The thing is that sometimes(!) it fails, and it shows the status that’s the one it was before an update. I suppose that it’s due to the fact that there’s “await” in the 1st call.
await
itself has to be used with updating operations.
-
Is this correct?
-
How to fix it? Wait for “await” for finish first before checking the status? How?