Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const anonymousId = `${Date.now()}-bar`
const userConfig = {
...apiConfig,
...{ scopes: [`manage_project:${projectKey}`] },
...{
credentials: {
clientId: apiConfig.credentials.clientId,
clientSecret: apiConfig.credentials.clientSecret,
anonymousId,
},
},
fetch,
}
const client = createClient({
middlewares: [
createAuthMiddlewareForAnonymousSessionFlow(userConfig),
httpMiddleware,
],
})
const cartMock = {
currency: 'EUR',
}
return client
.execute({
// creates a cart that is tied to the logged in anonymous token
uri: `/${projectKey}/me/carts`,
method: 'POST',
body: cartMock,
})
.then(({ body: cart }) => {
expect(cart).toHaveProperty('anonymousId', anonymousId)
return client.execute({