Files: 3557c736edb5dd3f5283b94eec65b5c002ebb2d8 / test / mentions.js
1101 bytesRaw
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 | }) |
32 |
Built with git-ssb-web