1 | 'use strict'
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 | const fs = require('fs')
|
9 | const parse = require('./lib/parse')
|
10 | const path = require('path')
|
11 | const { test } = require('tap')
|
12 |
|
13 | test('the new yorker', (t) => {
|
14 | const p = path.join(__dirname, 'data', 'newyorker.xml')
|
15 | const xml = fs.readFileSync(p)
|
16 |
|
17 | const wanted = [
|
18 | ['feed', {
|
19 | link: 'http://www.newyorker.com/',
|
20 | title: 'The New Yorker: Blogs'
|
21 | }],
|
22 | ['finish'],
|
23 | ['end']
|
24 | ]
|
25 |
|
26 | parse({ t: t, xml: xml, wanted: wanted }, (er) => {
|
27 | t.ok(!er)
|
28 | t.end()
|
29 | })
|
30 | })
|
31 |
|
32 | test('the talk show', (t) => {
|
33 | const p = path.join(__dirname, 'data', 'thetalkshow.xml')
|
34 | const xml = fs.readFileSync(p)
|
35 |
|
36 | const wanted = [
|
37 | ['feed', {
|
38 | link: 'http://daringfireball.net/thetalkshow',
|
39 | title: 'The Talk Show With John Gruber'
|
40 | }],
|
41 | ['finish'],
|
42 | ['end']
|
43 | ]
|
44 |
|
45 | parse({ t: t, xml: xml, wanted: wanted }, (er) => {
|
46 | t.ok(!er)
|
47 | t.end()
|
48 | })
|
49 | })
|