1 | 'use strict'
|
2 |
|
3 |
|
4 |
|
5 | const parse = require('./lib/parse')
|
6 | const pickup = require('../')
|
7 | const { test } = require('tap')
|
8 |
|
9 | test('media-thumbnail', (t) => {
|
10 | const xml =
|
11 | `<rss><channel>
|
12 | <item>
|
13 | <description><![CDATA[<sender>John Smith</sender>]]></description>
|
14 | </item>
|
15 | </channel></rss>`
|
16 |
|
17 | const wanted = [
|
18 | ['entry', pickup.entry({ summary: '<sender>John Smith</sender>' })],
|
19 | ['feed', {}],
|
20 | ['finish'],
|
21 | ['end']
|
22 | ]
|
23 |
|
24 | parse({ t: t, xml: xml, wanted: wanted }, (er) => {
|
25 | t.ok(!er)
|
26 | t.end()
|
27 | })
|
28 | })
|
29 |
|
30 | test('whitespace', (t) => {
|
31 | const xml =
|
32 | `<rss><channel>
|
33 | <item>
|
34 | <content:encoded>
|
35 | <![CDATA[spacetime is four dimensional]]>
|
36 | </content:encoded>
|
37 | </item>
|
38 | </channel></rss>`
|
39 |
|
40 | const wanted = [
|
41 | ['entry', pickup.entry({ summary: 'spacetime is four dimensional' })],
|
42 | ['feed', {}],
|
43 | ['finish'],
|
44 | ['end']
|
45 | ]
|
46 |
|
47 | parse({ t: t, xml: xml, wanted: wanted }, (er) => {
|
48 | t.ok(!er)
|
49 | t.end()
|
50 | })
|
51 | })
|