@link-assistant/web-capture 1.11.0 → 1.11.2
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/CHANGELOG.md +12 -0
- package/package.json +1 -1
- package/tests/unit/search.test.js +19 -0
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -76,6 +76,25 @@ describe('search module (#130)', () => {
|
|
|
76
76
|
});
|
|
77
77
|
});
|
|
78
78
|
|
|
79
|
+
it('keeps URL construction and response parsing transport-independent', () => {
|
|
80
|
+
const sourceUrl = buildSearchUrl('wikipedia', 'formal ai', 1);
|
|
81
|
+
const { results } = parseSearchResults('wikipedia', WIKI_JSON, {
|
|
82
|
+
limit: 1,
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
expect(sourceUrl).toBe(
|
|
86
|
+
'https://en.wikipedia.org/w/rest.php/v1/search/page?q=formal%20ai&limit=1'
|
|
87
|
+
);
|
|
88
|
+
expect(results).toEqual([
|
|
89
|
+
{
|
|
90
|
+
rank: 1,
|
|
91
|
+
title: 'Formal methods',
|
|
92
|
+
url: 'https://en.wikipedia.org/wiki/Formal_methods',
|
|
93
|
+
snippet: 'the study of formal',
|
|
94
|
+
},
|
|
95
|
+
]);
|
|
96
|
+
});
|
|
97
|
+
|
|
79
98
|
describe('parseSearchResults', () => {
|
|
80
99
|
it('normalizes Wikipedia REST JSON and strips markup', () => {
|
|
81
100
|
const { results } = parseSearchResults('wikipedia', WIKI_JSON, {
|