Files: d022ea7ba118fcb624a4afe57ec5b1be07d30313 / test / poll / sync / chooseOne.test.js
789 bytesRaw
1 | const test = require('tape') |
2 | const ChooseOne = require('../../../poll/sync/chooseOne') |
3 | const isPoll = require('../../../isPoll') |
4 | |
5 | test('Position - ChooseOne', function (t) { |
6 | var invalidPoll = ChooseOne({ |
7 | }) |
8 | t.false(isPoll(invalidPoll), 'invalid') |
9 | |
10 | var validPoll = ChooseOne({ |
11 | title: 'how many food', |
12 | choices: [1, 2, 'three'], |
13 | closesAt: new Date().toISOString() |
14 | }) |
15 | t.true(isPoll(validPoll), 'simple (passes isPoll)') |
16 | t.true(isPoll.chooseOne(validPoll), 'simple (passes isPoll.chooseOne)') |
17 | |
18 | var fullPollMsg = { |
19 | key: '%somekey', |
20 | value: { |
21 | content: validPoll |
22 | } |
23 | } |
24 | t.true(isPoll(fullPollMsg), 'simple (full msg)') |
25 | // NOTE - we might want an isChooseOnePoll in future |
26 | // t.true(isChooseOnePoll(fullPollMsg), 'simple (full msg)') |
27 | |
28 | t.end() |
29 | }) |
30 |
Built with git-ssb-web