git ssb

0+

mixmix / scuttle-blog



Commit c22975ff5c372669572525d717f2296ea5c14129

fix isBlog to handle null summary/ thumbail

mix irving committed on 5/28/2018, 4:24:27 AM
Parent: 0d98a03886c5b5f3da8235f442e83c86a9b7794a

Files changed

schema/blog.jschanged
tests/sync/isBlog.jschanged
schema/blog.jsView
@@ -7,9 +7,19 @@
77 properties: {
88 type: {type: 'string', pattern: 'blog'},
99 title: {type: 'string'},
1010 blog: {type: 'string', pattern: blobIdRegex},
11- summary: {type: 'string'},
12- thumbnail: {type: 'string', pattern: blobIdRegex},
11 + summary: {
12 + oneOf: [
13 + {type: 'string'},
14 + {type: 'null'}
15 + ]
16 + },
17 + thumbnail: {
18 + oneOf: [
19 + {type: 'string', pattern: blobIdRegex},
20 + {type: 'null'}
21 + ]
22 + },
1323 channel: {type: 'string'}
1424 }
1525 }
tests/sync/isBlog.jsView
@@ -17,8 +17,16 @@
1717 blog: '&sfoIYo0kKKGI+TJYnznVDSs3BM/HjMWdCPXirvj9BfE=.sha256'
1818 }
1919 t.ok(isBlog(simpleBlog), 'validates simple blog')
2020
21 + const emptyThumbnail = {
22 + type: 'blog',
23 + title: 'An important idea',
24 + blog: '&sfoIYo0kKKGI+TJYnznVDSs3BM/HjMWdCPXirvj9BfE=.sha256',
25 + thumbnail: null
26 + }
27 + t.ok(isBlog(emptyThumbnail), 'validates simple blog with empty thumbnail')
28 +
2129 const incompleteBlog = {
2230 type: 'blog',
2331 title: 'An important idea'
2432 }
@@ -68,7 +76,8 @@
6876 'dest': '#cooperative',
6977 'rts': 1518568914727
7078 }
7179 t.ok(isBlog(actualBlog), 'validates a blog from ticktack')
80 + if (!isBlog(actualBlog)) console.log(isBlog.errors)
7281
7382 t.end()
7483 })

Built with git-ssb-web