/
get-market-creation-cost.js
50 lines (47 loc) · 1.5 KB
/
get-market-creation-cost.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
38
39
40
41
42
43
44
45
46
47
48
49
50
/* eslint-env mocha */
"use strict";
var assert = require("chai").assert;
var speedomatic = require("speedomatic");
var proxyquire = require("proxyquire").noPreserveCache();
describe("create-market/get-market-creation-cost", function () {
var test = function (t) {
it(t.description, function (done) {
var getMarketCreationCost = proxyquire("../../../src/create-market/get-market-creation-cost", {
"../api": t.stub.api,
});
getMarketCreationCost(t.params, function (err, marketCreationCost) {
t.assertions(err, marketCreationCost);
done();
});
});
};
test({
description: "happy path",
params: {
universe: "UNIVERSE_ADDRESS",
},
stub: {
api: function () {
return {
Universe: {
getOrCacheDesignatedReportNoShowBond: function (p, callback) {
assert.deepEqual(p, { tx: { to: "UNIVERSE_ADDRESS", send: false } });
callback(null, speedomatic.fix("1", "string"));
},
getOrCacheMarketCreationCost: function (p, callback) {
assert.deepEqual(p, { tx: { to: "UNIVERSE_ADDRESS", send: false } });
callback(null, speedomatic.fix("4.2", "string"));
},
},
};
},
},
assertions: function (err, marketCreationCost) {
assert.isNull(err);
assert.deepEqual(marketCreationCost, {
designatedReportNoShowReputationBond: "1",
etherRequiredToCreateMarket: "4.2",
});
},
});
});