Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
duniter
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nodes
typescript
duniter
Commits
8dafbbe6
Commit
8dafbbe6
authored
8 years ago
by
Cédric Moreau
Browse files
Options
Downloads
Patches
Plain Diff
Changing G1 Test to reflect the actual launching
parent
ebffac52
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/integration/v1.0-g1-dividend.js
+43
-16
43 additions, 16 deletions
test/integration/v1.0-g1-dividend.js
with
43 additions
and
16 deletions
test/integration/v1.0-g1-dividend.js
+
43
−
16
View file @
8dafbbe6
...
@@ -6,14 +6,15 @@ const bma = require('duniter-bma').duniter.methods.bma;
...
@@ -6,14 +6,15 @@ const bma = require('duniter-bma').duniter.methods.bma;
const
constants
=
require
(
'
../../app/lib/constants
'
);
const
constants
=
require
(
'
../../app/lib/constants
'
);
const
toolbox
=
require
(
'
./tools/toolbox
'
);
const
toolbox
=
require
(
'
./tools/toolbox
'
);
const
start
=
1489057200
;
// 2016-03-09 12:00:00 UTC+0
const
start
=
1488985390
;
// 2016-03-08 16:03:10 UTC+0
const
delayToUD
=
1489057200
-
start
;
// Delay to 2016-03-09 12:00:00 UTC+0
const
aDay
=
3600
*
24
;
const
aDay
=
3600
*
24
;
const
_6months
=
15778800
;
const
_6months
=
15778800
;
const
conf
=
{
const
conf
=
{
ud0
:
1000
,
ud0
:
1000
,
udTime0
:
148
91436
00
,
// 2016-03-
1
0 12:00:00 UTC+0
udTime0
:
148
89708
00
,
// 2016-03-0
8
12:00:00 UTC+0
udReevalTime0
:
1490094000
,
// 2016-03-21 12:00:00 UTC+0 ==> first recomputed UD (equinox)
udReevalTime0
:
1490094000
,
// 2016-03-21 12:00:00 UTC+0 ==> first recomputed UD (equinox)
c
:
.
0488
,
// 4.88 %
c
:
.
0488
,
// 4.88 %
dt
:
aDay
,
dt
:
aDay
,
...
@@ -41,52 +42,78 @@ describe("Protocol 1.0 Ğ1 Dividend", function() {
...
@@ -41,52 +42,78 @@ describe("Protocol 1.0 Ğ1 Dividend", function() {
s1
=
res1
.
s1
;
s1
=
res1
.
s1
;
cat
=
res1
.
cat
;
// HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd
cat
=
res1
.
cat
;
// HgTTJLAQ5sqfknMq7yLPZbehtuLSsKj9CxWN7k8QvYJd
tac
=
res1
.
tac
;
// 2LvDg21dVXvetTD9GdkPLURavLYEqP3whauvPWX4c2qc
tac
=
res1
.
tac
;
// 2LvDg21dVXvetTD9GdkPLURavLYEqP3whauvPWX4c2qc
for
(
let
i
=
0
;
i
<
15
;
i
++
)
{
yield
s1
.
commit
({
time
:
start
});
yield
s1
.
commit
({
time
:
start
+
aDay
*
i
});
yield
s1
.
commit
({
time
:
start
+
1
});
yield
s1
.
commit
({
time
:
start
+
delayToUD
});
for
(
let
i
=
1
;
i
<
15
;
i
++
)
{
yield
s1
.
commit
({
time
:
(
start
+
delayToUD
)
+
aDay
*
i
});
}
}
}));
}));
it
(
'
should have block#0 has no UD
'
,
()
=>
s1
.
expectThat
(
'
/blockchain/block/0
'
,
(
json
)
=>
{
it
(
'
should have block#0 has no UD
'
,
()
=>
s1
.
expectThat
(
'
/blockchain/block/0
'
,
(
json
)
=>
{
should
.
not
.
exist
(
json
.
dividend
);
should
.
not
.
exist
(
json
.
dividend
);
json
.
should
.
have
.
property
(
'
medianTime
'
).
equal
(
start
);
// 2016-03-0
9
1
2
:0
0:0
0 UTC+0
json
.
should
.
have
.
property
(
'
medianTime
'
).
equal
(
start
);
// 2016-03-0
8
1
6
:0
3:1
0 UTC+0
}));
}));
it
(
'
should have block#1 has no UD
'
,
()
=>
s1
.
expectThat
(
'
/blockchain/block/1
'
,
(
json
)
=>
{
it
(
'
should have block#1 has no UD
'
,
()
=>
s1
.
expectThat
(
'
/blockchain/block/1
'
,
(
json
)
=>
{
should
.
not
.
exist
(
json
.
dividend
);
json
.
dividend
.
should
.
equal
(
1000
);
json
.
should
.
have
.
property
(
'
medianTime
'
).
equal
(
start
);
// 2016-03-0
9
1
2
:0
0:0
0 UTC+0
json
.
should
.
have
.
property
(
'
medianTime
'
).
equal
(
start
);
// 2016-03-0
8
1
6
:0
3:1
0 UTC+0
}));
}));
it
(
'
should have block#2 with UD 1000
'
,
()
=>
s1
.
expectThat
(
'
/blockchain/block/2
'
,
(
json
)
=>
{
it
(
'
should have block#2 with UD 1000
'
,
()
=>
s1
.
expectThat
(
'
/blockchain/block/2
'
,
(
json
)
=>
{
json
.
dividend
.
should
.
equal
(
1000
);
should
.
not
.
exist
(
json
.
dividend
);
json
.
should
.
have
.
property
(
'
medianTime
'
).
equal
(
start
+
aDay
);
// 2016-03-
1
0 1
2
:0
0:00
UTC+0
json
.
should
.
have
.
property
(
'
medianTime
'
).
equal
(
start
+
1
);
// 2016-03-0
8
1
6
:0
3:11
UTC+0
}));
}));
it
(
'
should have block#3 with UD 1000
'
,
()
=>
s1
.
expectThat
(
'
/blockchain/block/3
'
,
(
json
)
=>
{
it
(
'
should have block#3 with UD 1000
'
,
()
=>
s1
.
expectThat
(
'
/blockchain/block/3
'
,
(
json
)
=>
{
json
.
dividend
.
should
.
equal
(
1000
);
json
.
dividend
.
should
.
equal
(
1000
);
json
.
should
.
have
.
property
(
'
medianTime
'
).
equal
(
start
+
aDay
*
2
);
// 2016-03-
11
12:00:00 UTC+0
json
.
should
.
have
.
property
(
'
medianTime
'
).
equal
(
start
+
delayToUD
);
// 2016-03-
09
12:00:00 UTC+0
}));
}));
it
(
'
should have block#4 with UD 1000
'
,
()
=>
s1
.
expectThat
(
'
/blockchain/block/4
'
,
(
json
)
=>
{
it
(
'
should have block#4 with UD 1000
'
,
()
=>
s1
.
expectThat
(
'
/blockchain/block/4
'
,
(
json
)
=>
{
json
.
dividend
.
should
.
equal
(
1000
);
json
.
dividend
.
should
.
equal
(
1000
);
json
.
should
.
have
.
property
(
'
medianTime
'
).
equal
((
start
+
delayToUD
)
+
aDay
);
// 2016-03-10 12:00:00 UTC+0
}));
}));
it
(
'
should have block#4 with UD 1000
'
,
()
=>
s1
.
expectThat
(
'
/blockchain/block/5
'
,
(
json
)
=>
{
json
.
dividend
.
should
.
equal
(
1000
);
json
.
should
.
have
.
property
(
'
medianTime
'
).
equal
((
start
+
delayToUD
)
+
aDay
*
2
);
// 2016-03-11 12:00:00 UTC+0
}));
it
(
'
should have block#4 with UD 1000
'
,
()
=>
s1
.
expectThat
(
'
/blockchain/block/6
'
,
(
json
)
=>
{
json
.
dividend
.
should
.
equal
(
1000
);
json
.
should
.
have
.
property
(
'
medianTime
'
).
equal
((
start
+
delayToUD
)
+
aDay
*
3
);
// 2016-03-12 12:00:00 UTC+0
}));
// ... skip some blocks ...
it
(
'
should have block#11 with UD 1000
'
,
()
=>
s1
.
expectThat
(
'
/blockchain/block/11
'
,
(
json
)
=>
{
it
(
'
should have block#11 with UD 1000
'
,
()
=>
s1
.
expectThat
(
'
/blockchain/block/11
'
,
(
json
)
=>
{
json
.
dividend
.
should
.
equal
(
1000
);
json
.
dividend
.
should
.
equal
(
1000
);
json
.
should
.
have
.
property
(
'
medianTime
'
).
equal
(
start
+
aDay
*
10
);
// 2016-03-1
9
12:00:00 UTC+0
json
.
should
.
have
.
property
(
'
medianTime
'
).
equal
(
(
start
+
delayToUD
)
+
aDay
*
8
);
// 2016-03-1
7
12:00:00 UTC+0
}));
}));
it
(
'
should have block#12 with UD 1000
'
,
()
=>
s1
.
expectThat
(
'
/blockchain/block/12
'
,
(
json
)
=>
{
it
(
'
should have block#12 with UD 1000
'
,
()
=>
s1
.
expectThat
(
'
/blockchain/block/12
'
,
(
json
)
=>
{
json
.
dividend
.
should
.
equal
(
1000
);
json
.
dividend
.
should
.
equal
(
1000
);
json
.
should
.
have
.
property
(
'
medianTime
'
).
equal
(
start
+
aDay
*
11
);
// 2016-03-20 12:00:00 UTC+0
json
.
should
.
have
.
property
(
'
medianTime
'
).
equal
((
start
+
delayToUD
)
+
aDay
*
9
);
// 2016-03-18 12:00:00 UTC+0
}));
it
(
'
should have block#13 with UD 1000
'
,
()
=>
s1
.
expectThat
(
'
/blockchain/block/13
'
,
(
json
)
=>
{
json
.
dividend
.
should
.
equal
(
1000
);
json
.
should
.
have
.
property
(
'
medianTime
'
).
equal
((
start
+
delayToUD
)
+
aDay
*
10
);
// 2016-03-19 12:00:00 UTC+0
}));
it
(
'
should have block#14 with UD 1000
'
,
()
=>
s1
.
expectThat
(
'
/blockchain/block/14
'
,
(
json
)
=>
{
json
.
dividend
.
should
.
equal
(
1000
);
json
.
should
.
have
.
property
(
'
medianTime
'
).
equal
((
start
+
delayToUD
)
+
aDay
*
11
);
// 2016-03-20 12:00:00 UTC+0
}));
}));
it
(
'
should have block#1
3
with UD 1001
'
,
()
=>
s1
.
expectThat
(
'
/blockchain/block/1
3
'
,
(
json
)
=>
{
it
(
'
should have block#1
4
with UD 1001
'
,
()
=>
s1
.
expectThat
(
'
/blockchain/block/1
5
'
,
(
json
)
=>
{
json
.
dividend
.
should
.
equal
(
1001
);
json
.
dividend
.
should
.
equal
(
1001
);
json
.
should
.
have
.
property
(
'
medianTime
'
).
equal
(
start
+
aDay
*
12
);
// 2016-03-21 12:00:00 UTC+0
json
.
should
.
have
.
property
(
'
medianTime
'
).
equal
(
(
start
+
delayToUD
)
+
aDay
*
12
);
// 2016-03-21 12:00:00 UTC+0
}));
}));
it
(
'
should have block#14 with UD 1001
'
,
()
=>
s1
.
expectThat
(
'
/blockchain/block/1
4
'
,
(
json
)
=>
{
it
(
'
should have block#14 with UD 1001
'
,
()
=>
s1
.
expectThat
(
'
/blockchain/block/1
6
'
,
(
json
)
=>
{
json
.
dividend
.
should
.
equal
(
1001
);
json
.
dividend
.
should
.
equal
(
1001
);
json
.
should
.
have
.
property
(
'
medianTime
'
).
equal
(
start
+
aDay
*
13
);
// 2016-03-22 12:00:00 UTC+0
json
.
should
.
have
.
property
(
'
medianTime
'
).
equal
(
(
start
+
delayToUD
)
+
aDay
*
13
);
// 2016-03-22 12:00:00 UTC+0
}));
}));
});
});
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment