Commit f7844852666d755f5ea74290b4b3cc5bed2340a7
Use nDaysTime helper.
Piet Geursen committed on 5/10/2018, 10:10:03 PMParent: 34520bc583f5508541b906f83cc6473ee08991e3
Files changed
test/poll/async/get.test.js | changed |
test/poll/async/get.test.js | ||
---|---|---|
@@ -17,16 +17,11 @@ | ||
17 | 17 | choices: ['prairie dog', 'kea', 'hermit crab'], |
18 | 18 | closesAt: nDaysTime(2) |
19 | 19 | }) |
20 | 20 | |
21 | -const date = new Date() | |
21 | +const agesAway = nDaysTime(100) | |
22 | +const soSoon = nDaysTime(1) | |
22 | 23 | |
23 | -date.setYear(1989) | |
24 | -const agesAgo = date.toISOString() | |
25 | - | |
26 | -date.setYear(2020) | |
27 | -const soSoon = date.toISOString() | |
28 | - | |
29 | 24 | test('pull.async.get', t => { |
30 | 25 | piet.publish(pollContent, (err, poll) => { |
31 | 26 | if (err) throw err |
32 | 27 | |
@@ -44,9 +39,9 @@ | ||
44 | 39 | }) |
45 | 40 | }), |
46 | 41 | pull.asyncMap((t, cb) => t.author.publish(t.position, cb)), |
47 | 42 | pull.asyncMap((m, cb) => UpdatedClosingTime(server)({poll, closesAt: soSoon}, cb)), |
48 | - pull.asyncMap((m, cb) => UpdatedClosingTime(server)({poll, closesAt: agesAgo}, cb)), | |
43 | + pull.asyncMap((m, cb) => UpdatedClosingTime(server)({poll, closesAt: agesAway}, cb)), | |
49 | 44 | pull.asyncMap((t, cb) => piet.publish(t, cb)), |
50 | 45 | pull.drain( |
51 | 46 | m => {}, // console.log(m.value.content.type), |
52 | 47 | onDone |
@@ -65,9 +60,9 @@ | ||
65 | 60 | t.equal(data.title, poll.value.content.title, 'has title') |
66 | 61 | |
67 | 62 | t.equal(data.positions.length, 2, 'has positions') |
68 | 63 | |
69 | - t.equal(data.closesAt, agesAgo, 'gets the most recently published updated closing time') | |
64 | + t.equal(data.closesAt, agesAway, 'gets the most recently published updated closing time') | |
70 | 65 | |
71 | 66 | const positions = data.positions |
72 | 67 | t.deepEqual(positions[0].value.content.branch, [], 'first published position has no branch') |
73 | 68 | t.deepEqual(positions[1].value.content.branch, [positions[0].key], 'second published branch has first position as branch') |
Built with git-ssb-web