Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
describe('Channels', () => {
const ignoredResponseKeys = [
'id',
'createdAt',
'createdBy',
'lastModifiedAt',
'lastModifiedBy',
]
const service = createRequestBuilder({ projectKey }).channels
const httpMiddleware = createHttpMiddleware({
host: 'https://api.sphere.io',
fetch,
})
const queueMiddleware = createQueueMiddleware({
concurrency: 5,
})
const userAgentMiddleware = createUserAgentMiddleware({
libraryName: pkg.name,
libraryVersion: pkg.version,
contactUrl: 'https://github.com/commercetools/nodejs',
contactEmail: 'npmjs@commercetools.com',
})
const key = uniqueId('channel_')
let channelResponse
let client
let apiConfig
beforeAll(() =>
getCredentials(projectKey)
.then(credentials => {
}
}) {
const authMiddleware = createAuthMiddlewareForClientCredentialsFlow({
host: authApiEndpoint,
projectKey: projectKey,
credentials: {
clientId: clientId,
clientSecret: clientSecret
}
});
const httpMiddleware = createHttpMiddleware({
host: apiEndpoint
});
const queueMiddleware = createQueueMiddleware({
concurrency: 5
});
return createClient({
middlewares: [authMiddleware, httpMiddleware, queueMiddleware]
});
}
this.apiConfig = options.apiConfig
this.client = createClient({
middlewares: [
createAuthMiddlewareWithExistingToken(
options.accessToken ? `Bearer ${options.accessToken}` : ''
),
createAuthMiddlewareForClientCredentialsFlow({
...this.apiConfig,
fetch,
}),
createUserAgentMiddleware({
libraryName: pkg.name,
libraryVersion: pkg.version,
}),
createHttpMiddleware({ host: this.apiConfig.apiUrl, fetch }),
createQueueMiddleware({
concurrency: 20,
}),
],
})
this.logger = {
...silentLogger,
...options.logger,
}
this.predicate = options.predicate
this.resource = options.resource
}