-
Notifications
You must be signed in to change notification settings - Fork 6
/
tests.js
32 lines (27 loc) · 1.34 KB
/
tests.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
var tap = require('tap'),
slackify = require('./slackify-html');
tap.test('simple', function simple(t) {
t.equals(slackify('test'), 'test');
t.equals(slackify('test 1'), 'test 1');
t.end();
});
tap.test('tags', function tags(t) {
t.equals(slackify('test <b>bold</b>'), 'test *bold*');
t.equals(slackify('test <a href="http://example.com">example link</b>'), 'test <http://example.com|example link>');
t.end();
});
tap.test('malformed html', function invalid(t) {
t.equals(slackify('test <b>asd'), 'test *asd*');
t.equals(slackify('<sad>sab tag</sad>'), 'sab tag');
t.equals(slackify('<sad'), '');
t.end();
});
tap.test('empty', function empty(t) {
t.equals(slackify(''), '');
t.end();
});
tap.test('vcheck example', function vcheck(t) {
t.equals(slackify('<b>2.4-SNAPSHOT</b> • revision <a href="https://a-team.csint.cz/stash/projects/webapi/repos/webapi/commits/a245dc97ec7bbe9ed6cb9fc1025dd846fefc7c89">a245dc9</a> • build 2015-09-07 14:06 • wbl 1.3.33 • <a href="http://www.csast.csas.cz/at/webapi/api/v1/version">details »</a>'),
'*2.4-SNAPSHOT* • revision <https://a-team.csint.cz/stash/projects/webapi/repos/webapi/commits/a245dc97ec7bbe9ed6cb9fc1025dd846fefc7c89|a245dc9> • build 2015-09-07 14:06 • wbl 1.3.33 • <http://www.csast.csas.cz/at/webapi/api/v1/version|details »>');
t.end();
});