git ssb

0+

mixmix / ssb-gathering-schema



Tree: e4eac9ccb82c20dcc8e3e9ea749f3557e168ec56

Files: e4eac9ccb82c20dcc8e3e9ea749f3557e168ec56 / attendee / validator.test.js

801 bytesRaw
1const test = require('tape')
2const valid = require('./validator')
3
4const Attendee = () => {
5 return {
6 type: 'about',
7 about: '%WcE/QeRq1DQn5L+xP696fLq6qfIvRS4DBt4QXicas0A=.sha256',
8 attendee: {
9 link: '@ye+QM09iPcDJD6YvQYjoQc7sLF/IFhmNbEqgdzQo3lQ=.ed25519',
10 remove: true
11 }
12 }
13}
14
15test('is-attendee', t => {
16 t.true(valid(Attendee()), 'remove attendee')
17
18 const withoutRemove = Attendee()
19 delete withoutRemove.attendee.remove
20 t.true(valid(withoutRemove), 'add attendee')
21
22 const withoutAttendee = Attendee()
23 delete withoutAttendee.attendee
24 t.false(valid(withoutAttendee), 'must have attendee prop')
25
26 const incorrectAttendee = Attendee()
27 incorrectAttendee.attendee.link = 'mix'
28 t.false(valid(incorrectAttendee), 'attendee.link must be a feedId')
29
30 t.end()
31})
32

Built with git-ssb-web