rss.today 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +702 -0
- package/dist/atom1.d.ts +8 -0
- package/dist/atom1.d.ts.map +1 -0
- package/dist/atom1.js +195 -0
- package/dist/atom1.js.map +1 -0
- package/dist/config/index.d.ts +2 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +2 -0
- package/dist/config/index.js.map +1 -0
- package/dist/feed.d.ts +54 -0
- package/dist/feed.d.ts.map +1 -0
- package/dist/feed.js +58 -0
- package/dist/feed.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -0
- package/dist/json.d.ts +8 -0
- package/dist/json.d.ts.map +1 -0
- package/dist/json.js +97 -0
- package/dist/json.js.map +1 -0
- package/dist/parser/fields.d.ts +12 -0
- package/dist/parser/fields.d.ts.map +1 -0
- package/dist/parser/fields.js +72 -0
- package/dist/parser/fields.js.map +1 -0
- package/dist/parser/parser.d.ts +93 -0
- package/dist/parser/parser.d.ts.map +1 -0
- package/dist/parser/parser.js +411 -0
- package/dist/parser/parser.js.map +1 -0
- package/dist/parser/utils.d.ts +9 -0
- package/dist/parser/utils.d.ts.map +1 -0
- package/dist/parser/utils.js +81 -0
- package/dist/parser/utils.js.map +1 -0
- package/dist/parser.d.ts +106 -0
- package/dist/parser.d.ts.map +1 -0
- package/dist/parser.js +458 -0
- package/dist/parser.js.map +1 -0
- package/dist/rss0_9.d.ts +4 -0
- package/dist/rss0_9.d.ts.map +1 -0
- package/dist/rss0_9.js +77 -0
- package/dist/rss0_9.js.map +1 -0
- package/dist/rss1.d.ts +4 -0
- package/dist/rss1.d.ts.map +1 -0
- package/dist/rss1.js +92 -0
- package/dist/rss1.js.map +1 -0
- package/dist/rss2.d.ts +7 -0
- package/dist/rss2.d.ts.map +1 -0
- package/dist/rss2.js +267 -0
- package/dist/rss2.js.map +1 -0
- package/dist/test/feed-utils.test.d.ts +2 -0
- package/dist/test/feed-utils.test.d.ts.map +1 -0
- package/dist/test/feed-utils.test.js +279 -0
- package/dist/test/feed-utils.test.js.map +1 -0
- package/dist/test/feed.test.d.ts +2 -0
- package/dist/test/feed.test.d.ts.map +1 -0
- package/dist/test/feed.test.js +190 -0
- package/dist/test/feed.test.js.map +1 -0
- package/dist/test/opml.test.d.ts +2 -0
- package/dist/test/opml.test.d.ts.map +1 -0
- package/dist/test/opml.test.js +135 -0
- package/dist/test/opml.test.js.map +1 -0
- package/dist/test/parser-test.cjs +11 -0
- package/dist/test/parser-test.cjs.map +1 -0
- package/dist/test/parser-test.d.cts +2 -0
- package/dist/test/parser-test.d.cts.map +1 -0
- package/dist/test/parser-test01.d.ts +2 -0
- package/dist/test/parser-test01.d.ts.map +1 -0
- package/dist/test/parser-test01.js +19 -0
- package/dist/test/parser-test01.js.map +1 -0
- package/dist/test/parser.test.d.ts +2 -0
- package/dist/test/parser.test.d.ts.map +1 -0
- package/dist/test/parser.test.js +244 -0
- package/dist/test/parser.test.js.map +1 -0
- package/dist/test/test-01.d.ts +2 -0
- package/dist/test/test-01.d.ts.map +1 -0
- package/dist/test/test-01.js +7 -0
- package/dist/test/test-01.js.map +1 -0
- package/dist/test/test-xml2js.d.ts +2 -0
- package/dist/test/test-xml2js.d.ts.map +1 -0
- package/dist/test/test-xml2js.js +43 -0
- package/dist/test/test-xml2js.js.map +1 -0
- package/dist/test/test.d.ts +2 -0
- package/dist/test/test.d.ts.map +1 -0
- package/dist/test/test.js +3 -0
- package/dist/test/test.js.map +1 -0
- package/dist/test/utilities.test.d.ts +2 -0
- package/dist/test/utilities.test.d.ts.map +1 -0
- package/dist/test/utilities.test.js +258 -0
- package/dist/test/utilities.test.js.map +1 -0
- package/dist/types/atom-types.d.ts +100 -0
- package/dist/types/atom-types.d.ts.map +1 -0
- package/dist/types/atom-types.js +2 -0
- package/dist/types/atom-types.js.map +1 -0
- package/dist/types/index.d.ts +63 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/rss-types.d.ts +504 -0
- package/dist/types/rss-types.d.ts.map +1 -0
- package/dist/types/rss-types.js +2 -0
- package/dist/types/rss-types.js.map +1 -0
- package/dist/uitls/format-check.d.ts +7 -0
- package/dist/uitls/format-check.d.ts.map +1 -0
- package/dist/uitls/format-check.js +28 -0
- package/dist/uitls/format-check.js.map +1 -0
- package/dist/uitls/util.d.ts +9 -0
- package/dist/uitls/util.d.ts.map +1 -0
- package/dist/uitls/util.js +81 -0
- package/dist/uitls/util.js.map +1 -0
- package/dist/util/converter.d.ts +5 -0
- package/dist/util/converter.d.ts.map +1 -0
- package/dist/util/converter.js +97 -0
- package/dist/util/converter.js.map +1 -0
- package/dist/util/feed-utils.d.ts +19 -0
- package/dist/util/feed-utils.d.ts.map +1 -0
- package/dist/util/feed-utils.js +157 -0
- package/dist/util/feed-utils.js.map +1 -0
- package/dist/util/opml.d.ts +29 -0
- package/dist/util/opml.d.ts.map +1 -0
- package/dist/util/opml.js +129 -0
- package/dist/util/opml.js.map +1 -0
- package/dist/util/validator.d.ts +10 -0
- package/dist/util/validator.d.ts.map +1 -0
- package/dist/util/validator.js +143 -0
- package/dist/util/validator.js.map +1 -0
- package/dist/util.d.ts +2 -0
- package/dist/util.d.ts.map +1 -0
- package/dist/util.js +7 -0
- package/dist/util.js.map +1 -0
- package/package.json +54 -0
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { mergeFeeds, diffFeeds, filterFeed, filterByCategory, filterByAuthor, filterByDateRange, sortFeed, sortByDate, sortByTitle, limitFeed, deduplicateFeed } from '../util/feed-utils';
|
|
3
|
+
describe('Feed Utilities', () => {
|
|
4
|
+
describe('mergeFeeds', () => {
|
|
5
|
+
it('should merge multiple feeds', () => {
|
|
6
|
+
const feed1 = {
|
|
7
|
+
title: 'Feed 1',
|
|
8
|
+
items: [
|
|
9
|
+
{ title: 'Item 1', link: 'https://example.com/1', pubDate: '2024-01-01' },
|
|
10
|
+
{ title: 'Item 2', link: 'https://example.com/2', pubDate: '2024-01-02' }
|
|
11
|
+
]
|
|
12
|
+
};
|
|
13
|
+
const feed2 = {
|
|
14
|
+
title: 'Feed 2',
|
|
15
|
+
items: [
|
|
16
|
+
{ title: 'Item 3', link: 'https://example.com/3', pubDate: '2024-01-03' },
|
|
17
|
+
{ title: 'Item 4', link: 'https://example.com/4', pubDate: '2024-01-04' }
|
|
18
|
+
]
|
|
19
|
+
};
|
|
20
|
+
const merged = mergeFeeds([feed1, feed2]);
|
|
21
|
+
expect(merged.items).toHaveLength(4);
|
|
22
|
+
expect(merged.title).toContain('Merged');
|
|
23
|
+
});
|
|
24
|
+
it('should remove duplicates when merging', () => {
|
|
25
|
+
const feed1 = {
|
|
26
|
+
title: 'Feed 1',
|
|
27
|
+
items: [
|
|
28
|
+
{ title: 'Item 1', link: 'https://example.com/1', pubDate: '2024-01-01' }
|
|
29
|
+
]
|
|
30
|
+
};
|
|
31
|
+
const feed2 = {
|
|
32
|
+
title: 'Feed 2',
|
|
33
|
+
items: [
|
|
34
|
+
{ title: 'Item 1', link: 'https://example.com/1', pubDate: '2024-01-01' }
|
|
35
|
+
]
|
|
36
|
+
};
|
|
37
|
+
const merged = mergeFeeds([feed1, feed2]);
|
|
38
|
+
expect(merged.items).toHaveLength(1);
|
|
39
|
+
});
|
|
40
|
+
it('should throw error for zero feeds', () => {
|
|
41
|
+
expect(() => mergeFeeds([])).toThrow('Cannot merge zero feeds');
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
describe('diffFeeds', () => {
|
|
45
|
+
it('should detect added items', () => {
|
|
46
|
+
const oldFeed = {
|
|
47
|
+
title: 'Feed',
|
|
48
|
+
items: [
|
|
49
|
+
{ title: 'Item 1', link: 'https://example.com/1' }
|
|
50
|
+
]
|
|
51
|
+
};
|
|
52
|
+
const newFeed = {
|
|
53
|
+
title: 'Feed',
|
|
54
|
+
items: [
|
|
55
|
+
{ title: 'Item 1', link: 'https://example.com/1' },
|
|
56
|
+
{ title: 'Item 2', link: 'https://example.com/2' }
|
|
57
|
+
]
|
|
58
|
+
};
|
|
59
|
+
const diff = diffFeeds(oldFeed, newFeed);
|
|
60
|
+
expect(diff.added).toHaveLength(1);
|
|
61
|
+
expect(diff.added[0].title).toBe('Item 2');
|
|
62
|
+
expect(diff.removed).toHaveLength(0);
|
|
63
|
+
expect(diff.modified).toHaveLength(0);
|
|
64
|
+
expect(diff.unchanged).toHaveLength(1);
|
|
65
|
+
});
|
|
66
|
+
it('should detect removed items', () => {
|
|
67
|
+
const oldFeed = {
|
|
68
|
+
title: 'Feed',
|
|
69
|
+
items: [
|
|
70
|
+
{ title: 'Item 1', link: 'https://example.com/1' },
|
|
71
|
+
{ title: 'Item 2', link: 'https://example.com/2' }
|
|
72
|
+
]
|
|
73
|
+
};
|
|
74
|
+
const newFeed = {
|
|
75
|
+
title: 'Feed',
|
|
76
|
+
items: [
|
|
77
|
+
{ title: 'Item 1', link: 'https://example.com/1' }
|
|
78
|
+
]
|
|
79
|
+
};
|
|
80
|
+
const diff = diffFeeds(oldFeed, newFeed);
|
|
81
|
+
expect(diff.added).toHaveLength(0);
|
|
82
|
+
expect(diff.removed).toHaveLength(1);
|
|
83
|
+
expect(diff.removed[0].title).toBe('Item 2');
|
|
84
|
+
expect(diff.modified).toHaveLength(0);
|
|
85
|
+
expect(diff.unchanged).toHaveLength(1);
|
|
86
|
+
});
|
|
87
|
+
it('should detect modified items', () => {
|
|
88
|
+
const oldFeed = {
|
|
89
|
+
title: 'Feed',
|
|
90
|
+
items: [
|
|
91
|
+
{ title: 'Item 1', link: 'https://example.com/1', description: 'Old description' }
|
|
92
|
+
]
|
|
93
|
+
};
|
|
94
|
+
const newFeed = {
|
|
95
|
+
title: 'Feed',
|
|
96
|
+
items: [
|
|
97
|
+
{ title: 'Item 1', link: 'https://example.com/1', description: 'New description' }
|
|
98
|
+
]
|
|
99
|
+
};
|
|
100
|
+
const diff = diffFeeds(oldFeed, newFeed);
|
|
101
|
+
expect(diff.added).toHaveLength(0);
|
|
102
|
+
expect(diff.removed).toHaveLength(0);
|
|
103
|
+
expect(diff.modified).toHaveLength(1);
|
|
104
|
+
expect(diff.modified[0].description).toBe('New description');
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
describe('filterFeed', () => {
|
|
108
|
+
it('should filter items by predicate', () => {
|
|
109
|
+
const feed = {
|
|
110
|
+
title: 'Feed',
|
|
111
|
+
items: [
|
|
112
|
+
{ title: 'Item 1', link: 'https://example.com/1' },
|
|
113
|
+
{ title: 'Item 2', link: 'https://example.com/2' },
|
|
114
|
+
{ title: 'Item 3', link: 'https://example.com/3' }
|
|
115
|
+
]
|
|
116
|
+
};
|
|
117
|
+
const filtered = filterFeed(feed, (item, index) => index % 2 === 0);
|
|
118
|
+
expect(filtered.items).toHaveLength(2);
|
|
119
|
+
expect(filtered.items[0].title).toBe('Item 1');
|
|
120
|
+
expect(filtered.items[1].title).toBe('Item 3');
|
|
121
|
+
});
|
|
122
|
+
});
|
|
123
|
+
describe('filterByCategory', () => {
|
|
124
|
+
it('should filter items by category', () => {
|
|
125
|
+
const feed = {
|
|
126
|
+
title: 'Feed',
|
|
127
|
+
items: [
|
|
128
|
+
{ title: 'Item 1', link: 'https://example.com/1', categories: [{ name: 'Tech' }] },
|
|
129
|
+
{ title: 'Item 2', link: 'https://example.com/2', categories: [{ name: 'News' }] },
|
|
130
|
+
{ title: 'Item 3', link: 'https://example.com/3', categories: [{ name: 'Tech' }] }
|
|
131
|
+
]
|
|
132
|
+
};
|
|
133
|
+
const filtered = filterByCategory(feed, 'Tech');
|
|
134
|
+
expect(filtered.items).toHaveLength(2);
|
|
135
|
+
});
|
|
136
|
+
});
|
|
137
|
+
describe('filterByAuthor', () => {
|
|
138
|
+
it('should filter items by author', () => {
|
|
139
|
+
const feed = {
|
|
140
|
+
title: 'Feed',
|
|
141
|
+
items: [
|
|
142
|
+
{ title: 'Item 1', link: 'https://example.com/1', author: 'John' },
|
|
143
|
+
{ title: 'Item 2', link: 'https://example.com/2', author: 'Jane' },
|
|
144
|
+
{ title: 'Item 3', link: 'https://example.com/3', author: 'John' }
|
|
145
|
+
]
|
|
146
|
+
};
|
|
147
|
+
const filtered = filterByAuthor(feed, 'John');
|
|
148
|
+
expect(filtered.items).toHaveLength(2);
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
describe('filterByDateRange', () => {
|
|
152
|
+
it('should filter items by date range', () => {
|
|
153
|
+
const feed = {
|
|
154
|
+
title: 'Feed',
|
|
155
|
+
items: [
|
|
156
|
+
{ title: 'Item 1', link: 'https://example.com/1', pubDate: '2024-01-01' },
|
|
157
|
+
{ title: 'Item 2', link: 'https://example.com/2', pubDate: '2024-01-15' },
|
|
158
|
+
{ title: 'Item 3', link: 'https://example.com/3', pubDate: '2024-02-01' }
|
|
159
|
+
]
|
|
160
|
+
};
|
|
161
|
+
const filtered = filterByDateRange(feed, new Date('2024-01-10'), new Date('2024-01-20'));
|
|
162
|
+
expect(filtered.items).toHaveLength(1);
|
|
163
|
+
expect(filtered.items[0].title).toBe('Item 2');
|
|
164
|
+
});
|
|
165
|
+
});
|
|
166
|
+
describe('sortFeed', () => {
|
|
167
|
+
it('should sort items by comparator', () => {
|
|
168
|
+
const feed = {
|
|
169
|
+
title: 'Feed',
|
|
170
|
+
items: [
|
|
171
|
+
{ title: 'Zebra', link: 'https://example.com/1' },
|
|
172
|
+
{ title: 'Apple', link: 'https://example.com/2' },
|
|
173
|
+
{ title: 'Banana', link: 'https://example.com/3' }
|
|
174
|
+
]
|
|
175
|
+
};
|
|
176
|
+
const sorted = sortFeed(feed, (a, b) => {
|
|
177
|
+
const titleA = a.title || "";
|
|
178
|
+
const titleB = b.title || "";
|
|
179
|
+
return titleA.localeCompare(titleB);
|
|
180
|
+
});
|
|
181
|
+
expect(sorted.items[0].title).toBe('Apple');
|
|
182
|
+
expect(sorted.items[1].title).toBe('Banana');
|
|
183
|
+
expect(sorted.items[2].title).toBe('Zebra');
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
describe('sortByDate', () => {
|
|
187
|
+
it('should sort items by date descending', () => {
|
|
188
|
+
const feed = {
|
|
189
|
+
title: 'Feed',
|
|
190
|
+
items: [
|
|
191
|
+
{ title: 'Item 1', link: 'https://example.com/1', pubDate: '2024-01-03' },
|
|
192
|
+
{ title: 'Item 2', link: 'https://example.com/2', pubDate: '2024-01-01' },
|
|
193
|
+
{ title: 'Item 3', link: 'https://example.com/3', pubDate: '2024-01-02' }
|
|
194
|
+
]
|
|
195
|
+
};
|
|
196
|
+
const sorted = sortByDate(feed, 'desc');
|
|
197
|
+
expect(sorted.items[0].pubDate).toBe('2024-01-03');
|
|
198
|
+
expect(sorted.items[1].pubDate).toBe('2024-01-02');
|
|
199
|
+
expect(sorted.items[2].pubDate).toBe('2024-01-01');
|
|
200
|
+
});
|
|
201
|
+
it('should sort items by date ascending', () => {
|
|
202
|
+
const feed = {
|
|
203
|
+
title: 'Feed',
|
|
204
|
+
items: [
|
|
205
|
+
{ title: 'Item 1', link: 'https://example.com/1', pubDate: '2024-01-03' },
|
|
206
|
+
{ title: 'Item 2', link: 'https://example.com/2', pubDate: '2024-01-01' },
|
|
207
|
+
{ title: 'Item 3', link: 'https://example.com/3', pubDate: '2024-01-02' }
|
|
208
|
+
]
|
|
209
|
+
};
|
|
210
|
+
const sorted = sortByDate(feed, 'asc');
|
|
211
|
+
expect(sorted.items[0].pubDate).toBe('2024-01-01');
|
|
212
|
+
expect(sorted.items[1].pubDate).toBe('2024-01-02');
|
|
213
|
+
expect(sorted.items[2].pubDate).toBe('2024-01-03');
|
|
214
|
+
});
|
|
215
|
+
});
|
|
216
|
+
describe('sortByTitle', () => {
|
|
217
|
+
it('should sort items by title ascending', () => {
|
|
218
|
+
const feed = {
|
|
219
|
+
title: 'Feed',
|
|
220
|
+
items: [
|
|
221
|
+
{ title: 'Zebra', link: 'https://example.com/1' },
|
|
222
|
+
{ title: 'Apple', link: 'https://example.com/2' },
|
|
223
|
+
{ title: 'Banana', link: 'https://example.com/3' }
|
|
224
|
+
]
|
|
225
|
+
};
|
|
226
|
+
const sorted = sortByTitle(feed, 'asc');
|
|
227
|
+
expect(sorted.items[0].title).toBe('Apple');
|
|
228
|
+
expect(sorted.items[1].title).toBe('Banana');
|
|
229
|
+
expect(sorted.items[2].title).toBe('Zebra');
|
|
230
|
+
});
|
|
231
|
+
it('should sort items by title descending', () => {
|
|
232
|
+
const feed = {
|
|
233
|
+
title: 'Feed',
|
|
234
|
+
items: [
|
|
235
|
+
{ title: 'Zebra', link: 'https://example.com/1' },
|
|
236
|
+
{ title: 'Apple', link: 'https://example.com/2' },
|
|
237
|
+
{ title: 'Banana', link: 'https://example.com/3' }
|
|
238
|
+
]
|
|
239
|
+
};
|
|
240
|
+
const sorted = sortByTitle(feed, 'desc');
|
|
241
|
+
expect(sorted.items[0].title).toBe('Zebra');
|
|
242
|
+
expect(sorted.items[1].title).toBe('Banana');
|
|
243
|
+
expect(sorted.items[2].title).toBe('Apple');
|
|
244
|
+
});
|
|
245
|
+
});
|
|
246
|
+
describe('limitFeed', () => {
|
|
247
|
+
it('should limit feed items', () => {
|
|
248
|
+
const feed = {
|
|
249
|
+
title: 'Feed',
|
|
250
|
+
items: [
|
|
251
|
+
{ title: 'Item 1', link: 'https://example.com/1' },
|
|
252
|
+
{ title: 'Item 2', link: 'https://example.com/2' },
|
|
253
|
+
{ title: 'Item 3', link: 'https://example.com/3' },
|
|
254
|
+
{ title: 'Item 4', link: 'https://example.com/4' },
|
|
255
|
+
{ title: 'Item 5', link: 'https://example.com/5' }
|
|
256
|
+
]
|
|
257
|
+
};
|
|
258
|
+
const limited = limitFeed(feed, 3);
|
|
259
|
+
expect(limited.items).toHaveLength(3);
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
describe('deduplicateFeed', () => {
|
|
263
|
+
it('should remove duplicate items', () => {
|
|
264
|
+
const feed = {
|
|
265
|
+
title: 'Feed',
|
|
266
|
+
items: [
|
|
267
|
+
{ title: 'Item 1', link: 'https://example.com/1', guid: '1' },
|
|
268
|
+
{ title: 'Item 2', link: 'https://example.com/2', guid: '2' },
|
|
269
|
+
{ title: 'Item 1', link: 'https://example.com/1', guid: '1' },
|
|
270
|
+
{ title: 'Item 3', link: 'https://example.com/3', guid: '3' }
|
|
271
|
+
]
|
|
272
|
+
};
|
|
273
|
+
const deduplicated = deduplicateFeed(feed);
|
|
274
|
+
expect(deduplicated.items).toHaveLength(3);
|
|
275
|
+
expect(deduplicated.items.map(i => i.title)).toEqual(['Item 1', 'Item 2', 'Item 3']);
|
|
276
|
+
});
|
|
277
|
+
});
|
|
278
|
+
});
|
|
279
|
+
//# sourceMappingURL=feed-utils.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feed-utils.test.js","sourceRoot":"","sources":["../../src/test/feed-utils.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,EACL,UAAU,EACV,SAAS,EACT,UAAU,EACV,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,QAAQ,EACR,UAAU,EACV,WAAW,EACX,SAAS,EACT,eAAe,EAChB,MAAM,oBAAoB,CAAC;AAE5B,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAC9B,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE;QAC1B,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;YACrC,MAAM,KAAK,GAAe;gBACxB,KAAK,EAAE,QAAQ;gBACf,KAAK,EAAE;oBACL,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,uBAAuB,EAAE,OAAO,EAAE,YAAY,EAAE;oBACzE,EAAE,KAAK,EAAE,QAAQ,E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AE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,uBAAuB,EAAE,IAAI,EAAE,GAAG,EAAE;oBAC7D,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,uBAAuB,EAAE,IAAI,EAAE,GAAG,EAAE;oBAC7D,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,uBAAuB,EAAE,IAAI,EAAE,GAAG,EAAE;oBAC7D,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,uBAAuB,EAAE,IAAI,EAAE,GAAG,EAAE;iBAC9D;aACF,CAAC;YAEF,MAAM,YAAY,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;YAE3C,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;YAC3C,MAAM,CAAC,YAAY,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC;QACvF,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feed.test.d.ts","sourceRoot":"","sources":["../../src/test/feed.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { describe, it, expect, beforeEach } from 'vitest';
|
|
2
|
+
import { Feed } from '../feed.js';
|
|
3
|
+
describe('Feed', () => {
|
|
4
|
+
let feed;
|
|
5
|
+
beforeEach(() => {
|
|
6
|
+
feed = new Feed({
|
|
7
|
+
title: 'Test Feed',
|
|
8
|
+
description: 'A test feed',
|
|
9
|
+
link: 'https://example.com',
|
|
10
|
+
id: 'https://example.com/feed',
|
|
11
|
+
language: 'en',
|
|
12
|
+
copyright: 'ISC',
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
describe('constructor', () => {
|
|
16
|
+
it('should create a feed with options', () => {
|
|
17
|
+
expect(feed.options.title).toBe('Test Feed');
|
|
18
|
+
expect(feed.options.description).toBe('A test feed');
|
|
19
|
+
expect(feed.options.link).toBe('https://example.com');
|
|
20
|
+
});
|
|
21
|
+
it('should initialize empty arrays', () => {
|
|
22
|
+
expect(feed.items).toEqual([]);
|
|
23
|
+
expect(feed.categories).toEqual([]);
|
|
24
|
+
expect(feed.contributors).toEqual([]);
|
|
25
|
+
expect(feed.extensions).toEqual([]);
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
describe('addItem', () => {
|
|
29
|
+
it('should add an item to the feed', () => {
|
|
30
|
+
const item = {
|
|
31
|
+
title: 'Test Item',
|
|
32
|
+
link: 'https://example.com/item',
|
|
33
|
+
description: 'Test description',
|
|
34
|
+
date: new Date(),
|
|
35
|
+
};
|
|
36
|
+
feed.addItem(item);
|
|
37
|
+
expect(feed.items).toHaveLength(1);
|
|
38
|
+
expect(feed.items[0]).toEqual(item);
|
|
39
|
+
});
|
|
40
|
+
it('should add multiple items', () => {
|
|
41
|
+
feed.addItem({ title: 'Item 1', link: 'https://example.com/1', date: new Date() });
|
|
42
|
+
feed.addItem({ title: 'Item 2', link: 'https://example.com/2', date: new Date() });
|
|
43
|
+
feed.addItem({ title: 'Item 3', link: 'https://example.com/3', date: new Date() });
|
|
44
|
+
expect(feed.items).toHaveLength(3);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
describe('addCategory', () => {
|
|
48
|
+
it('should add a category to the feed', () => {
|
|
49
|
+
feed.addCategory('technology');
|
|
50
|
+
expect(feed.categories).toHaveLength(1);
|
|
51
|
+
expect(feed.categories[0]).toBe('technology');
|
|
52
|
+
});
|
|
53
|
+
it('should add multiple categories', () => {
|
|
54
|
+
feed.addCategory('technology');
|
|
55
|
+
feed.addCategory('programming');
|
|
56
|
+
feed.addCategory('javascript');
|
|
57
|
+
expect(feed.categories).toHaveLength(3);
|
|
58
|
+
expect(feed.categories).toEqual(['technology', 'programming', 'javascript']);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
describe('addContributor', () => {
|
|
62
|
+
it('should add a contributor to the feed', () => {
|
|
63
|
+
const author = {
|
|
64
|
+
name: 'John Doe',
|
|
65
|
+
email: 'john@example.com',
|
|
66
|
+
};
|
|
67
|
+
feed.addContributor(author);
|
|
68
|
+
expect(feed.contributors).toHaveLength(1);
|
|
69
|
+
expect(feed.contributors[0]).toEqual(author);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
describe('addExtension', () => {
|
|
73
|
+
it('should add an extension to the feed', () => {
|
|
74
|
+
const extension = {
|
|
75
|
+
name: 'itunes',
|
|
76
|
+
objects: { author: 'Podcast Author' },
|
|
77
|
+
};
|
|
78
|
+
feed.addExtension(extension);
|
|
79
|
+
expect(feed.extensions).toHaveLength(1);
|
|
80
|
+
expect(feed.extensions[0]).toEqual(extension);
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
describe('rss2', () => {
|
|
84
|
+
it('should generate RSS 2.0 feed', () => {
|
|
85
|
+
feed.addItem({
|
|
86
|
+
title: 'Test Item',
|
|
87
|
+
link: 'https://example.com/item',
|
|
88
|
+
description: 'Test description',
|
|
89
|
+
date: new Date('2024-01-01'),
|
|
90
|
+
});
|
|
91
|
+
const rss = feed.rss2();
|
|
92
|
+
expect(rss).toMatch(/<\?xml version="1\.0" encoding="(UTF-8|utf-8)"\?>/);
|
|
93
|
+
expect(rss).toContain('<rss version="2.0"');
|
|
94
|
+
expect(rss).toContain('<title>Test Feed</title>');
|
|
95
|
+
expect(rss).toContain('<description>A test feed</description>');
|
|
96
|
+
expect(rss).toContain('Test Item');
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
describe('atom1', () => {
|
|
100
|
+
it('should generate Atom 1.0 feed', () => {
|
|
101
|
+
feed.addItem({
|
|
102
|
+
title: 'Test Item',
|
|
103
|
+
link: 'https://example.com/item',
|
|
104
|
+
description: 'Test description',
|
|
105
|
+
date: new Date('2024-01-01'),
|
|
106
|
+
});
|
|
107
|
+
const atom = feed.atom1();
|
|
108
|
+
expect(atom).toMatch(/<\?xml version="1\.0" encoding="(UTF-8|utf-8)"\?>/);
|
|
109
|
+
expect(atom).toContain('<feed xmlns="http://www.w3.org/2005/Atom"');
|
|
110
|
+
expect(atom).toContain('<title>Test Feed</title>');
|
|
111
|
+
expect(atom).toContain('Test Item');
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
describe('json1', () => {
|
|
115
|
+
it('should generate JSON 1.0 feed', () => {
|
|
116
|
+
feed.addItem({
|
|
117
|
+
title: 'Test Item',
|
|
118
|
+
link: 'https://example.com/item',
|
|
119
|
+
description: 'Test description',
|
|
120
|
+
date: new Date('2024-01-01'),
|
|
121
|
+
});
|
|
122
|
+
const json = feed.json1();
|
|
123
|
+
const parsed = JSON.parse(json);
|
|
124
|
+
expect(parsed.version).toBe('https://jsonfeed.org/version/1');
|
|
125
|
+
expect(parsed.title).toBe('Test Feed');
|
|
126
|
+
expect(parsed.items).toHaveLength(1);
|
|
127
|
+
expect(parsed.items[0].title).toBe('Test Item');
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
describe('complete feed generation', () => {
|
|
131
|
+
it('should generate a complete feed with all features', () => {
|
|
132
|
+
// Add categories
|
|
133
|
+
feed.addCategory('technology');
|
|
134
|
+
feed.addCategory('programming');
|
|
135
|
+
// Add contributors
|
|
136
|
+
feed.addContributor({
|
|
137
|
+
name: 'Jane Doe',
|
|
138
|
+
email: 'jane@example.com',
|
|
139
|
+
link: 'https://example.com/jane',
|
|
140
|
+
});
|
|
141
|
+
// Add items with various properties
|
|
142
|
+
feed.addItem({
|
|
143
|
+
title: 'First Post',
|
|
144
|
+
link: 'https://example.com/first',
|
|
145
|
+
description: 'First post content',
|
|
146
|
+
content: 'Full content of the first post',
|
|
147
|
+
author: [{ name: 'Jane Doe' }],
|
|
148
|
+
date: new Date('2024-01-01T00:00:00Z'),
|
|
149
|
+
});
|
|
150
|
+
feed.addItem({
|
|
151
|
+
title: 'Second Post',
|
|
152
|
+
link: 'https://example.com/second',
|
|
153
|
+
description: 'Second post content',
|
|
154
|
+
date: new Date('2024-01-02T00:00:00Z'),
|
|
155
|
+
});
|
|
156
|
+
// Test RSS 2.0 output
|
|
157
|
+
const rss = feed.rss2();
|
|
158
|
+
expect(rss).toContain('First Post');
|
|
159
|
+
expect(rss).toContain('Second Post');
|
|
160
|
+
// Test Atom 1.0 output
|
|
161
|
+
const atom = feed.atom1();
|
|
162
|
+
expect(atom).toContain('First Post');
|
|
163
|
+
expect(atom).toContain('Second Post');
|
|
164
|
+
// Test JSON 1.0 output
|
|
165
|
+
const json = feed.json1();
|
|
166
|
+
const parsed = JSON.parse(json);
|
|
167
|
+
expect(parsed.items).toHaveLength(2);
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
describe('item with enclosures', () => {
|
|
171
|
+
it('should handle items with media enclosures', () => {
|
|
172
|
+
feed.addItem({
|
|
173
|
+
title: 'Podcast Episode',
|
|
174
|
+
link: 'https://example.com/episode',
|
|
175
|
+
description: 'Episode description',
|
|
176
|
+
date: new Date(),
|
|
177
|
+
enclosure: {
|
|
178
|
+
url: 'https://example.com/episode.mp3',
|
|
179
|
+
type: 'audio/mpeg',
|
|
180
|
+
length: 12345678,
|
|
181
|
+
},
|
|
182
|
+
});
|
|
183
|
+
const rss = feed.rss2();
|
|
184
|
+
expect(rss).toContain('<enclosure');
|
|
185
|
+
expect(rss).toContain('url="https://example.com/episode.mp3"');
|
|
186
|
+
expect(rss).toContain('type="audio/mpeg"');
|
|
187
|
+
});
|
|
188
|
+
});
|
|
189
|
+
});
|
|
190
|
+
//# sourceMappingURL=feed.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"feed.test.js","sourceRoot":"","sources":["../../src/test/feed.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QA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G,IAAI,CAAC,KAAK,EAAE,CAAC;YAC1B,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAChC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QACvC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,sBAAsB,EAAE,GAAG,EAAE;QACpC,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;YACnD,IAAI,CAAC,OAAO,CAAC;gBACX,KAAK,EAAE,iBAAiB;gBACxB,IAAI,EAAE,6BAA6B;gBACnC,WAAW,EAAE,qBAAqB;gBAClC,IAAI,EAAE,IAAI,IAAI,EAAE;gBAChB,SAAS,EAAE;oBACT,GAAG,EAAE,iCAAiC;oBACtC,IAAI,EAAE,YAAY;oBAClB,MAAM,EAAE,QAAQ;iBACjB;aACF,CAAC,CAAC;YAEH,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;YACxB,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;YACpC,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,uCAAuC,CAAC,CAAC;YAC/D,MAAM,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;QAC7C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"opml.test.d.ts","sourceRoot":"","sources":["../../src/test/opml.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest';
|
|
2
|
+
import { OPMLParser, OPMLGenerator } from '../util/opml';
|
|
3
|
+
describe('OPML', () => {
|
|
4
|
+
describe('OPMLParser', () => {
|
|
5
|
+
it('should parse a valid OPML document', async () => {
|
|
6
|
+
const opmlXml = `<?xml version="1.0" encoding="UTF-8"?>
|
|
7
|
+
<opml version="1.0">
|
|
8
|
+
<head>
|
|
9
|
+
<title>My Subscriptions</title>
|
|
10
|
+
<dateCreated>2024-01-01T00:00:00Z</dateCreated>
|
|
11
|
+
<ownerName>John Doe</ownerName>
|
|
12
|
+
<ownerEmail>john@example.com</ownerEmail>
|
|
13
|
+
</head>
|
|
14
|
+
<body>
|
|
15
|
+
<outline text="TechCrunch" type="rss" xmlUrl="https://techcrunch.com/feed/" htmlUrl="https://techcrunch.com"/>
|
|
16
|
+
<outline text="BBC News" type="rss" xmlUrl="http://feeds.bbci.co.uk/news/rss.xml" htmlUrl="https://www.bbc.com/news"/>
|
|
17
|
+
</body>
|
|
18
|
+
</opml>`;
|
|
19
|
+
const parser = new OPMLParser();
|
|
20
|
+
const result = await parser.parseOPML(opmlXml);
|
|
21
|
+
expect(result.version).toBe('1.0');
|
|
22
|
+
expect(result.title).toBe('My Subscriptions');
|
|
23
|
+
expect(result.dateCreated).toEqual(new Date('2024-01-01T00:00:00Z'));
|
|
24
|
+
expect(result.ownerName).toBe('John Doe');
|
|
25
|
+
expect(result.ownerEmail).toBe('john@example.com');
|
|
26
|
+
expect(result.outlines).toHaveLength(2);
|
|
27
|
+
});
|
|
28
|
+
it('should parse nested outlines', async () => {
|
|
29
|
+
const opmlXml = `<?xml version="1.0" encoding="UTF-8"?>
|
|
30
|
+
<opml version="1.0">
|
|
31
|
+
<body>
|
|
32
|
+
<outline text="Technology">
|
|
33
|
+
<outline text="TechCrunch" type="rss" xmlUrl="https://techcrunch.com/feed/"/>
|
|
34
|
+
<outline text="Hacker News" type="rss" xmlUrl="https://news.ycombinator.com/rss"/>
|
|
35
|
+
</outline>
|
|
36
|
+
</body>
|
|
37
|
+
</opml>`;
|
|
38
|
+
const parser = new OPMLParser();
|
|
39
|
+
const result = await parser.parseOPML(opmlXml);
|
|
40
|
+
expect(result.outlines).toHaveLength(1);
|
|
41
|
+
expect(result.outlines[0].text).toBe('Technology');
|
|
42
|
+
expect(result.outlines[0].outlines).toHaveLength(2);
|
|
43
|
+
expect(result.outlines[0].outlines[0].text).toBe('TechCrunch');
|
|
44
|
+
});
|
|
45
|
+
it('should parse categories', async () => {
|
|
46
|
+
const opmlXml = `<?xml version="1.0" encoding="UTF-8"?>
|
|
47
|
+
<opml version="1.0">
|
|
48
|
+
<body>
|
|
49
|
+
<outline text="TechCrunch" category="Tech, News" type="rss" xmlUrl="https://techcrunch.com/feed/"/>
|
|
50
|
+
</body>
|
|
51
|
+
</opml>`;
|
|
52
|
+
const parser = new OPMLParser();
|
|
53
|
+
const result = await parser.parseOPML(opmlXml);
|
|
54
|
+
expect(result.outlines[0].category).toEqual(['Tech', 'News']);
|
|
55
|
+
});
|
|
56
|
+
it('should throw error for invalid XML', async () => {
|
|
57
|
+
const invalidXml = 'not xml';
|
|
58
|
+
const parser = new OPMLParser();
|
|
59
|
+
await expect(parser.parseOPML(invalidXml)).rejects.toThrow();
|
|
60
|
+
});
|
|
61
|
+
it('should throw error for missing opml element', async () => {
|
|
62
|
+
const invalidXml = '<?xml version="1.0"?><root></root>';
|
|
63
|
+
const parser = new OPMLParser();
|
|
64
|
+
await expect(parser.parseOPML(invalidXml)).rejects.toThrow('missing root opml element');
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
describe('OPMLGenerator', () => {
|
|
68
|
+
it('should generate valid OPML document', () => {
|
|
69
|
+
const opml = {
|
|
70
|
+
version: '1.0',
|
|
71
|
+
title: 'My Subscriptions',
|
|
72
|
+
dateCreated: new Date('2024-01-01T00:00:00Z'),
|
|
73
|
+
ownerName: 'John Doe',
|
|
74
|
+
ownerEmail: 'john@example.com',
|
|
75
|
+
outlines: [
|
|
76
|
+
{
|
|
77
|
+
text: 'TechCrunch',
|
|
78
|
+
type: 'rss',
|
|
79
|
+
xmlUrl: 'https://techcrunch.com/feed/',
|
|
80
|
+
htmlUrl: 'https://techcrunch.com'
|
|
81
|
+
}
|
|
82
|
+
]
|
|
83
|
+
};
|
|
84
|
+
const generator = new OPMLGenerator();
|
|
85
|
+
const result = generator.generateOPML(opml);
|
|
86
|
+
expect(result).toContain('<?xml version="1.0" encoding="UTF-8"?>');
|
|
87
|
+
expect(result).toContain('<opml version="1.0">');
|
|
88
|
+
expect(result).toContain('<title>My Subscriptions</title>');
|
|
89
|
+
expect(result).toContain('<dateCreated>2024-01-01T00:00:00.000Z</dateCreated>');
|
|
90
|
+
expect(result).toContain('<ownerName>John Doe</ownerName>');
|
|
91
|
+
expect(result).toContain('<outline text="TechCrunch"');
|
|
92
|
+
expect(result).toContain('type="rss"');
|
|
93
|
+
expect(result).toContain('xmlUrl="https://techcrunch.com/feed/"');
|
|
94
|
+
expect(result).toContain('htmlUrl="https://techcrunch.com"');
|
|
95
|
+
});
|
|
96
|
+
it('should generate nested outlines', () => {
|
|
97
|
+
const opml = {
|
|
98
|
+
version: '1.0',
|
|
99
|
+
outlines: [
|
|
100
|
+
{
|
|
101
|
+
text: 'Technology',
|
|
102
|
+
outlines: [
|
|
103
|
+
{
|
|
104
|
+
text: 'TechCrunch',
|
|
105
|
+
type: 'rss',
|
|
106
|
+
xmlUrl: 'https://techcrunch.com/feed/'
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
]
|
|
111
|
+
};
|
|
112
|
+
const generator = new OPMLGenerator();
|
|
113
|
+
const result = generator.generateOPML(opml);
|
|
114
|
+
expect(result).toContain('<outline text="Technology">');
|
|
115
|
+
expect(result).toContain('<outline text="TechCrunch"');
|
|
116
|
+
expect(result).toContain('</outline>');
|
|
117
|
+
});
|
|
118
|
+
it('should escape special characters', () => {
|
|
119
|
+
const opml = {
|
|
120
|
+
version: '1.0',
|
|
121
|
+
outlines: [
|
|
122
|
+
{
|
|
123
|
+
text: 'Tech & "News"',
|
|
124
|
+
type: 'rss',
|
|
125
|
+
xmlUrl: 'https://example.com/feed'
|
|
126
|
+
}
|
|
127
|
+
]
|
|
128
|
+
};
|
|
129
|
+
const generator = new OPMLGenerator();
|
|
130
|
+
const result = generator.generateOPML(opml);
|
|
131
|
+
expect(result).toContain('Tech & "News"');
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
});
|
|
135
|
+
//# sourceMappingURL=opml.test.js.map
|