UNPKG

@kkbox/kkbox-javascript-developer-sdk

Version:

KKBOX Open API developer SDK for JavaScript. Use it to easily access KKBOX open API to get various metadata about KKBOX's tracks, albums, artists, playlists and stations.

21 lines (20 loc) 871 B
import should from 'should' import TokenFetcher from '../src/auth/TokenFetcher' import ClientCredentialsFlow from '../src/auth/ClientCredentialsFlow' import {kkbox_sdk} from './client_secrets.json' const CLIENT_ID = kkbox_sdk.client_id const CLIENT_SECRET = kkbox_sdk.client_secret describe('Auth Begin to Test', () => { const tokenFetcher = new TokenFetcher(CLIENT_ID, CLIENT_SECRET) describe('clientCredentialsFlow', () => { describe('#fetchAccessToken()', () => { it('should get access token', () => { const clientCredentialsFlow = new ClientCredentialsFlow(tokenFetcher) return clientCredentialsFlow.fetchAccessToken().then(response => { const access_token = response.data.access_token access_token.should.be.ok }) }) }) }) })