-
Notifications
You must be signed in to change notification settings - Fork 257
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
fest(Segment): add all new endpoints to segment #1459
Merged
joe-ayoub-segment
merged 72 commits into
segmentio:main
from
talon-one:sc-25493-add-all-new-endpoints-to-segment
Aug 24, 2023
Merged
Changes from 71 commits
Commits
Show all changes
72 commits
Select commit
Hold shift + click to select a range
e272fa0
add create audience action
kkupreeva c684925
try enable CI
kkupreeva 612c74b
try fix
kkupreeva 682ab31
return ci how it was
kkupreeva 2ba19f2
add updateAudience, deleteAudience, trackEvent
kkupreeva cc0eecc
check workflow
kkupreeva e26685a
fix tests
kkupreeva 36af31d
fix tests
kkupreeva 7e1c10c
fix description
kkupreeva e8652c5
improve test
kkupreeva 336d84b
fix labels and descriptions
kkupreeva e6562b3
generate types
kkupreeva 3abb5c7
return workflows how it was before
kkupreeva 33e6d2d
change destination name Talon One -> Talon.One
kkupreeva b7e48e6
review
kkupreeva 295b63d
new files
kaatinga 0df88fb
added 3 endpoints
kaatinga 4b47f87
added generated files
kaatinga d95fad1
implemented 3 endppoints
kaatinga c83e0aa
tests
kaatinga cd7960f
fixed tests, added right json tags
kaatinga ab7c139
Merge branch 'main' into sc-7503-add-destination-endpoints-to-work-wi…
kaatinga 6671232
updated models
kaatinga 6d0bd80
updated test models
kaatinga cc20a80
update models
kaatinga 7edca72
updated models
kaatinga a47c146
tests generated
kaatinga 5e3a7ed
updated models
kaatinga cd1022f
tests generated
kaatinga d391a8e
Merge pull request #2 from talon-one/sc-7503-add-destination-endpoint…
kaatinga b7e7d31
Revert "Merge pull request #2 from talon-one/sc-7503-add-destination-…
kaatinga c66c811
Revert "Revert "Merge pull request #2 from talon-one/sc-7503-add-dest…
kaatinga ec2f8fa
added more endpoints and fixed some minor things
kaatinga c63ca9e
deleted an unnecessarily added file
kaatinga 2ece421
updated snapshots, thank you @jinapark202
kaatinga 687a4ac
Merge pull request #6 from talon-one/sc-7503-add-destination-endpoint…
kaatinga 80066b4
Merge branch 'segmentio:main' into main
kaatinga 4285efc
Merge branch 'segmentio:main' into main
kkupreeva b0bba6d
Merge branch 'segmentio:main' into main
kaatinga c04ab5d
Merge branch 'segmentio:main' into main
kaatinga c3b7c5a
Merge branch 'segmentio:main' into main
kaatinga 98e55b3
Merge branch 'segmentio:main' into main
kkupreeva aa361c2
Merge branch 'segmentio:main' into main
kkupreeva 3562b82
Merge branch 'segmentio:main' into main
kkupreeva e5ea929
Merge branch 'segmentio:main' into main
kkupreeva c3f4f42
add updateCustomerProfileV2 action
kkupreeva 47f0956
add default mapping
kkupreeva 29bbb75
integrationId -> integration ID
kkupreeva 5f487cb
new update customer session destination for talon.one
kaatinga e875ad2
Merge pull request #10 from talon-one/sc-9770-adjust-talon-one-segmen…
kaatinga de73d63
fixed tests, review
kaatinga d3153ca
added choices for attributesInfo
kaatinga 390e6f1
reused attributesInfo constant from t1-properties.ts
kaatinga d9a844b
updated test by cardItems array
kaatinga 110db63
updated test by cardItems array
kaatinga 6807790
generated types
kaatinga bdbd6c7
fixed unit tests
kaatinga 5a51c55
fixed a typo
kaatinga dbdf252
Merge branch 'segmentio:main' into main
kkupreeva 2311cc4
review
kaatinga 1ff7796
Merge branch 'segmentio:main' into main
kkupreeva 454e77c
Merge branch 'segmentio:main' into main
kaatinga fc2630a
deleted destination to update multiple attributes fro multiple custom…
kaatinga 68a9e4d
Merge pull request #11 from talon-one/sc-12648-remove-destination-act…
kaatinga 24ce049
Merge branch 'segmentio:main' into main
kkupreeva 0826d2f
Merge branch 'segmentio:main' into main
kkupreeva faba700
Add new talon-integration endpoints to segment
rubyjohn93 dcbd38f
Merge branch 'segmentio:main' into sc-25493-add-all-new-endpoints-to-…
rubyjohn93 bcbe966
Mark old endpoints as deprecated in title and description
rubyjohn93 2420124
Fix PR comments from docs team
rubyjohn93 086c894
Fix casing
rubyjohn93 b5e26e9
Fix PR comments
rubyjohn93 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...ons/src/destinations/talon-one/trackEventV2/__tests__/__snapshots__/snapshot.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Testing snapshot for TalonOne's trackEventV2 destination action: all fields 1`] = ` | ||
Object { | ||
"customerProfileId": "@*g0]#jUfAqZ28L86&D", | ||
"eventAttributes": Object { | ||
"testType": "@*g0]#jUfAqZ28L86&D", | ||
}, | ||
"eventType": "@*g0]#jUfAqZ28L86&D", | ||
} | ||
`; | ||
|
||
exports[`Testing snapshot for TalonOne's trackEventV2 destination action: required fields 1`] = ` | ||
Object { | ||
"customerProfileId": "@*g0]#jUfAqZ28L86&D", | ||
"eventType": "@*g0]#jUfAqZ28L86&D", | ||
} | ||
`; |
73 changes: 73 additions & 0 deletions
73
packages/destination-actions/src/destinations/talon-one/trackEventV2/__tests__/index.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import nock from 'nock' | ||
import { createTestIntegration } from '@segment/actions-core' | ||
import Destination from '../../index' | ||
|
||
const testDestination = createTestIntegration(Destination) | ||
|
||
describe('TalonOne.trackEventV2', () => { | ||
it('misses customer profile ID', async () => { | ||
try { | ||
await testDestination.testAction('trackEventV2', { | ||
settings: { | ||
apiKey: 'some_api_key', | ||
deployment: 'https://internal.europe-west1.talon.one' | ||
} | ||
}) | ||
} catch (err) { | ||
expect(err.message).toContain("The root value is missing the required field 'customerProfileId'.") | ||
} | ||
}) | ||
|
||
it('misses event type', async () => { | ||
try { | ||
await testDestination.testAction('trackEvenV2', { | ||
settings: { | ||
apiKey: 'some_api_key', | ||
deployment: 'https://internal.europe-west1.talon.one' | ||
}, | ||
mapping: { | ||
customerProfileId: 'some_customer_profile_id' | ||
} | ||
}) | ||
} catch (err) { | ||
expect(err.message).toContain("The root value is missing the required field 'eventType'.") | ||
} | ||
}) | ||
|
||
it('should work', async () => { | ||
nock('https://integration.talon.one') | ||
.put('/segment/v2/events?skipNonExistingAttributes=true', { | ||
customerProfileId: 'some_customer_profile_id', | ||
eventType: 'event_type', | ||
eventAttributes: { | ||
favoriteProduct: 'fruits', | ||
isDogLover: true, | ||
stringAttribute: 'test', | ||
booleanAttribute: 'true', | ||
numberAttribute: '12345' | ||
} | ||
}) | ||
.matchHeader('Authorization', 'ApiKey-v1 some_api_key') | ||
.matchHeader('destination-hostname', 'https://something.europe-west1.talon.one') | ||
.reply(200) | ||
|
||
await testDestination.testAction('trackEventV2', { | ||
settings: { | ||
apiKey: 'some_api_key', | ||
deployment: 'https://something.europe-west1.talon.one' | ||
}, | ||
mapping: { | ||
customerProfileId: 'some_customer_profile_id', | ||
skipNonExistingAttributes: true, | ||
eventType: 'event_type', | ||
attributes: { | ||
favoriteProduct: 'fruits', | ||
isDogLover: true, | ||
stringAttribute: 'test', | ||
booleanAttribute: 'true', | ||
numberAttribute: '12345' | ||
} | ||
} | ||
}) | ||
}) | ||
}) |
75 changes: 75 additions & 0 deletions
75
...es/destination-actions/src/destinations/talon-one/trackEventV2/__tests__/snapshot.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
import { createTestEvent, createTestIntegration } from '@segment/actions-core' | ||
import { generateTestData } from '../../../../lib/test-data' | ||
import destination from '../../index' | ||
import nock from 'nock' | ||
|
||
const testDestination = createTestIntegration(destination) | ||
const actionSlug = 'trackEventV2' | ||
const destinationSlug = 'TalonOne' | ||
const seedName = `${destinationSlug}#${actionSlug}` | ||
|
||
describe(`Testing snapshot for ${destinationSlug}'s ${actionSlug} destination action:`, () => { | ||
it('required fields', async () => { | ||
const action = destination.actions[actionSlug] | ||
const [eventData, settingsData] = generateTestData(seedName, destination, action, true) | ||
|
||
nock(/.*/).persist().get(/.*/).reply(200) | ||
nock(/.*/).persist().post(/.*/).reply(200) | ||
nock(/.*/).persist().put(/.*/).reply(200) | ||
|
||
const event = createTestEvent({ | ||
properties: eventData | ||
}) | ||
|
||
const responses = await testDestination.testAction(actionSlug, { | ||
event: event, | ||
mapping: event.properties, | ||
settings: settingsData, | ||
auth: undefined | ||
}) | ||
|
||
const request = responses[0].request | ||
const rawBody = await request.text() | ||
|
||
try { | ||
const json = JSON.parse(rawBody) | ||
expect(json).toMatchSnapshot() | ||
return | ||
} catch (err) { | ||
expect(rawBody).toMatchSnapshot() | ||
} | ||
|
||
expect(request.headers).toMatchSnapshot() | ||
}) | ||
|
||
it('all fields', async () => { | ||
const action = destination.actions[actionSlug] | ||
const [eventData, settingsData] = generateTestData(seedName, destination, action, false) | ||
|
||
nock(/.*/).persist().get(/.*/).reply(200) | ||
nock(/.*/).persist().post(/.*/).reply(200) | ||
nock(/.*/).persist().put(/.*/).reply(200) | ||
|
||
const event = createTestEvent({ | ||
properties: eventData | ||
}) | ||
|
||
const responses = await testDestination.testAction(actionSlug, { | ||
event: event, | ||
mapping: event.properties, | ||
settings: settingsData, | ||
auth: undefined | ||
}) | ||
|
||
const request = responses[0].request | ||
const rawBody = await request.text() | ||
|
||
try { | ||
const json = JSON.parse(rawBody) | ||
expect(json).toMatchSnapshot() | ||
return | ||
} catch (err) { | ||
expect(rawBody).toMatchSnapshot() | ||
} | ||
}) | ||
}) |
22 changes: 22 additions & 0 deletions
22
packages/destination-actions/src/destinations/talon-one/trackEventV2/generated-types.ts
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.