Files: f368010bd5cd7dd957193a674e18bd6e6cad8233 / test / position / sync / chooseOne.test.js
1054 bytesRaw
1 | const test = require('tape') |
2 | const ChooseOne = require('../../../position/sync/chooseOne') |
3 | const isPosition = require('../../../isPosition') |
4 | |
5 | test('Position - ChooseOne', function (t) { |
6 | var missingChoice = ChooseOne({ |
7 | poll: '%t+PhrNxxXkw/jMo6mnwUWfFjJapoPWxzsQoe0Np+nYw=.sha256' |
8 | }) |
9 | t.false(isPosition(missingChoice), 'missing a choice') |
10 | |
11 | var missingPoll = ChooseOne({ |
12 | choice: 0 |
13 | }) |
14 | t.false(isPosition(missingPoll), 'missing a poll') |
15 | |
16 | var brokenPoll = ChooseOne({ |
17 | poll: 'dog?', |
18 | choice: 0 |
19 | }) |
20 | t.false(isPosition(missingPoll), 'does not reference a poll') |
21 | |
22 | var validPosition = ChooseOne({ |
23 | poll: '%t+PhrNxxXkw/jMo6mnwUWfFjJapoPWxzsQoe0Np+nYw=.sha256', |
24 | choice: 0 |
25 | }) |
26 | t.true(isPosition(validPosition), 'simple') |
27 | |
28 | var fullPositionMsg = { |
29 | key: '%somekey', |
30 | value: { |
31 | content: validPosition |
32 | } |
33 | } |
34 | t.true(isPosition(fullPositionMsg), 'simple (full msg)') |
35 | // NOTE - we might want an isChooseOnePosition in future |
36 | // t.true(isChooseOnePosition(fullPositionMsg), 'simple (full msg)') |
37 | |
38 | t.end() |
39 | }) |
40 |
Built with git-ssb-web