Skip to content

Commit 4132911

Browse files
committed
Updated tests and dependencies
1 parent 487278c commit 4132911

File tree

5 files changed

+54
-22
lines changed

5 files changed

+54
-22
lines changed

packages/destination-actions/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
"liquidjs": "^10.16.7",
5858
"lodash": "^4.17.21",
5959
"lru-cache": "10.4.3",
60-
"ssh2-sftp-client": "^11.0.0"
60+
"ssh2-sftp-client": "^10.0.3"
6161
},
6262
"jest": {
6363
"preset": "ts-jest",

packages/destination-actions/src/destinations/amplitude/__tests__/amplitude.test.ts

Lines changed: 45 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,9 @@ describe('Amplitude', () => {
788788
expect(responses.length).toBe(1)
789789
expect(responses[0].status).toBe(200)
790790
expect(responses[0].data).toMatchObject({})
791-
expect(responses[0].options.body).toMatchInlineSnapshot(`URLSearchParams {}`)
791+
expect(responses[0].options.body.toString()).toMatchInlineSnapshot(
792+
`"api_key=undefined&mapping=%5B%7B%22user_id%22%3A%22some-previous-user-id%22%2C%22global_user_id%22%3A%22some-user-id%22%7D%5D"`
793+
)
792794
})
793795

794796
it('should send data to the EU endpoint', async () => {
@@ -812,7 +814,9 @@ describe('Amplitude', () => {
812814
expect(responses.length).toBe(1)
813815
expect(responses[0].status).toBe(200)
814816
expect(responses[0].data).toMatchObject({})
815-
expect(responses[0].options.body).toMatchInlineSnapshot(`URLSearchParams {}`)
817+
expect(responses[0].options.body.toString()).toMatchInlineSnapshot(
818+
`"api_key=&mapping=%5B%7B%22user_id%22%3A%22some-previous-user-id%22%2C%22global_user_id%22%3A%22some-user-id%22%7D%5D"`
819+
)
816820
})
817821
})
818822

@@ -1979,7 +1983,9 @@ describe('Amplitude', () => {
19791983
expect(responses.length).toBe(1)
19801984
expect(responses[0].status).toBe(200)
19811985
expect(responses[0].data).toMatchObject({})
1982-
expect(responses[0].options.body).toMatchInlineSnapshot(`URLSearchParams {}`)
1986+
expect(responses[0].options.body.toString()).toMatchInlineSnapshot(
1987+
`"api_key=undefined&identification=%7B%22os_name%22%3A%22iOS%22%2C%22os_version%22%3A%229%22%2C%22device_manufacturer%22%3A%22Apple%22%2C%22device_model%22%3A%22iPhone%22%2C%22device_type%22%3A%22mobile%22%2C%22user_id%22%3A%22some-user-id%22%2C%22device_id%22%3A%22some-anonymous-id%22%2C%22user_properties%22%3A%7B%22some-trait-key%22%3A%22some-trait-value%22%7D%2C%22country%22%3A%22United+States%22%2C%22city%22%3A%22San+Francisco%22%2C%22language%22%3A%22en-US%22%2C%22platform%22%3A%22Web%22%2C%22library%22%3A%22segment%22%7D&options=undefined"`
1988+
)
19831989
})
19841990

19851991
it('should support referrer and utm user_properties', async () => {
@@ -2010,7 +2016,9 @@ describe('Amplitude', () => {
20102016
expect(responses.length).toBe(1)
20112017
expect(responses[0].status).toBe(200)
20122018
expect(responses[0].data).toMatchObject({})
2013-
expect(responses[0].options.body).toMatchInlineSnapshot(`URLSearchParams {}`)
2019+
expect(responses[0].options.body.toString()).toMatchInlineSnapshot(
2020+
`"api_key=undefined&identification=%7B%22user_id%22%3A%22some-user-id%22%2C%22device_id%22%3A%22some-anonymous-id%22%2C%22user_properties%22%3A%7B%22some-trait-key%22%3A%22some-trait-value%22%2C%22%24set%22%3A%7B%22utm_source%22%3A%22Newsletter%22%2C%22utm_medium%22%3A%22email%22%2C%22utm_campaign%22%3A%22TPS+Innovation+Newsletter%22%2C%22utm_term%22%3A%22tps+reports%22%2C%22utm_content%22%3A%22image+link%22%2C%22referrer%22%3A%22some-referrer%22%7D%2C%22%24setOnce%22%3A%7B%22initial_utm_source%22%3A%22Newsletter%22%2C%22initial_utm_medium%22%3A%22email%22%2C%22initial_utm_campaign%22%3A%22TPS+Innovation+Newsletter%22%2C%22initial_utm_term%22%3A%22tps+reports%22%2C%22initial_utm_content%22%3A%22image+link%22%2C%22initial_referrer%22%3A%22some-referrer%22%7D%7D%2C%22library%22%3A%22segment%22%7D&options=undefined"`
2021+
)
20142022
})
20152023

20162024
it('shouldnt append $ keys to user_properties if referrer/utm are not specified', async () => {
@@ -2029,7 +2037,9 @@ describe('Amplitude', () => {
20292037
expect(responses.length).toBe(1)
20302038
expect(responses[0].status).toBe(200)
20312039
expect(responses[0].data).toMatchObject({})
2032-
expect(responses[0].options.body).toMatchInlineSnapshot(`URLSearchParams {}`)
2040+
expect(responses[0].options.body.toString()).toMatchInlineSnapshot(
2041+
`"api_key=undefined&identification=%7B%22os_name%22%3A%22iOS%22%2C%22os_version%22%3A%229%22%2C%22device_manufacturer%22%3A%22Apple%22%2C%22device_model%22%3A%22iPhone%22%2C%22device_type%22%3A%22mobile%22%2C%22user_id%22%3A%22some-user-id%22%2C%22device_id%22%3A%22some-anonymous-id%22%2C%22user_properties%22%3A%7B%22some-trait-key%22%3A%22some-trait-value%22%7D%2C%22country%22%3A%22United+States%22%2C%22city%22%3A%22San+Francisco%22%2C%22language%22%3A%22en-US%22%2C%22platform%22%3A%22Web%22%2C%22library%22%3A%22segment%22%7D&options=undefined"`
2042+
)
20332043
})
20342044

20352045
it('should support parsing userAgent when the setting is true', async () => {
@@ -2060,7 +2070,9 @@ describe('Amplitude', () => {
20602070
expect(responses.length).toBe(1)
20612071
expect(responses[0].status).toBe(200)
20622072
expect(responses[0].data).toMatchObject({})
2063-
expect(responses[0].options.body).toMatchInlineSnapshot(`URLSearchParams {}`)
2073+
expect(responses[0].options.body.toString()).toMatchInlineSnapshot(
2074+
`"api_key=undefined&identification=%7B%22os_name%22%3A%22Mac+OS%22%2C%22os_version%22%3A%2253%22%2C%22device_model%22%3A%22Mac+OS%22%2C%22user_id%22%3A%22some-user-id%22%2C%22device_id%22%3A%22foo%22%2C%22user_properties%22%3A%7B%22some-trait-key%22%3A%22some-trait-value%22%7D%2C%22library%22%3A%22segment%22%7D&options=undefined"`
2075+
)
20642076
})
20652077

20662078
it('should not send parsed user agent properties when setting is false', async () => {
@@ -2091,7 +2103,9 @@ describe('Amplitude', () => {
20912103
expect(responses.length).toBe(1)
20922104
expect(responses[0].status).toBe(200)
20932105
expect(responses[0].data).toMatchObject({})
2094-
expect(responses[0].options.body).toMatchInlineSnapshot(`URLSearchParams {}`)
2106+
expect(responses[0].options.body.toString()).toMatchInlineSnapshot(
2107+
`"api_key=undefined&identification=%7B%22user_id%22%3A%22some-user-id%22%2C%22device_id%22%3A%22foo%22%2C%22user_properties%22%3A%7B%22some-trait-key%22%3A%22some-trait-value%22%7D%2C%22library%22%3A%22segment%22%7D&options=undefined"`
2108+
)
20952109
})
20962110

20972111
it('should change casing for device type when value is android', async () => {
@@ -2110,7 +2124,9 @@ describe('Amplitude', () => {
21102124

21112125
nock('https://api2.amplitude.com').post('/identify').reply(200, {})
21122126
const responses = await testDestination.testAction('identifyUser', { event, mapping, useDefaultMappings: true })
2113-
expect(responses[0].options.body).toMatchInlineSnapshot(`URLSearchParams {}`)
2127+
expect(responses[0].options.body.toString()).toMatchInlineSnapshot(
2128+
`"api_key=undefined&identification=%7B%22user_id%22%3A%22user1234%22%2C%22device_id%22%3A%22foo%22%2C%22user_properties%22%3A%7B%7D%2C%22platform%22%3A%22Android%22%2C%22library%22%3A%22segment%22%7D&options=undefined"`
2129+
)
21142130
})
21152131

21162132
it('should change casing for device type when value is ios', async () => {
@@ -2129,7 +2145,9 @@ describe('Amplitude', () => {
21292145

21302146
nock('https://api2.amplitude.com').post('/identify').reply(200, {})
21312147
const responses = await testDestination.testAction('identifyUser', { event, mapping, useDefaultMappings: true })
2132-
expect(responses[0].options.body).toMatchInlineSnapshot(`URLSearchParams {}`)
2148+
expect(responses[0].options.body.toString()).toMatchInlineSnapshot(
2149+
`"api_key=undefined&identification=%7B%22user_id%22%3A%22user1234%22%2C%22device_id%22%3A%22foo%22%2C%22user_properties%22%3A%7B%7D%2C%22platform%22%3A%22iOS%22%2C%22library%22%3A%22segment%22%7D&options=undefined"`
2150+
)
21332151
})
21342152

21352153
it('should send data to the EU endpoint', async () => {
@@ -2156,7 +2174,9 @@ describe('Amplitude', () => {
21562174
expect(responses.length).toBe(1)
21572175
expect(responses[0].status).toBe(200)
21582176
expect(responses[0].data).toMatchObject({})
2159-
expect(responses[0].options.body).toMatchInlineSnapshot(`URLSearchParams {}`)
2177+
expect(responses[0].options.body.toString()).toMatchInlineSnapshot(
2178+
`"api_key=&identification=%7B%22os_name%22%3A%22iOS%22%2C%22os_version%22%3A%229%22%2C%22device_manufacturer%22%3A%22Apple%22%2C%22device_model%22%3A%22iPhone%22%2C%22device_type%22%3A%22mobile%22%2C%22user_id%22%3A%22some-user-id%22%2C%22device_id%22%3A%22some-anonymous-id%22%2C%22user_properties%22%3A%7B%22some-trait-key%22%3A%22some-trait-value%22%7D%2C%22country%22%3A%22United+States%22%2C%22city%22%3A%22San+Francisco%22%2C%22language%22%3A%22en-US%22%2C%22platform%22%3A%22Web%22%2C%22library%22%3A%22segment%22%7D&options=undefined"`
2179+
)
21602180
})
21612181

21622182
it('should give precedence to OS properties over userAgent properties', async () => {
@@ -2191,7 +2211,9 @@ describe('Amplitude', () => {
21912211
expect(responses.length).toBe(1)
21922212
expect(responses[0].status).toBe(200)
21932213
expect(responses[0].data).toMatchObject({})
2194-
expect(responses[0].options.body).toMatchInlineSnapshot(`URLSearchParams {}`)
2214+
expect(responses[0].options.body.toString()).toMatchInlineSnapshot(
2215+
`"api_key=undefined&identification=%7B%22os_name%22%3A%22iPhone+OS%22%2C%22os_version%22%3A%228.1.3%22%2C%22device_model%22%3A%22Mac+OS%22%2C%22user_id%22%3A%22some-user-id%22%2C%22device_id%22%3A%22foo%22%2C%22user_properties%22%3A%7B%22some-trait-key%22%3A%22some-trait-value%22%7D%2C%22library%22%3A%22segment%22%7D&options=undefined"`
2216+
)
21952217
})
21962218
})
21972219

@@ -2224,7 +2246,9 @@ describe('Amplitude', () => {
22242246

22252247
expect(response.status).toBe(200)
22262248
expect(response.data).toMatchObject({})
2227-
expect(response.options.body).toMatchInlineSnapshot(`URLSearchParams {}`)
2249+
expect(response.options.body.toString()).toMatchInlineSnapshot(
2250+
`"api_key=undefined&identification=%5B%7B%22device_id%22%3A%22some-anonymous-id%22%2C%22groups%22%3A%7B%22some-type%22%3A%22some-value%22%7D%2C%22insert_id%22%3A%22some-insert-id%22%2C%22library%22%3A%22segment%22%2C%22time%22%3A1618245157710%2C%22user_id%22%3A%22some-user-id%22%2C%22user_properties%22%3A%7B%22some-type%22%3A%22some-value%22%7D%7D%5D&options=undefined"`
2251+
)
22282252
})
22292253

22302254
it('should fire groupidentify call to Amplitude', async () => {
@@ -2239,7 +2263,9 @@ describe('Amplitude', () => {
22392263

22402264
expect(response.status).toBe(200)
22412265
expect(response.data).toMatchObject({})
2242-
expect(response.options.body).toMatchInlineSnapshot(`URLSearchParams {}`)
2266+
expect(response.options.body.toString()).toMatchInlineSnapshot(
2267+
`"api_key=undefined&identification=%5B%7B%22group_properties%22%3A%7B%22some-trait-key%22%3A%22some-trait-value%22%7D%2C%22group_value%22%3A%22some-value%22%2C%22group_type%22%3A%22some-type%22%2C%22library%22%3A%22segment%22%7D%5D&options=undefined"`
2268+
)
22432269
})
22442270

22452271
it('should fire identify call to Amplitude EU endpoint', async () => {
@@ -2259,7 +2285,9 @@ describe('Amplitude', () => {
22592285

22602286
expect(response.status).toBe(200)
22612287
expect(response.data).toMatchObject({})
2262-
expect(response.options.body).toMatchInlineSnapshot(`URLSearchParams {}`)
2288+
expect(response.options.body.toString()).toMatchInlineSnapshot(
2289+
`"api_key=&identification=%5B%7B%22device_id%22%3A%22some-anonymous-id%22%2C%22groups%22%3A%7B%22some-type%22%3A%22some-value%22%7D%2C%22insert_id%22%3A%22some-insert-id%22%2C%22library%22%3A%22segment%22%2C%22time%22%3A1618245157710%2C%22user_id%22%3A%22some-user-id%22%2C%22user_properties%22%3A%7B%22some-type%22%3A%22some-value%22%7D%7D%5D&options=undefined"`
2290+
)
22632291
})
22642292

22652293
it('should fire groupidentify call to Amplitude EU endpoint', async () => {
@@ -2279,7 +2307,9 @@ describe('Amplitude', () => {
22792307

22802308
expect(response.status).toBe(200)
22812309
expect(response.data).toMatchObject({})
2282-
expect(response.options.body).toMatchInlineSnapshot(`URLSearchParams {}`)
2310+
expect(response.options.body.toString()).toMatchInlineSnapshot(
2311+
`"api_key=&identification=%5B%7B%22group_properties%22%3A%7B%22some-trait-key%22%3A%22some-trait-value%22%7D%2C%22group_value%22%3A%22some-value%22%2C%22group_type%22%3A%22some-type%22%2C%22library%22%3A%22segment%22%7D%5D&options=undefined"`
2312+
)
22832313
})
22842314
})
22852315

packages/destination-actions/src/destinations/display-video-360/__tests__/shared.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ describe('shared', () => {
203203
expect(r.ops.length).toEqual(5)
204204
expect(r.processConsent).toEqual(true)
205205
expect(r.toJsonString()).toMatchInlineSnapshot(
206-
`"{\\"ops\\":[{\\"userId\\":\\"CAESEHIV8HXNp0pFdHgi2rElMfk\\",\\"userIdType\\":\\"GOOGLE_USER_ID\\",\\"userListId\\":\\"456\\",\\"delete\\":false},{\\"userId\\":\\"3b6e47b3-1437-4ba2-b3c9-446e4d0cd1e5\\",\\"userIdType\\":\\"IDFA\\",\\"userListId\\":\\"456\\",\\"delete\\":false},{\\"userId\\":\\"my-anon-id-42\\",\\"userIdType\\":\\"PARTNER_PROVIDED_ID\\",\\"userListId\\":\\"456\\",\\"delete\\":false},{\\"userId\\":\\"my-anon-id-43\\",\\"userIdType\\":\\"PARTNER_PROVIDED_ID\\",\\"userListId\\":\\"456\\",\\"delete\\":false},{\\"userId\\":\\"XNp0pFdHgi2rElMfk\\",\\"userIdType\\":\\"GOOGLE_USER_ID\\",\\"userListId\\":\\"456\\",\\"delete\\":false}],\\"processConsent\\":true}"`
206+
`"{\\"ops\\":[{\\"userId\\":\\"CAESEHIV8HXNp0pFdHgi2rElMfk\\",\\"userListId\\":\\"456\\",\\"delete\\":false,\\"userIdType\\":\\"GOOGLE_USER_ID\\"},{\\"userId\\":\\"3b6e47b3-1437-4ba2-b3c9-446e4d0cd1e5\\",\\"userListId\\":\\"456\\",\\"delete\\":false,\\"userIdType\\":\\"IDFA\\"},{\\"userId\\":\\"my-anon-id-42\\",\\"userListId\\":\\"456\\",\\"delete\\":false,\\"userIdType\\":\\"PARTNER_PROVIDED_ID\\"},{\\"userId\\":\\"my-anon-id-43\\",\\"userListId\\":\\"456\\",\\"delete\\":false,\\"userIdType\\":\\"PARTNER_PROVIDED_ID\\"},{\\"userId\\":\\"XNp0pFdHgi2rElMfk\\",\\"userListId\\":\\"456\\",\\"delete\\":false,\\"userIdType\\":\\"GOOGLE_USER_ID\\"}],\\"processConsent\\":true}"`
207207
)
208208
})
209209

packages/destination-actions/src/destinations/twilio/__tests__/twilio.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ describe('Twilio', () => {
4545
expect(responses.length).toBe(1)
4646
expect(responses[0].status).toBe(201)
4747

48-
expect(responses[0].options.body).toMatchInlineSnapshot(`URLSearchParams {}`)
48+
expect(responses[0].options.body.toString()).toMatchInlineSnapshot(
49+
`"From=%2B12056065576&To=%2B17758638863&Body=Hello%2C+World%21&MediaUrl=https%3A%2F%2Fdemo.twilio.com%2Fowl.png"`
50+
)
4951

5052
expect(responses[0].request.headers).toMatchInlineSnapshot(`
5153
Headers {

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16187,10 +16187,10 @@ sprintf-js@~1.0.2:
1618716187
resolved "https://registry.yarnpkg.com/sprintf-js/-/sprintf-js-1.0.3.tgz#04e6926f662895354f3dd015203633b857297e2c"
1618816188
integrity sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=
1618916189

16190-
ssh2-sftp-client@^11.0.0:
16191-
version "11.0.0"
16192-
resolved "https://registry.yarnpkg.com/ssh2-sftp-client/-/ssh2-sftp-client-11.0.0.tgz#86909d9b02ab09cb47ec45a1c287c97dafd44b3d"
16193-
integrity sha512-lOjgNYtioYquhtgyHwPryFNhllkuENjvCKkUXo18w/Q4UpEffCnEUBfiOTlwFdKIhG1rhrOGnA6DeKPSF2CP6w==
16190+
ssh2-sftp-client@^10.0.3:
16191+
version "10.0.3"
16192+
resolved "https://registry.yarnpkg.com/ssh2-sftp-client/-/ssh2-sftp-client-10.0.3.tgz#aa8f9b875b745a0b6108692f576343437e428a86"
16193+
integrity sha512-Wlhasz/OCgrlqC8IlBZhF19Uw/X/dHI8ug4sFQybPE+0sDztvgvDf7Om6o7LbRLe68E7XkFZf3qMnqAvqn1vkQ==
1619416194
dependencies:
1619516195
concat-stream "^2.0.0"
1619616196
promise-retry "^2.0.1"

0 commit comments

Comments
 (0)