Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e2e Fixes #28

Merged
merged 5 commits into from
Jul 12, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 6 additions & 16 deletions e2e/e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ let sdkClient = {}
const tenantId = process.env.CUSTOMER_PROFILE_API_TENANT_ID
const iMSOrgId = process.env.CUSTOMER_PROFILE_API_IMS_ORG_ID
const apiKey = process.env.CUSTOMER_PROFILE_API_API_KEY
const accessToken = process.env.CUSTOMER_PROFILE_ACCESS_TOKEN
const accessToken = process.env.CUSTOMER_PROFILE_API_ACCESS_TOKEN

beforeAll(async () => {
sdkClient = await sdk.init(tenantId, iMSOrgId, apiKey, accessToken)
Expand All @@ -33,7 +33,9 @@ test('sdk init test', async () => {
})

const requiredParam = {
'schema.name': '_xdm.context.profile'
'schema.name': '_xdm.context.profile',
entityId: 'spaliwal@adobe.com',
entityIdNS: 'email'
}

test('test bad access token', async () => {
Expand All @@ -49,23 +51,11 @@ test('test bad api key', async () => {
const promise = _sdkClient.getAccessEntities(requiredParam)

// just match the error message
return expect(promise).rejects.toThrow('401')
})

test('test bad tenant id', async () => {
const _sdkClient = await sdk.init('bad_tenant_id', iMSOrgId, apiKey, accessToken)
const promise = _sdkClient.getAccessEntities(requiredParam)

// just match the error message
return expect(promise).rejects.toThrow('401')
return expect(promise).rejects.toThrow('[CustomerProfileAPISDK:ERROR_ENTITIES] Error 403 - Forbidden ({"error_code":"403003","message":"Api Key is invalid"})')
})

test('test getAccessEntities API', async () => {
// check success response
const res = await sdkClient.getAccessEntities({
entityId: '1',
'schema.name': '_xdm.context.profile',
entityIdNS: '1'
})
const res = await sdkClient.getAccessEntities(requiredParam)
expect(res.ok).toBeTruthy()
})