Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

podcast-index-api

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

podcast-index-api - npm Package Compare versions

Comparing version 1.0.1 to 1.1.2

.prettierignore

177

index.js
const got = require('got')
const crypto = require('crypto')
const querystring = require('querystring')
//
// https://api.podcastindex.org/developer_docs
//
const BASE_API_URL = 'https://api.podcastindex.org/api/1.0/'

@@ -17,90 +22,110 @@

const PATH_RECENT_FEEDS = 'recent/feeds'
const PATH_RECENT_EPISODES = 'recent/episodes'
// https://api.podcastindex.org/developer_docs
const qs = (o) => '?' + querystring.stringify(o)
const withResponse = (response) => response.body
const withResponse = response => response.body
module.exports = (key, secret, userAgent) => {
if(!key || !secret) {
throw new Error("API Key and Secret are required from https://api.podcastindex.org/")
if (!key || !secret) {
throw new Error(
'API Key and Secret are required from https://api.podcastindex.org/'
)
}
const api = got.extend({
responseType: 'json',
prefixUrl: BASE_API_URL,
hooks: {
beforeRequest: [
options => {
let dt = new Date().getTime() / 1000
options.headers["User-Agent"] = userAgent || "PodcastIndexBot/@podcast@noagendasocial.com"
options.headers["X-Auth-Date"] = dt
options.headers["X-Auth-Key"] = key
options.headers["Authorization"] =
crypto
.createHash("sha1")
.update(key+secret+dt)
.digest("hex")
}
]
}
hooks: {
beforeRequest: [
(options) => {
let dt = new Date().getTime() / 1000
options.headers['User-Agent'] =
userAgent ||
'PodcastIndexBot/@podcast@noagendasocial.com'
options.headers['X-Auth-Date'] = dt
options.headers['X-Auth-Key'] = key
options.headers['Authorization'] = crypto
.createHash('sha1')
.update(key + secret + dt)
.digest('hex')
},
],
},
})
const podcastsByFeedUrl = async feedUrl => {
const response = await api(PATH_PODCASTS_BY_FEED_URL+'?url='+feedUrl)
return withResponse(response)
}
const podcastsByFeedId = async feedId => {
const response = await api(PATH_PODCASTS_BY_FEED_ID+'?id='+feedId)
return withResponse(response)
}
const podcastsByFeedItunesId = async itunesId => {
const response = await api(PATH_PODCASTS_BY_ITUNES_ID+'?id='+itunesId)
return withResponse(response)
}
const addByFeedUrl = async feedUrl => {
const response = await api(PATH_ADD_BY_FEED_URL+'?url='+feedUrl)
console.log(response)
return withResponse(response)
}
const searchByTerm = async q => {
const response = await api(PATH_SEARCH_BY_TERM+'?q='+q.split(" ").join("+"))
return withResponse(response)
}
const episodesByFeedId = async feedId => {
const response = await api(PATH_EPISODES_BY_FEED_ID+'?id='+feedId)
return withResponse(response)
}
const episodesByFeedUrl = async feedUrl => {
const response = await api(PATH_EPISODES_BY_FEED_URL+'?url='+feedUrl)
return withResponse(response)
}
const episodesByItunesId = async itunesId => {
const response = await api(PATH_EPISODES_BY_ITUNES_ID+'?id='+itunesId)
return withResponse(response)
}
const recentEpisodes = async (max = 10, excludeString=null) => {
const response = await api(PATH_RECENT_EPISODES+'?max='+max+(excludeString ? '&excludeString='+encodeURIComponent(excludeString) : ''))
return withResponse(response)
}
return {
api,
podcastsByFeedUrl,
podcastsByFeedId,
podcastsByFeedItunesId,
addByFeedUrl,
searchByTerm,
episodesByFeedId,
episodesByFeedUrl,
episodesByItunesId,
recentEpisodes
searchByTerm: async (q) => {
const response = await api(PATH_SEARCH_BY_TERM + qs({ q: q }))
return withResponse(response)
},
podcastsByFeedUrl: async (feedUrl) => {
const response = await api(
PATH_PODCASTS_BY_FEED_URL + qs({ url: feedUrl })
)
return withResponse(response)
},
podcastsByFeedId: async (feedId) => {
const response = await api(
PATH_PODCASTS_BY_FEED_ID + qs({ id: feedId })
)
return withResponse(response)
},
podcastsByFeedItunesId: async (itunesId) => {
const response = await api(
PATH_PODCASTS_BY_ITUNES_ID + qs({ id: itunesId })
)
return withResponse(response)
},
addByFeedUrl: async (feedUrl) => {
const response = await api(
PATH_ADD_BY_FEED_URL + qs({ url: feedUrl })
)
return withResponse(response)
},
episodesByFeedId: async (feedId) => {
const response = await api(
PATH_EPISODES_BY_FEED_ID + qs({ id: feedId })
)
return withResponse(response)
},
episodesByFeedUrl: async (feedUrl) => {
const response = await api(
PATH_EPISODES_BY_FEED_URL + qs({ url: feedUrl })
)
return withResponse(response)
},
episodesByItunesId: async (itunesId) => {
const response = await api(
PATH_EPISODES_BY_ITUNES_ID + qs({ id: itunesId })
)
return withResponse(response)
},
recentFeeds: async (max = 40, since = null) => {
const response = await api(
PATH_RECENT_FEEDS +
qs({
max: max,
since: since ? since : null,
})
)
return withResponse(response)
},
recentEpisodes: async (
max = 10,
excludeString = null,
excludeBlank = null
) => {
const response = await api(
PATH_RECENT_EPISODES +
qs({
max: max,
excludeString: excludeString ? excludeString : null,
excludeBlank: excludeBlank ? excludeBlank : null,
})
)
return withResponse(response)
},
}
}
}

@@ -5,189 +5,189 @@ // For a detailed explanation regarding each configuration property, visit:

module.exports = {
// All imported modules in your tests should be mocked automatically
// automock: false,
// All imported modules in your tests should be mocked automatically
// automock: false,
// Stop running tests after `n` failures
// bail: 0,
// Stop running tests after `n` failures
// bail: 0,
// The directory where Jest should store its cached dependency information
// cacheDirectory: "/tmp/jest_rs",
// The directory where Jest should store its cached dependency information
// cacheDirectory: "/tmp/jest_rs",
// Automatically clear mock calls and instances between every test
clearMocks: true,
// Automatically clear mock calls and instances between every test
clearMocks: true,
// Indicates whether the coverage information should be collected while executing the test
// collectCoverage: false,
// Indicates whether the coverage information should be collected while executing the test
// collectCoverage: false,
// An array of glob patterns indicating a set of files for which coverage information should be collected
// collectCoverageFrom: undefined,
// An array of glob patterns indicating a set of files for which coverage information should be collected
// collectCoverageFrom: undefined,
// The directory where Jest should output its coverage files
coverageDirectory: "coverage",
// The directory where Jest should output its coverage files
coverageDirectory: 'coverage',
// An array of regexp pattern strings used to skip coverage collection
// coveragePathIgnorePatterns: [
// "/node_modules/"
// ],
// An array of regexp pattern strings used to skip coverage collection
// coveragePathIgnorePatterns: [
// "/node_modules/"
// ],
// Indicates which provider should be used to instrument code for coverage
coverageProvider: "v8",
// Indicates which provider should be used to instrument code for coverage
coverageProvider: 'v8',
// A list of reporter names that Jest uses when writing coverage reports
// coverageReporters: [
// "json",
// "text",
// "lcov",
// "clover"
// ],
// A list of reporter names that Jest uses when writing coverage reports
// coverageReporters: [
// "json",
// "text",
// "lcov",
// "clover"
// ],
// An object that configures minimum threshold enforcement for coverage results
// coverageThreshold: undefined,
// An object that configures minimum threshold enforcement for coverage results
// coverageThreshold: undefined,
// A path to a custom dependency extractor
// dependencyExtractor: undefined,
// A path to a custom dependency extractor
// dependencyExtractor: undefined,
// Make calling deprecated APIs throw helpful error messages
// errorOnDeprecated: false,
// Make calling deprecated APIs throw helpful error messages
// errorOnDeprecated: false,
// Force coverage collection from ignored files using an array of glob patterns
// forceCoverageMatch: [],
// Force coverage collection from ignored files using an array of glob patterns
// forceCoverageMatch: [],
// A path to a module which exports an async function that is triggered once before all test suites
// globalSetup: undefined,
// A path to a module which exports an async function that is triggered once before all test suites
// globalSetup: undefined,
// A path to a module which exports an async function that is triggered once after all test suites
// globalTeardown: undefined,
// A path to a module which exports an async function that is triggered once after all test suites
// globalTeardown: undefined,
// A set of global variables that need to be available in all test environments
// globals: {},
// A set of global variables that need to be available in all test environments
// globals: {},
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
// maxWorkers: "50%",
// The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers.
// maxWorkers: "50%",
// An array of directory names to be searched recursively up from the requiring module's location
// moduleDirectories: [
// "node_modules"
// ],
// An array of directory names to be searched recursively up from the requiring module's location
// moduleDirectories: [
// "node_modules"
// ],
// An array of file extensions your modules use
// moduleFileExtensions: [
// "js",
// "json",
// "jsx",
// "ts",
// "tsx",
// "node"
// ],
// An array of file extensions your modules use
// moduleFileExtensions: [
// "js",
// "json",
// "jsx",
// "ts",
// "tsx",
// "node"
// ],
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
// moduleNameMapper: {},
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
// moduleNameMapper: {},
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
// modulePathIgnorePatterns: [],
// An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader
// modulePathIgnorePatterns: [],
// Activates notifications for test results
// notify: false,
// Activates notifications for test results
// notify: false,
// An enum that specifies notification mode. Requires { notify: true }
// notifyMode: "failure-change",
// An enum that specifies notification mode. Requires { notify: true }
// notifyMode: "failure-change",
// A preset that is used as a base for Jest's configuration
// preset: undefined,
// A preset that is used as a base for Jest's configuration
// preset: undefined,
// Run tests from one or more projects
// projects: undefined,
// Run tests from one or more projects
// projects: undefined,
// Use this configuration option to add custom reporters to Jest
// reporters: undefined,
// Use this configuration option to add custom reporters to Jest
// reporters: undefined,
// Automatically reset mock state between every test
// resetMocks: false,
// Automatically reset mock state between every test
// resetMocks: false,
// Reset the module registry before running each individual test
// resetModules: false,
// Reset the module registry before running each individual test
// resetModules: false,
// A path to a custom resolver
// resolver: undefined,
// A path to a custom resolver
// resolver: undefined,
// Automatically restore mock state between every test
// restoreMocks: false,
// Automatically restore mock state between every test
// restoreMocks: false,
// The root directory that Jest should scan for tests and modules within
// rootDir: undefined,
// The root directory that Jest should scan for tests and modules within
// rootDir: undefined,
// A list of paths to directories that Jest should use to search for files in
// roots: [
// "<rootDir>"
// ],
// A list of paths to directories that Jest should use to search for files in
// roots: [
// "<rootDir>"
// ],
// Allows you to use a custom runner instead of Jest's default test runner
// runner: "jest-runner",
// Allows you to use a custom runner instead of Jest's default test runner
// runner: "jest-runner",
// The paths to modules that run some code to configure or set up the testing environment before each test
// setupFiles: [],
// The paths to modules that run some code to configure or set up the testing environment before each test
// setupFiles: [],
// A list of paths to modules that run some code to configure or set up the testing framework before each test
// setupFilesAfterEnv: [],
// A list of paths to modules that run some code to configure or set up the testing framework before each test
// setupFilesAfterEnv: [],
// The number of seconds after which a test is considered as slow and reported as such in the results.
// slowTestThreshold: 5,
// The number of seconds after which a test is considered as slow and reported as such in the results.
// slowTestThreshold: 5,
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
// snapshotSerializers: [],
// A list of paths to snapshot serializer modules Jest should use for snapshot testing
// snapshotSerializers: [],
// The test environment that will be used for testing
testEnvironment: "node",
// The test environment that will be used for testing
testEnvironment: 'node',
// Options that will be passed to the testEnvironment
// testEnvironmentOptions: {},
// Options that will be passed to the testEnvironment
// testEnvironmentOptions: {},
// Adds a location field to test results
// testLocationInResults: false,
// Adds a location field to test results
// testLocationInResults: false,
// The glob patterns Jest uses to detect test files
testMatch: [
"**/test/**/*.[jt]s?(x)"
// "**/?(*.)+(spec|test).[tj]s?(x)"
],
// The glob patterns Jest uses to detect test files
testMatch: [
'**/test/**/*.[jt]s?(x)',
// "**/?(*.)+(spec|test).[tj]s?(x)"
],
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
// testPathIgnorePatterns: [
// "/node_modules/"
// ],
// An array of regexp pattern strings that are matched against all test paths, matched tests are skipped
// testPathIgnorePatterns: [
// "/node_modules/"
// ],
// The regexp pattern or array of patterns that Jest uses to detect test files
// testRegex: [],
// The regexp pattern or array of patterns that Jest uses to detect test files
// testRegex: [],
// This option allows the use of a custom results processor
// testResultsProcessor: undefined,
// This option allows the use of a custom results processor
// testResultsProcessor: undefined,
// This option allows use of a custom test runner
// testRunner: "jasmine2",
// This option allows use of a custom test runner
// testRunner: "jasmine2",
// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
// testURL: "http://localhost",
// This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
// testURL: "http://localhost",
// Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
// timers: "real",
// Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout"
// timers: "real",
// A map from regular expressions to paths to transformers
// transform: undefined,
// A map from regular expressions to paths to transformers
// transform: undefined,
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
// transformIgnorePatterns: [
// "/node_modules/",
// "\\.pnp\\.[^\\/]+$"
// ],
// An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation
// transformIgnorePatterns: [
// "/node_modules/",
// "\\.pnp\\.[^\\/]+$"
// ],
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
// unmockedModulePathPatterns: undefined,
// An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them
// unmockedModulePathPatterns: undefined,
// Indicates whether each individual test should be reported during the run
// verbose: undefined,
// Indicates whether each individual test should be reported during the run
// verbose: undefined,
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
// watchPathIgnorePatterns: [],
// An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode
// watchPathIgnorePatterns: [],
// Whether to use watchman for file crawling
// watchman: true,
};
// Whether to use watchman for file crawling
// watchman: true,
}
{
"name": "podcast-index-api",
"version": "1.0.1",
"description": "JS lib for the Podcast Index API",
"main": "index.js",
"directories": {
"test": "test"
},
"dependencies": {},
"devDependencies": {},
"scripts": {
"test": "jest --coverage"
},
"repository": {
"type": "git",
"url": "git+ssh://git@gitlab.com/comster/podcast-index-api.git"
},
"keywords": [
"API",
"Podcast",
"Directory",
"Podcasts",
"Search"
],
"author": {
"name": "Jeff Pelton",
"email": "jeff@jeffpelton.com",
"url": "https://www.jeffpelton.com/"
},
"license": "MIT",
"bugs": {
"url": "https://gitlab.com/comster/podcast-index-api/issues"
},
"homepage": "https://gitlab.com/comster/podcast-index-api#readme",
"dependencies": {
"got": "^11.6.0"
},
"devDependencies": {
"jest": "^26.4.2"
}
"name": "podcast-index-api",
"version": "1.1.2",
"description": "JS lib for the Podcast Index API",
"main": "index.js",
"directories": {
"test": "test"
},
"dependencies": {
"got": "^11.6.0"
},
"devDependencies": {
"jest": "^26.4.2",
"prettier": "2.1.1"
},
"scripts": {
"test": "jest --coverage",
"format": "npx prettier --write .",
"tag": "npm version patch && git push && git push --tags"
},
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/comster/podcast-index-api.git"
},
"keywords": [
"API",
"Podcast",
"Directory",
"Podcasts",
"Search"
],
"author": {
"name": "Jeff Pelton",
"email": "jeff@jeffpelton.com",
"url": "https://www.jeffpelton.com/"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/comster/podcast-index-api/issues"
},
"homepage": "https://github.com/comster/podcast-index-api"
}

@@ -7,5 +7,7 @@ # Podcast Index API

[![coverage report](https://gitlab.com/comster/podcast-index-api/badges/master/coverage.svg)](https://gitlab.com/comster/podcast-index-api/-/commits/master)
[![Downloads](https://img.shields.io/npm/dm/podcast-index-api.svg)](https://npmjs.com/podcast-index-api)
[![Install size](https://packagephobia.now.sh/badge?p=podcast-index-api)](https://packagephobia.now.sh/result?p=podcast-index-api)
[![npm](https://img.shields.io/npm/v/podcast-index-api?style=plastic)](https://npmjs.com/podcast-index-api)
[![Downloads](https://img.shields.io/npm/dw/podcast-index-api.svg)](https://npmjs.com/podcast-index-api)
[Homepage](https://comster.github.io/podcast-index-api/) | [Source](https://github.com/comster/podcast-index-api) | [npm](https://npmjs.com/podcast-index-api)

@@ -18,3 +20,2 @@ ## Installation

## Configuration

@@ -28,3 +29,2 @@

## Usage

@@ -34,19 +34,18 @@

`const results = await api.searchByTerm(SEARCH_TERM)`
`const results = await api.searchByTerm('Joe Rogan Experience')`
Using Promise
`api.searchByTerm(SEARCH_TERM).then(results => { console.log(results) })`
`api.searchByTerm('Joe Rogan Experience').then(results => { console.log(results) })`
## Functions
- `searchByTerm(term: String)`
- `podcastsByFeedUrl(url: String)`
- `podcastsByFeedId(id: Number)`
- `podcastsByFeedItunesId(itunesId: Number)`
- `addByFeedUrl(url: String)`
- `episodesByFeedId(id: Number)`
- `episodesByFeedUrl(url: String)`
- `episodesByItunesId(itunesId: Number)`
- `recentEpisodes(max: Number, exclude: String)`
- `searchByTerm(term: String)`
- `podcastsByFeedUrl(url: String)`
- `podcastsByFeedId(id: Number)`
- `podcastsByFeedItunesId(itunesId: Number)`
- `addByFeedUrl(url: String)`
- `episodesByFeedId(id: Number)`
- `episodesByFeedUrl(url: String)`
- `episodesByItunesId(itunesId: Number)`
- `recentEpisodes(max: Number, exclude: String)`

@@ -1,3 +0,10 @@

const api = require('../index.js')(process.env.PODCASTINDEX_API_KEY, process.env.PODCASTINDEX_API_SECRET)
jest.setTimeout(60000)
const lib = require('../index.js')
const api = lib(
process.env.PODCASTINDEX_API_KEY,
process.env.PODCASTINDEX_API_SECRET
)
const apiBadCreds = lib('ABC', '123')
const SEARCH_TERM = 'Joe Rogan Experience'

@@ -8,5 +15,12 @@ const FEED_ID = 550168

const FEED_URL = 'http://joeroganexp.joerogan.libsynpro.com/rss'
const RECENT_FEEDS_COUNT = 3
const RECENT_EPISODES_COUNT = 3
const RECENT_EPISODES_EXCLUDE = 'news'
it('Requires API credentials', () => {
expect(() => {
const apiNoCreds = lib()
}).toThrow()
})
it('Search by term (async)', async () => {

@@ -16,4 +30,4 @@ expect.assertions(5)

expect(results.feeds.length).toBeGreaterThan(0)
expect(results).toHaveProperty('query', SEARCH_TERM);
expect(results).toHaveProperty('feeds');
expect(results).toHaveProperty('query', SEARCH_TERM)
expect(results).toHaveProperty('feeds')
expect(results.feeds[0].id).toEqual(FEED_ID)

@@ -25,6 +39,6 @@ expect(results.feeds[0].title).toEqual(FEED_TITLE)

expect.assertions(5)
return api.searchByTerm(SEARCH_TERM).then(results => {
return api.searchByTerm(SEARCH_TERM).then((results) => {
expect(results.feeds.length).toBeGreaterThan(0)
expect(results).toHaveProperty('query', SEARCH_TERM);
expect(results).toHaveProperty('feeds');
expect(results).toHaveProperty('query', SEARCH_TERM)
expect(results).toHaveProperty('feeds')
expect(results.feeds[0].id).toEqual(FEED_ID)

@@ -43,58 +57,75 @@ expect(results.feeds[0].title).toEqual(FEED_TITLE)

it('Episodes By Feed Id', async () => {
expect.assertions(3)
const results = await api.episodesByFeedId(FEED_ID)
expect(results.items.length).toBeGreaterThan(0)
expect(results).toHaveProperty('query', FEED_ID.toString());
expect(results.items[0].feedId).toEqual(FEED_ID.toString())
expect.assertions(3)
const results = await api.episodesByFeedId(FEED_ID)
expect(results.items.length).toBeGreaterThan(0)
expect(results).toHaveProperty('query', FEED_ID.toString())
expect(results.items[0].feedId).toEqual(FEED_ID.toString())
})
it('Episodes By Feed URL', async () => {
expect.assertions(3)
const results = await api.episodesByFeedUrl(FEED_URL)
expect(results.items.length).toBeGreaterThan(0)
expect(results).toHaveProperty('query', FEED_URL);
expect(results.items[0].feedId).toEqual(FEED_ID)
expect.assertions(3)
const results = await api.episodesByFeedUrl(FEED_URL)
expect(results.items.length).toBeGreaterThan(0)
expect(results).toHaveProperty('query', FEED_URL)
expect(results.items[0].feedId).toEqual(FEED_ID)
})
it('Episodes By Feed iTunes ID', async () => {
expect.assertions(3)
const results = await api.episodesByItunesId(FEED_ITUNES_ID)
expect(results.items.length).toBeGreaterThan(0)
expect(results).toHaveProperty('query', FEED_ITUNES_ID.toString());
expect(results.items[0].feedId).toEqual(FEED_ID)
expect.assertions(3)
const results = await api.episodesByItunesId(FEED_ITUNES_ID)
expect(results.items.length).toBeGreaterThan(0)
expect(results).toHaveProperty('query', FEED_ITUNES_ID.toString())
expect(results.items[0].feedId).toEqual(FEED_ID)
})
it('Podcasts By Feed URL', async () => {
expect.assertions(3)
const results = await api.podcastsByFeedUrl(FEED_URL)
expect(results).toHaveProperty('query.url', FEED_URL);
expect(results.feed.id).toEqual(FEED_ID)
expect(results.feed.itunesId).toEqual(FEED_ITUNES_ID)
expect.assertions(3)
const results = await api.podcastsByFeedUrl(FEED_URL)
expect(results).toHaveProperty('query.url', FEED_URL)
expect(results.feed.id).toEqual(FEED_ID)
expect(results.feed.itunesId).toEqual(FEED_ITUNES_ID)
})
it('Podcasts By Feed ID', async () => {
expect.assertions(3)
const results = await api.podcastsByFeedId(FEED_ID)
expect(results).toHaveProperty('query.id', FEED_ID.toString());
expect(results.feed.id).toEqual(FEED_ID)
expect(results.feed.itunesId).toEqual(FEED_ITUNES_ID)
expect.assertions(3)
const results = await api.podcastsByFeedId(FEED_ID)
expect(results).toHaveProperty('query.id', FEED_ID.toString())
expect(results.feed.id).toEqual(FEED_ID)
expect(results.feed.itunesId).toEqual(FEED_ITUNES_ID)
})
it('Podcasts By Feed iTunes ID', async () => {
expect.assertions(3)
const results = await api.podcastsByFeedItunesId(FEED_ITUNES_ID)
expect(results).toHaveProperty('query.id', FEED_ITUNES_ID.toString());
expect(results.feed.id).toEqual(FEED_ID)
expect(results.feed.itunesId).toEqual(FEED_ITUNES_ID)
expect.assertions(3)
const results = await api.podcastsByFeedItunesId(FEED_ITUNES_ID)
expect(results).toHaveProperty('query.id', FEED_ITUNES_ID.toString())
expect(results.feed.id).toEqual(FEED_ID)
expect(results.feed.itunesId).toEqual(FEED_ITUNES_ID)
})
it('Recent Feeds', async () => {
expect.assertions(3)
const results = await api.recentEpisodes(RECENT_FEEDS_COUNT)
expect(results).toHaveProperty('count', RECENT_FEEDS_COUNT)
expect(results).toHaveProperty('max', RECENT_FEEDS_COUNT.toString())
expect(results.items.length).toEqual(RECENT_FEEDS_COUNT)
})
it('Recent Episodes', async () => {
expect.assertions(6)
const results = await api.recentEpisodes(RECENT_EPISODES_COUNT, RECENT_EPISODES_EXCLUDE)
expect(results).toHaveProperty('count', RECENT_EPISODES_COUNT);
expect(results).toHaveProperty('max', RECENT_EPISODES_COUNT.toString());
expect(results.items.length).toEqual(RECENT_EPISODES_COUNT)
expect(results.items[0].title).toEqual(expect.not.stringContaining(RECENT_EPISODES_EXCLUDE))
expect(results.items[1].title).toEqual(expect.not.stringContaining(RECENT_EPISODES_EXCLUDE))
expect(results.items[2].title).toEqual(expect.not.stringContaining(RECENT_EPISODES_EXCLUDE))
expect.assertions(6)
const results = await api.recentEpisodes(
RECENT_EPISODES_COUNT,
RECENT_EPISODES_EXCLUDE
)
expect(results).toHaveProperty('count', RECENT_EPISODES_COUNT)
expect(results).toHaveProperty('max', RECENT_EPISODES_COUNT.toString())
expect(results.items.length).toEqual(RECENT_EPISODES_COUNT)
expect(results.items[0].title).toEqual(
expect.not.stringContaining(RECENT_EPISODES_EXCLUDE)
)
expect(results.items[1].title).toEqual(
expect.not.stringContaining(RECENT_EPISODES_EXCLUDE)
)
expect(results.items[2].title).toEqual(
expect.not.stringContaining(RECENT_EPISODES_EXCLUDE)
)
})

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc