git ssb

0+

Piet / ssb-loomio



Tree: 18f9223076dfa1bbba1b0c3dcc24fa951ea62e93

Files: 18f9223076dfa1bbba1b0c3dcc24fa951ea62e93 / test / position / sync / isPosition.test.js

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

Built with git-ssb-web