-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtest.js
37 lines (28 loc) · 1.26 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
const History = require("../ravencoin-history-list"); //Yes we are importing our self
const aliceDeltas = require("./example/alice_deltas_after_sending.json");
const evrDeltas = require("./example/evr_deltas.json");
test("Check sent one LEMONADE", () => {
const history = History.getHistory(aliceDeltas);
//The first history item should contain Alice sending one Lemonade token to Bob
const historyItem = history[0];
console.log("First history fee", historyItem.fee / 1e8);
const lemonade = historyItem.assets.find((a) => a.assetName === "LEMONADE");
expect(lemonade).toBeTruthy();
expect(lemonade.value).toBe(-1);
const rvn = historyItem.assets.find((a) => a.assetName === "RVN");
expect(rvn).toBeFalsy();
return;
});
test("CheckEVR", () => {
const history = History.getHistory(evrDeltas, "EVR");
console.log(JSON.stringify(history, null, 4));
//The first history item should contain Alice sending one Lemonade token to Bob
const historyItem = history[0];
console.log("First history fee", historyItem.fee / 1e8);
const evr = historyItem.assets.find((a) => a.assetName === "EVR");
expect(evr).toBeTruthy();
expect(evr.value).toBe(-1.01);
const rvn = historyItem.assets.find((a) => a.assetName === "RVN");
expect(rvn).toBeFalsy();
return;
});