Authorization
|
Authorization |
20 |
refreshExistingAccessToken
|
Authorization.refreshExistingAccessToken |
5 |
should call the refresh token endpoint in the auth proxy
|
- |
|
should retry the call to the refresh token endpoint in the auth proxy if it receives a bad response the first time
|
- |
|
should retry the call to the refresh token endpoint in the auth proxy up to 3 times, but then error out
|
- |
|
if no auth proxy URL is set
|
- |
1 |
should throw a TypeError
|
- |
|
if no access token is set
|
- |
1 |
should throw a TypeError
|
- |
|
logout
|
Authorization#logout |
4 |
should call the logout endpoint in the auth proxy
|
- |
|
should throw an error if the response is not 'ok'
|
- |
|
if no access token is set
|
- |
1 |
should throw a TypeError
|
- |
|
if no auth proxy URL is set
|
- |
1 |
should throw a TypeError
|
- |
|
getDeviceCode
|
Authorization#getDeviceCode |
3 |
should throw an error if not configured properly
|
- |
|
should make a request to authProxyUrl when called
|
- |
|
should make a request to authProxyUrl with additional scopes when scopes are passed in
|
- |
|
pollDeviceCode
|
Authorization#pollDeviceCode |
8 |
should throw an error if not configured properly
|
- |
|
should throw an error if no active device code exists
|
- |
|
should return a Promise that rejects if the active device code is expired
|
- |
|
should return a Promise that resolves to a valid access token if device code is valid
|
- |
|
should return a Promise that rejects if the active device code is invalid (or possibly expired)
|
- |
|
should return a Promise that rejects if the active device code is valid but the user went to log in and denied the app access
|
- |
|
should return a Promise that resolves to valid access token after polling a number of times if the user logs in
|
- |
|
should return a Promise that rejects if the returned access token is invalid
|
- |
|
Identity
|
Identity |
12 |
getUser
|
Identity#getUser |
1 |
should make a request to /user
|
- |
|
setUserStation
|
Identity#setUserStation |
3 |
should validate the station, and then make a PUT request to identity/stations
|
- |
|
should fail if a non-numeric station ID is passed in
|
- |
|
should reject the promise if station finder returns a 404
|
- |
|
followShow
|
Identity#followShow |
2 |
should validate the aggregation, and then make a POST request to identity/following
|
- |
|
should throw a TypeError if a non-numeric aggregation ID is passed in
|
- |
|
unfollowShow
|
Identity#unfollowShow |
2 |
should validate the aggregation, and then make a POST request to identity/following
|
- |
|
should throw a TypeError if a non-numeric aggregation ID is passed in
|
- |
|
createTemporaryUser
|
Identity#createTemporaryUser |
4 |
should make a request to NPR proxy when called
|
- |
|
should make a request to NPR proxy when called using the correct query param character
|
- |
|
if no client ID is set
|
- |
1 |
should throw a TypeError
|
- |
|
if no auth proxy URL is set
|
- |
1 |
should throw a TypeError
|
- |
|
Listening
|
Listening |
43 |
getRecommendation
|
Listening#getRecommendation |
22 |
should throw an exception if access token is not supplied
|
- |
|
should make a request to /recommendations with channel npr if a bad channel is passed in
|
- |
|
should make a request to /recommendations when no queued ratings exist
|
- |
|
should return the currently executing promise if called again before first promise has resolved
|
- |
|
should make a request to /recommendations with a custom channel when no queued ratings exist and a channel is specified
|
- |
|
should include x- headers if supplied in config when making API requests
|
- |
|
should make /recommendations request with sharedMediaId when a UID is given
|
- |
|
should make a request to /ratings when a rating is queued
|
- |
|
should make a request to /ratings and not send duplicate ratings if an action was record twice
|
- |
|
should return the same recommendation when no START rating has been received
|
- |
|
should return a different recommendation when a START rating has been received
|
- |
|
should return a different recommendation when a TIMEOUT rating has been received
|
- |
|
should return a different recommendation when a TAPTHRU rating has been received
|
- |
|
should fire impression url GET requests for sponsorship when a START happens
|
- |
|
should disable ads when an adblocker is present
|
- |
|
should progress through the flow normally
|
- |
|
should go to sponsored channel on TAPTHRU to sponsorship [tests related]
|
- |
|
should go to action URL on TAPTHRU of promo [tests action, or callsToAction]
|
- |
|
should throw when no API recommendations are returned and no previous exist
|
- |
|
should call the refresh token endpoint in the auth proxy if the getRecommendations call returns a 401, and then retry the request
|
- |
|
if queueRecommendationFromChannel() was previously called and the recommendation with the given UID was already added to flowRecommendations
|
- |
2 |
should NOT make a new API call if the UID is present in the cached list, and return that item
|
- |
|
should make a new API call if the UID is not found in the list
|
- |
|
getUpcomingFlowRecommendations
|
Listening#getUpcomingFlowRecommendations |
3 |
should make a GET request when no flow recommendations are present
|
- |
|
should NOT make a GET request when flow recommendations are present
|
- |
|
should make a GET request with a custom channel when no flow recommendations are present and a channel is specified
|
- |
|
getRecommendationsFromChannel
|
Listening#getRecommendationsFromChannel |
4 |
should make a GET request to the default channel ("recommended") if no channel is specified
|
- |
|
should make a GET request to the specified channel if a channel is specified
|
- |
|
should make a GET request to the default channel ("recommended") if an invalid channel format is supplied
|
- |
|
should flush any pending ratings before returning channel recommendations
|
- |
|
queueRecommendationFromChannel
|
Listening#queueRecommendationFromChannel |
9 |
should throw a TypeError if no channel is specified
|
- |
|
should throw a TypeError if a channel is specified but is not a valid string
|
- |
|
should throw a TypeError if no UID is specified
|
- |
|
should throw a TypeError if a channel is specified but is not a valid string
|
- |
|
should throw an Error if getRecommendationsFromChannel() was not previously called
|
- |
|
if getRecommendationsFromChannel() was previously called but the cached list of recommendations is empty
|
- |
1 |
should throw an Error
|
- |
|
if getRecommendationsFromChannel() was previously called and the cached list of recommendations is not empty
|
- |
3 |
should throw an Error if the uid is not found in the list
|
- |
|
should return the found recommendation if the UID is present in the cached list
|
- |
|
should put the found recommendation at the top of the flow recommendations if the UID is present in the cached list
|
- |
|
getHistory
|
Listening#getHistory |
1 |
should make a request to /history when getHistory is called
|
- |
|
resetFlow
|
Listening#resetFlow |
3 |
no recommendations have been requested yet
|
- |
1 |
should return a fulfilled promise
|
- |
|
if recommendations have already been requested
|
- |
2 |
and no queued ratings are present
|
- |
1 |
should reset internal variables to allow the flow to reset
|
- |
|
and queued ratings are present
|
- |
1 |
should send the queued ratings first, then reset
|
- |
|
resumeFlowFromRecommendation
|
Listening#resumeFlowFromRecommendation |
1 |
no recommendations have been requested yet
|
- |
1 |
unit/controller/listening.js |
- |
|
StationFinder
|
StationFinder |
14 |
searchStations
|
StationFinder#searchStations |
4 |
should make a request to /stationfinder/stations and find two stations
|
- |
|
should include the query string in the search if one is given
|
- |
|
should throw an error when given an invalid query string
|
- |
|
should return an empty array if no stations results were found
|
- |
|
searchStationsByLatLongCoordinates
|
StationFinder#searchStationsByLatLongCoordinates |
2 |
should make a request to /stationfinder/stations and find two stations
|
- |
|
should throw an error when given an invalid values
|
- |
|
searchStationsByCity
|
StationFinder#searchStationsByCity |
2 |
should make a request to /stationfinder/stations and find two stations
|
- |
|
should throw an error when given an invalid values
|
- |
|
searchStationsByState
|
StationFinder#searchStationsByState |
2 |
should make a request to /stationfinder/stations and find two stations
|
- |
|
should throw an error when given an invalid values
|
- |
|
searchStationsByCityAndState
|
StationFinder#searchStationsByCityAndState |
1 |
should make a request to /stationfinder/stations and find two stations
|
- |
|
getStationDetails
|
StationFinder#getStationDetails |
3 |
should make a request to /stationfinder/stations and find the requested station
|
- |
|
should make a request to /stationfinder/stations and return a promise that rejects if the requested station is a non-NPR One station
|
- |
|
should throw an error when given an invalid values
|
- |
|
NprOneSDK
|
NprOneSDK |
43 |
config
|
NprOneSDK.config |
4 |
getter
|
- |
1 |
should return an object with config related properties
|
- |
|
setter
|
- |
3 |
should update specific config values when set
|
- |
|
should setup defaults if they haven't been set yet
|
- |
|
should log a warning when setting deprecated properties
|
- |
|
accessToken
|
NprOneSDK.accessToken |
5 |
getter
|
- |
1 |
should return the value of the accessToken string in the hidden config object
|
- |
|
setter
|
- |
4 |
should throw a TypeError if the passed-in value is not a string
|
- |
|
should set the internal access token to the supplied string
|
- |
|
should call the registered callback if one is set
|
- |
|
but only if the new token is different from the old
|
- |
|
onAccessTokenChanged
|
NprOneSDK.onAccessTokenChanged |
1 |
setter
|
- |
1 |
should throw a TypeError if the passed-in value is not a function
|
- |
|
Action
|
NprOneSDK.Action |
1 |
should return the Action class
|
- |
|
Logger
|
NprOneSDK.Logger |
1 |
should return the Logger class
|
- |
|
refreshExistingAccessToken
|
NprOneSDK.refreshExistingAccessToken |
2 |
should call the correct service controller method
|
- |
|
should call the correct service controller method with non-default param values
|
- |
|
logout
|
NprOneSDK#logout |
1 |
should call the correct service controller method
|
- |
|
getDeviceCode
|
NprOneSDK#getDeviceCode |
2 |
should call the correct service controller method
|
- |
|
should call the correct service controller method with non-default param values
|
- |
|
pollDeviceCode
|
NprOneSDK#pollDeviceCode |
1 |
should call the correct service controller method
|
- |
|
getRecommendation
|
NprOneSDK#getRecommendation |
3 |
should call the correct service controller method
|
- |
|
should call the correct service controller method with non-default param values
|
- |
|
should call the correct service controller method with non-default param values
|
- |
|
getUpcomingFlowRecommendations
|
NprOneSDK#getUpcomingFlowRecommendations |
2 |
should call the correct service controller method
|
- |
|
should call the correct service controller method with non-default param values
|
- |
|
getRecommendationsFromChannel
|
NprOneSDK#getRecommendationsFromChannel |
2 |
should call the correct service controller method
|
- |
|
should call the correct service controller method with non-default param values
|
- |
|
queueRecommendationFromChannel
|
NprOneSDK#queueRecommendationFromChannel |
1 |
should call the correct service controller method
|
- |
|
getHistory
|
NprOneSDK#getHistory |
1 |
should call the correct service controller method
|
- |
|
resetFlow
|
NprOneSDK#resetFlow |
1 |
should call the correct service controller method
|
- |
|
resumeFlowFromRecommendation
|
NprOneSDK#resumeFlowFromRecommendation |
1 |
should call the correct service controller method
|
- |
|
getUser
|
NprOneSDK#getUser |
1 |
should call the correct service controller method
|
- |
|
setUserStation
|
NprOneSDK#setUserStation |
1 |
should call the correct service controller method
|
- |
|
followShow
|
NprOneSDK#followShow |
1 |
should call the correct service controller method
|
- |
|
unfollowShow
|
NprOneSDK#unfollowShow |
1 |
should call the correct service controller method
|
- |
|
createTemporaryUser
|
NprOneSDK#createTemporaryUser |
1 |
should call the correct service controller method
|
- |
|
searchStations
|
NprOneSDK#searchStations |
2 |
should call the correct service controller method
|
- |
|
should call the correct service controller method with non-default param values
|
- |
|
searchStationsByLatLongCoordinates
|
NprOneSDK#searchStationsByLatLongCoordinates |
1 |
should call the correct service controller method
|
- |
|
searchStationsByCityAndState
|
NprOneSDK#searchStationsByCityAndState |
1 |
should call the correct service controller method
|
- |
|
searchStationsByCity
|
NprOneSDK#searchStationsByCity |
1 |
should call the correct service controller method
|
- |
|
searchStationsByState
|
NprOneSDK#searchStationsByState |
1 |
should call the correct service controller method
|
- |
|
getStationDetails
|
NprOneSDK#getStationDetails |
1 |
should call the correct service controller method
|
- |
|
getServiceUrl
|
NprOneSDK.getServiceUrl |
2 |
should return the correct API service url
|
- |
|
should throw if an invalid service name is specified
|
- |
|
AccessToken
|
AccessToken |
7 |
constructor
|
AccessToken#constructor |
1 |
should not set an expiry date if expires_in is NaN
|
- |
|
validate
|
AccessToken#validate |
1 |
should not throw an error on valid input
|
- |
|
isExpired
|
AccessToken#isExpired |
2 |
should not be expired for test data token
|
- |
|
should be expired if the expires_in time is in the past
|
- |
|
token
|
AccessToken.token |
1 |
should match the "access_token" value from the API response
|
- |
|
ttl
|
AccessToken.ttl |
1 |
should convert the "expires_in" value from the API response (which is in seconds) to milliseconds
|
- |
|
toString
|
AccessToken#toString |
1 |
should match the "access_token" value from the API response
|
- |
|
Action
|
Action |
14 |
COMPLETED
|
Action.COMPLETED |
1 |
should exist
|
- |
|
PASS
|
Action.PASS |
1 |
should exist
|
- |
|
SHARE
|
Action.SHARE |
1 |
should exist
|
- |
|
SKIP
|
Action.SKIP |
1 |
should exist
|
- |
|
SRCHCOMPL
|
Action.SRCHCOMPL |
1 |
should exist
|
- |
|
SRCHSTART
|
Action.SRCHSTART |
1 |
should exist
|
- |
|
START
|
Action.START |
1 |
should exist
|
- |
|
TAPTHRU
|
Action.TAPTHRU |
1 |
should exist
|
- |
|
THUMBUP
|
Action.THUMBUP |
1 |
should exist
|
- |
|
TIMEOUT
|
Action.TIMEOUT |
1 |
should exist
|
- |
|
getEndActions
|
Action.getEndActions |
1 |
should include what is specified
|
- |
|
getFlowAdvancingActions
|
Action.getFlowAdvancingActions |
1 |
should include what is specified
|
- |
|
isValidAction
|
Action.isValidAction |
2 |
should be true for valid actions
|
- |
|
should be false for invalid actions
|
- |
|
CollectionDoc
|
CollectionDoc |
1 |
collectionDoc
|
CollectionDoc#collectionDoc |
1 |
should match the API response
|
- |
|
DeviceCode
|
DeviceCode |
9 |
constructor
|
DeviceCode#constructor |
1 |
should not set an expiry date if expires_in is NaN
|
- |
|
validate
|
DeviceCode#validate |
1 |
should not throw an error on valid input
|
- |
|
isExpired
|
DeviceCode#isExpired |
2 |
should not be expired for test data token
|
- |
|
should be expired if the expires_in time is in the past
|
- |
|
userCode
|
DeviceCode.userCode |
1 |
should match the "user_code" value from the API response
|
- |
|
verificationUri
|
DeviceCode.verificationUri |
1 |
should match the "verification_uri" value from the API response
|
- |
|
ttl
|
DeviceCode.ttl |
1 |
should convert the "expires_in" value from the API response (which is in seconds) to milliseconds
|
- |
|
interval
|
DeviceCode.interval |
1 |
should convert the "interval" value from the API response (which is in seconds) to milliseconds
|
- |
|
toString
|
DeviceCode#toString |
1 |
should match the API response
|
- |
|
Rating
|
Rating |
3 |
constructor
|
Rating#constructor |
1 |
should hydrate the model
|
- |
|
toString
|
Rating#toString |
1 |
should match what is specified
|
- |
|
privateMemberReplacer
|
Rating.privateMemberReplacer |
1 |
should remove private member variables
|
- |
|
Recommendation
|
Recommendation |
33 |
constructor
|
Recommendation#constructor |
3 |
should throw an error if audio doesn't exist
|
- |
|
should throw an error if recommendations doesn't exist
|
- |
|
should throw an error if attributes.rating doesn't exist
|
- |
|
getImages
|
Recommendation#getImages |
1 |
should match the API response
|
- |
|
getAudio
|
Recommendation#getAudio |
1 |
should match the API response
|
- |
|
getWeb
|
Recommendation#getWeb |
1 |
should match the API response
|
- |
|
getOnRamps
|
Recommendation#getOnRamps |
1 |
should match the API response
|
- |
|
getImpressions
|
Recommendation#getImpressions |
1 |
should match the API response
|
- |
|
getCallsToAction
|
Recommendation#getCallsToAction |
1 |
should match the API response
|
- |
|
getRelateds
|
Recommendation#getRelateds |
1 |
should match the API response
|
- |
|
getRelatedImpressions
|
Recommendation#getRelatedImpressions |
1 |
should match the API response
|
- |
|
getRatings
|
Recommendation#getRatings |
1 |
should return a ratings object
|
- |
|
getRecommendationUrl
|
Recommendation#getRecommendationUrl |
1 |
should match the API response
|
- |
|
getActionRecommendationUrl
|
Recommendation#getActionRecommendationUrl |
2 |
should match the API response
|
- |
|
should only use urls that start with nprone://
|
- |
|
isSponsorship
|
Recommendation#isSponsorship |
2 |
should be true for an ad
|
- |
|
should be false for non ads
|
- |
|
isShareable
|
Recommendation#isShareable |
2 |
should be true for recommendations with onramps
|
- |
|
should be false for recommendations without onramps
|
- |
|
toString
|
Recommendation#toString |
1 |
should match the format specified
|
- |
|
recordAction
|
Recommendation#recordAction |
10 |
should only allow valid ratings
|
- |
|
should require elapsed time to be an integer
|
- |
|
should auto-correct bad elapsed time values
|
- |
|
should auto-correct bad elapsed time values but only if duration is greater than 0
|
- |
|
should warn developers when a zero elapsed time is given for a COMPLETED or SKIP
|
- |
|
should warn developers when a non-START rating is received before START
|
- |
|
should auto-correct bad elapsed time values if the difference is more than 30
|
- |
|
should execute a GET request against all impression URLs
|
- |
|
but only on the first START rating and not subsequent STARTs
|
- |
|
should call the callback set via setRatingReceivedCallback
|
- |
|
hasAction
|
Recommendation#hasAction |
2 |
should be true when a recommendation actually has that rating
|
- |
|
should be false when a recommendation does not have that rating
|
- |
|
hasEndAction
|
Recommendation#hasEndAction |
1 |
should be true when a recommendation has a finished rating
|
- |
|
Station
|
Station |
21 |
id
|
Station.id |
1 |
should exist and equal the value from the test data
|
- |
|
displayName
|
Station.displayName |
1 |
should equal name from the test data
|
- |
|
logo
|
Station.logo |
3 |
should equal rel="logo" brand link if it exists
|
- |
|
should be null and NOT the rel="small-logo" brand link if equal rel="logo" brand link does not exist
|
- |
|
should be null if none of the above exist
|
- |
|
tagline
|
Station.tagline |
2 |
should exist on test data
|
- |
|
should be an empty string if it does not exist
|
- |
|
callSignAndFrequency
|
Station.callSignAndFrequency |
5 |
should exist on test data
|
- |
|
should omit call if it does not exist on test data
|
- |
|
should omit band if it does not exist on test data
|
- |
|
should omit frequency if it does not exist on test data
|
- |
|
should return null if all attempted data is missing
|
- |
|
location
|
Station.location |
1 |
should exist on test data
|
- |
|
homepageUrl
|
Station.homepageUrl |
3 |
should exist on test data
|
- |
|
should be null if only non-rel="homepage" links exist
|
- |
|
should be null if none of the above exist
|
- |
|
donationUrl
|
Station.donationUrl |
3 |
should equal type 27 donation link if it exists
|
- |
|
should equal type 4 donation link if type 27 donation does not exist
|
- |
|
should be null if none of the above exist
|
- |
|
attributes
|
Station.attributes |
1 |
should exist on test data
|
- |
|
toString
|
Station#toString |
1 |
should exist on test data
|
- |
|
User
|
User |
10 |
constructor
|
User#constructor |
1 |
should hydrate the model
|
- |
|
isTemporary
|
User#isTemporary |
2 |
should be true for a temporary user
|
- |
|
should be false for a non-temporary user
|
- |
|
getCohort
|
User#getCohort |
1 |
should match the API response
|
- |
|
getOrganizations
|
User#getOrganizations |
2 |
should match the API response
|
- |
|
should return an array even if the API data is undefined
|
- |
|
getPrimaryOrganization
|
User#getPrimaryOrganization |
2 |
should match the API response
|
- |
|
should return an array even if the API data is undefined
|
- |
|
getAffiliations
|
User#getAffiliations |
1 |
should match the API response
|
- |
|
toString
|
User#toString |
1 |
should match the "id" value from the API response
|
- |
|
createRecommendations
|
createRecommendations |
2 |
should create an array of recommendations with valid input
|
- |
|
should filter out recommendations which are not valid
|
- |
|
Validator
|
Validator |
6 |
validateCollectionDoc
|
Validator.validateCollectionDoc |
2 |
should not throw an error on valid input
|
- |
|
should throw an error on invalid input
|
- |
|
validateAccessToken
|
Validator.validateAccessToken |
2 |
should not throw an error on valid input
|
- |
|
should throw an error on invalid input
|
- |
|
validateDeviceCode
|
Validator.validateDeviceCode |
2 |
should not throw an error on valid input
|
- |
|
should throw an error on invalid input
|
- |
|