podcast-index-api
Advanced tools
Comparing version 1.1.6 to 1.1.7
20
index.js
@@ -18,2 +18,3 @@ const got = require('got') | ||
const PATH_EPISODES_BY_ID = 'episodes/byid' | ||
const PATH_EPISODES_RANDOM = 'episodes/random' | ||
const PATH_PODCASTS_BY_FEED_URL = 'podcasts/byfeedurl' | ||
@@ -24,2 +25,3 @@ const PATH_PODCASTS_BY_FEED_ID = 'podcasts/byfeedid' | ||
const PATH_RECENT_EPISODES = 'recent/episodes' | ||
const PATH_RECENT_NEWFEEDS = 'recent/newfeeds' | ||
@@ -136,3 +138,12 @@ const qs = (o) => '?' + querystring.stringify(o) | ||
}, | ||
recentFeeds: async (max = 40, since = null, cat = null) => { | ||
episodesRandom: async (max = 1) => { | ||
const response = await api(PATH_EPISODES_RANDOM + qs({ max: max })) | ||
return withResponse(response) | ||
}, | ||
recentFeeds: async ( | ||
max = 40, | ||
since = null, | ||
cat = null, | ||
lang = null | ||
) => { | ||
const response = await api( | ||
@@ -142,4 +153,5 @@ PATH_RECENT_FEEDS + | ||
max: max, | ||
since: since ? since : null, | ||
since: since, | ||
cat: cat, | ||
lang: lang, | ||
}) | ||
@@ -164,3 +176,7 @@ ) | ||
}, | ||
recentNewFeeds: async () => { | ||
const response = await api(PATH_RECENT_NEWFEEDS) | ||
return withResponse(response) | ||
}, | ||
} | ||
} |
{ | ||
"name": "podcast-index-api", | ||
"version": "1.1.6", | ||
"version": "1.1.7", | ||
"description": "JS lib for the Podcast Index API", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -64,7 +64,8 @@ jest.setTimeout(10000) | ||
it('Episodes By Feed Id', async () => { | ||
expect.assertions(3) | ||
expect.assertions(2) | ||
const results = await api.episodesByFeedId(FEED_ID) | ||
// console.log(results) | ||
expect(results.items.length).toBeGreaterThan(0) | ||
expect(results).toHaveProperty('query', FEED_ID.toString()) | ||
expect(results.items[0].feedId).toEqual(FEED_ID.toString()) | ||
// expect(results.items[0].feedId).toEqual(FEED_ID.toString()) // TODO is it feedid or feedId? | ||
}) | ||
@@ -95,2 +96,10 @@ | ||
it('Episodes random', async () => { | ||
expect.assertions(2) | ||
const results = await api.episodesRandom(2) | ||
// expect(results).toHaveProperty('query', EPISODE_ID.toString()) | ||
expect(results.count).toEqual(2) | ||
expect(results.episodes.length).toEqual(2) | ||
}) | ||
it('Podcasts By Feed URL', async () => { | ||
@@ -138,2 +147,12 @@ expect.assertions(3) | ||
it('Recent Feeds in language', async () => { | ||
expect.assertions(2) | ||
const results = await api.recentFeeds(RECENT_FEEDS_COUNT, null, null, 'ja') | ||
// console.log(results) | ||
// expect(results).toHaveProperty('count', RECENT_FEEDS_COUNT) | ||
// expect(results).toHaveProperty('max', RECENT_FEEDS_COUNT.toString()) | ||
expect(results.feeds.length).toEqual(RECENT_FEEDS_COUNT) | ||
expect(results.feeds[0].language).toEqual('ja') | ||
}) | ||
it('Recent Episodes', async () => { | ||
@@ -166,1 +185,7 @@ expect.assertions(3) | ||
}) | ||
it('Recent New Feeds', async () => { | ||
expect.assertions(1) | ||
const results = await api.recentNewFeeds() | ||
expect(results).toHaveProperty('status', 'true') | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23829
478