Files: 643bab9db6b1262b4a735b2ee95447c1bab835f3 / test / poll / sync / isPoll.test.js
797 bytesRaw
1 | const test = require('tape') |
2 | const ChooseOne = require('../../../poll/sync/chooseOne') |
3 | const isPoll = require('../../../isPoll') |
4 | |
5 | // this is for testing the attributes that are required for all polls |
6 | |
7 | test('Poll - common requirements', function (t) { |
8 | var missingTitle = ChooseOne({ |
9 | choices: [1, 2, 'three'], |
10 | closesAt: Date.now() |
11 | }) |
12 | t.false(isPoll(missingTitle), 'needs title') |
13 | |
14 | var missingClosesAt = ChooseOne({ |
15 | choices: [1, 2, 'three'], |
16 | title: 'how many food' |
17 | }) |
18 | t.false(isPoll(missingClosesAt), 'needs closes at') |
19 | |
20 | var missingDetails = { |
21 | type: 'poll', |
22 | pollDetails: undefined, |
23 | title: 'how many food', |
24 | closesAt: Date.now() |
25 | } |
26 | t.false(isPoll(missingDetails), 'needs details') |
27 | t.true(isPoll.errors, 'failing validations have errors') |
28 | |
29 | t.end() |
30 | }) |
31 |
Built with git-ssb-web