Files: 9bf2bbbd3ecdc8c850b63aad19ada17d6bf593c7 / test / poll / sync / buildChooseOne.test.js
816 bytesRaw
1 | const test = require('tape') |
2 | const ChooseOne = require('../../../poll/sync/buildChooseOne') |
3 | const {isPoll, isChooseOnePoll} = require('ssb-poll-schema') |
4 | |
5 | test('poll.sync.buildeChooseOne', 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(isChooseOnePoll(validPoll), 'simple (passes isChooseOnePoll)') |
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