git ssb

0+

cel / ssb-mentions



Commit 3557c736edb5dd3f5283b94eec65b5c002ebb2d8

Test

Charles Lehner committed on 3/29/2016, 8:01:18 PM
Parent: aec7de127e5079a937ab356946f2ff7b825f2a7d

Files changed

package.jsonchanged
test/mentions.jsadded
package.jsonView
@@ -10,11 +10,13 @@
1010 "dependencies": {
1111 "ssb-marked": "^0.5.4",
1212 "ssb-ref": "^2.3.0"
1313 },
14- "devDependencies": {},
14 + "devDependencies": {
15 + "tape": "^4.5.1"
16 + },
1517 "scripts": {
16- "test": "set -e; for t in test/*.js; do node $t; done"
18 + "test": "tape test/*.js"
1719 },
1820 "author": "Dominic Tarr <dominic.tarr@gmail.com> (http://dominictarr.com)",
1921 "license": "MIT"
2022 }
test/mentions.jsView
@@ -1,0 +1,31 @@
1 +var test = require('tape')
2 +var mentions = require('../')
3 +
4 +var id = {
5 + feed: '@3HO6R2i60XNR3h6XCHAWCdt1k9Dwy+gaa2rVs6LzZ6Y=.ed25519',
6 + msg: '%A2LvseOYKDXyuSGlXl3Sz0F5j2khVCN6JTf8ORD/tM8=.sha256',
7 + blob: '&9SSTQys34p9f4zqjxvRwENjFX0JapgtesRey7+fxK14=.sha256'
8 +}
9 +id.all = [id.feed, id.msg, id.blob].join(' ')
10 +
11 +var text = {
12 + feed: '[@feed](' + id.feed + ')',
13 + msg: '[a msg](' + id.msg + ')',
14 + blob: '[a blob](' + id.blob + ')'
15 +}
16 +text.all = [text.feed, text.msg, text.blob].join(' ')
17 +
18 +var linkMention = {
19 + feed: [ { link: id.feed, name: 'feed', rel: 'mentions' } ],
20 + msg: [ { link: id.msg, name: 'a msg', rel: 'mentions' } ],
21 + blob: [ { link: id.blob, name: 'a blob', rel: 'mentions' } ]
22 +}
23 +linkMention.all = linkMention.feed.concat(linkMention.msg, linkMention.blob)
24 +
25 +test('mentions in links are detected', function (t) {
26 + t.deepEquals(mentions(text.feed), linkMention.feed, 'feed link')
27 + t.deepEquals(mentions(text.msg), linkMention.msg, 'msg link')
28 + t.deepEquals(mentions(text.blob), linkMention.blob, 'blob link')
29 + t.deepEquals(mentions(text.all), linkMention.all, 'all links')
30 + t.end()
31 +})

Built with git-ssb-web