git ssb

0+

Piet / ssb-loomio



Commit c86fc504a04ac3e334970e63650f800d6ad19401

Caps on factory functions.

Piet Geursen committed on 3/8/2018, 3:28:09 AM
Parent: f9c8608d388933583c65f43ed6750ec4832159db

Files changed

position/sync/chooseOneResults.jschanged
test/errors/sync/index.test.jschanged
position/sync/chooseOneResults.jsView
@@ -1,7 +1,7 @@
11 const isArray = require('isarray')
2-const positionChoiceError = require('../../errors/sync/positionChoiceError')
3-const positionLateError = require('../../errors/sync/positionLateError')
2+const PositionChoiceError = require('../../errors/sync/positionChoiceError')
3+const PositionLateError = require('../../errors/sync/positionLateError')
44
55 // Expects `poll` and `position` objects passed in to be of shape:
66 // {
77 // key,
@@ -18,14 +18,14 @@
1818 const { author, content } = position.value
1919 const { choice } = content.positionDetails
2020
2121 if (isInvalidChoice({position, poll})) {
22- results.errors.push(positionChoiceError({position}))
22+ results.errors.push(PositionChoiceError({position}))
2323 return results
2424 }
2525
2626 if (isPositionLate({position, poll})) {
27- results.errors.push(positionLateError({position}))
27+ results.errors.push(PositionLateError({position}))
2828 return results
2929 }
3030
3131 // TODO convert from Array to Object
test/errors/sync/index.test.jsView
@@ -4,10 +4,10 @@
44 const isPositionLateError = require('../../../errors/sync/isPositionLateError')()
55 const isPositionTypeError = require('../../../errors/sync/isPositionTypeError')()
66
77 const positionTypeError = require('../../../errors/sync/positionTypeError')
8-const positionLateError = require('../../../errors/sync/positionLateError')
9-const positionChoiceError = require('../../../errors/sync/positionChoiceError')
8+const PositionLateError = require('../../../errors/sync/positionLateError')
9+const PositionChoiceError = require('../../../errors/sync/positionChoiceError')
1010
1111 const ChooseOne = require('../../../position/sync/chooseOne')
1212
1313 test('positionTypeError', function (t) {
@@ -27,12 +27,12 @@
2727 var validPosition = ChooseOne({
2828 poll: '%t+PhrNxxXkw/jMo6mnwUWfFjJapoPWxzsQoe0Np+nYw=.sha256',
2929 choice: 0
3030 })
31- var invalidError = positionLateError({})
31+ var invalidError = PositionLateError({})
3232 t.false(isPositionTypeError(invalidError), 'catches invalid error')
3333
34- var validError = positionLateError({position: validPosition})
34+ var validError = PositionLateError({position: validPosition})
3535 t.true(isPositionLateError(validError), 'validates valid error')
3636 t.end()
3737 })
3838
@@ -40,11 +40,11 @@
4040 var validPosition = ChooseOne({
4141 poll: '%t+PhrNxxXkw/jMo6mnwUWfFjJapoPWxzsQoe0Np+nYw=.sha256',
4242 choice: 0
4343 })
44- var invalidError = positionChoiceError({})
44+ var invalidError = PositionChoiceError({})
4545 t.false(isPositionChoiceError(invalidError), 'catches invalid error')
4646
47- var validError = positionChoiceError({position: validPosition})
47+ var validError = PositionChoiceError({position: validPosition})
4848 t.true(isPositionChoiceError(validError), 'validates valid error')
4949 t.end()
5050 })

Built with git-ssb-web