Files: 34520bc583f5508541b906f83cc6473ee08991e3 / 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