Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const setupProject = async () => {
const credentials = await getCredentials(projectKey)
apiConfig = {
host: 'https://auth.sphere.io',
apiUrl: 'https://api.sphere.io',
projectKey,
credentials,
}
// Clear all existing data
await Promise.all([
clearData(apiConfig, 'customers'),
clearData(apiConfig, 'orders'),
clearData(apiConfig, 'carts'),
clearData(apiConfig, 'payments'),
clearData(apiConfig, 'shoppingLists'),
clearData(apiConfig, 'reviews'),
])
beforeAll(async () => {
const credentials = await getCredentials(projectKey)
apiConfig = {
host: 'https://auth.sphere.io',
apiUrl: 'https://api.sphere.io',
projectKey,
credentials,
}
await clearData(apiConfig, 'products')
await Promise.all([
clearData(apiConfig, 'productTypes'),
clearData(apiConfig, 'taxCategories'),
])
const createdProductType = await createData(apiConfig, 'productTypes', [
sampleProductType,
])
const resolveCredentials = _args => {
if (_args.accessToken) return Promise.resolve({})
return getCredentials(_args.projectKey)
}
const resolveCredentials = _args => {
if (_args.accessToken) return Promise.resolve({})
return getCredentials(_args.projectKey)
}
const resolveCredentials = _args => {
if (_args.accessToken) return Promise.resolve({})
return getCredentials(_args.projectKey)
}
const resolveCredentials = _args => {
if (_args.accessToken) return Promise.resolve({})
return getCredentials(_args.projectKey)
}
const resolveCredentials = _args => {
if (_args.accessToken) return Promise.resolve({})
return getCredentials(_args.projectKey)
}
const resolveCredentials = _args => {
if (_args.accessToken) return Promise.resolve({})
return getCredentials(_args.projectKey)
}
const resolveCredentials = _args => {
if (_args.accessToken) return Promise.resolve({})
return getCredentials(_args.projectKey)
}