git ssb

0+

Piet / ssb-loomio



Commit 5a278075ec43325cf000c2fcb66c71b38a75df86

Pass all the tests!!!!

Piet Geursen committed on 3/15/2018, 4:57:57 AM
Parent: 19874c0c0d66afbcbbf49555bb33b9b4de8909e4

Files changed

test/errors/sync/index.test.jschanged
test/errors/sync/index.test.jsView
@@ -1,5 +1,7 @@
11 const test = require('tape')
2+const pull = require('pull-stream')
3+const pullAsync = require('pull-async')
24
35 const isPositionChoiceError = require('../../../errors/sync/isPositionChoiceError')
46 const isPositionLateError = require('../../../errors/sync/isPositionLateError')
57 const isPositionTypeError = require('../../../errors/sync/isPositionTypeError')
@@ -7,47 +9,63 @@
79 const PositionTypeError = require('../../../errors/sync/positionTypeError')
810 const PositionLateError = require('../../../errors/sync/positionLateError')
911 const PositionChoiceError = require('../../../errors/sync/positionChoiceError')
1012
11-const ChooseOne = require('../../../position/sync/chooseOne')
13+const ChooseOne = require('../../../position/async/chooseOne')()
1214
1315 test('positionTypeError', function (t) {
14- const validPosition = ChooseOne({
15- poll: '%t+PhrNxxXkw/jMo6mnwUWfFjJapoPWxzsQoe0Np+nYw=.sha256',
16- choice: 0
17- })
16+ pull(
17+ pullAsync(cb => {
18+ ChooseOne({
19+ poll: '%t+PhrNxxXkw/jMo6mnwUWfFjJapoPWxzsQoe0Np+nYw=.sha256',
20+ choice: 0
21+ }, cb)
22+ }),
23+ pull.drain(validPosition => {
24+ var invalidError = PositionTypeError({})
25+ t.false(isPositionTypeError(invalidError), 'catches invalid error')
1826
19- var invalidError = PositionTypeError({})
20- t.false(isPositionTypeError(invalidError), 'catches invalid error')
27+ var validError = PositionTypeError({position: validPosition})
28+ t.true(isPositionTypeError(validError), 'validates valid error')
29+ t.end()
30+ })
2131
22- var validError = PositionTypeError({position: validPosition})
23- t.true(isPositionTypeError(validError), 'validates valid error')
24- t.end()
32+ )
2533 })
2634
2735 test('positionLateError', function (t) {
28- const validPosition = ChooseOne({
29- poll: '%t+PhrNxxXkw/jMo6mnwUWfFjJapoPWxzsQoe0Np+nYw=.sha256',
30- choice: 0
31- })
36+ pull(
37+ pullAsync(cb => {
38+ ChooseOne({
39+ poll: '%t+PhrNxxXkw/jMo6mnwUWfFjJapoPWxzsQoe0Np+nYw=.sha256',
40+ choice: 0
41+ }, cb)
42+ }),
43+ pull.drain(validPosition => {
44+ var invalidError = PositionLateError({})
45+ t.false(isPositionTypeError(invalidError), 'catches invalid error')
3246
33- var invalidError = PositionLateError({})
34- t.false(isPositionTypeError(invalidError), 'catches invalid error')
35-
36- var validError = PositionLateError({position: validPosition})
37- t.true(isPositionLateError(validError), 'validates valid error')
38- t.end()
47+ var validError = PositionLateError({position: validPosition})
48+ t.true(isPositionLateError(validError), 'validates valid error')
49+ t.end()
50+ })
51+ )
3952 })
4053
4154 test('positionChoiceError', function (t) {
42- const validPosition = ChooseOne({
43- poll: '%t+PhrNxxXkw/jMo6mnwUWfFjJapoPWxzsQoe0Np+nYw=.sha256',
44- choice: 0
45- })
55+ pull(
56+ pullAsync(cb => {
57+ ChooseOne({
58+ poll: '%t+PhrNxxXkw/jMo6mnwUWfFjJapoPWxzsQoe0Np+nYw=.sha256',
59+ choice: 0
60+ }, cb)
61+ }),
62+ pull.drain(validPosition => {
63+ var invalidError = PositionChoiceError({})
64+ t.false(isPositionChoiceError(invalidError), 'catches invalid error')
4665
47- var invalidError = PositionChoiceError({})
48- t.false(isPositionChoiceError(invalidError), 'catches invalid error')
49-
50- var validError = PositionChoiceError({position: validPosition})
51- t.true(isPositionChoiceError(validError), 'validates valid error')
52- t.end()
66+ var validError = PositionChoiceError({position: validPosition})
67+ t.true(isPositionChoiceError(validError), 'validates valid error')
68+ t.end()
69+ })
70+ )
5371 })

Built with git-ssb-web