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

revert endpoint changes #11

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@
}

describe('Hubspot MC event handler works correctly', () => {
const fetchedRequests: any = []

Check warning on line 47 in src/index.test.ts

View workflow job for this annotation

GitHub Actions / build-test (20.x)

Unexpected any. Specify a different type
const setCookies: any = []

Check warning on line 48 in src/index.test.ts

View workflow job for this annotation

GitHub Actions / build-test (20.x)

Unexpected any. Specify a different type

const settings = {
accountId: '12345',
Expand Down Expand Up @@ -87,8 +87,8 @@
sendEvent(settings)(fakeEvent)

it('creates the Hubspot track request correctly', async () => {
const request = fetchedRequests.find((x: any) =>

Check warning on line 90 in src/index.test.ts

View workflow job for this annotation

GitHub Actions / build-test (20.x)

Unexpected any. Specify a different type
x.url.startsWith('https://track-eu1.hubspot.com/__ptq.gif?')
x.url.startsWith('https://track-eu1.hubspot.com/__ptbe.gif?')
)
expect(request).toBeTruthy()
expect(request?.opts?.mode).toEqual('no-cors')
Expand All @@ -97,7 +97,7 @@

const url = new URL(request.url)

expect(url.pathname).toEqual('/__ptq.gif')
expect(url.pathname).toEqual('/__ptbe.gif')
expect(url.searchParams.get('k')).toEqual('3')
expect(url.searchParams.get('v')).toEqual('1.1')
expect(url.searchParams.get('a')).toEqual(settings.accountId)
Expand Down Expand Up @@ -125,20 +125,20 @@
})

it('sets the cookies correctly', () => {
const hubspotutk = setCookies.find((x: any) => x.key === 'hubspotutk')

Check warning on line 128 in src/index.test.ts

View workflow job for this annotation

GitHub Actions / build-test (20.x)

Unexpected any. Specify a different type
expect(hubspotutk).toBeTruthy()
expect(hubspotutk.value).toMatch(uuidv4NoDashesRegex)

const __hssrc = setCookies.find((x: any) => x.key === 'hssrc')

Check warning on line 132 in src/index.test.ts

View workflow job for this annotation

GitHub Actions / build-test (20.x)

Unexpected any. Specify a different type
expect(__hssrc).toBeTruthy()
expect(__hssrc.value).toEqual('1')
expect(__hssrc.opts?.scope).toEqual('session')

const __hstc = setCookies.find((x: any) => x.key === 'hstc')

Check warning on line 137 in src/index.test.ts

View workflow job for this annotation

GitHub Actions / build-test (20.x)

Unexpected any. Specify a different type
expect(__hstc).toBeTruthy()
expect(__hstc.value).toMatch(uCookieRegex)

const __hssc = setCookies.find((x: any) => x.key === 'hssc')

Check warning on line 141 in src/index.test.ts

View workflow job for this annotation

GitHub Actions / build-test (20.x)

Unexpected any. Specify a different type
expect(__hssc).toBeTruthy()
expect(__hssc.value).toMatch(bCookieRegex)
})
Expand Down Expand Up @@ -172,7 +172,7 @@
})

describe('Hubspot MC Collected Form handler works correctly', () => {
let fetchRequest: any

Check warning on line 175 in src/index.test.ts

View workflow job for this annotation

GitHub Actions / build-test (20.x)

Unexpected any. Specify a different type
const utk = 'dummy-utk-cookie-value'

const settings = {
Expand Down Expand Up @@ -295,7 +295,7 @@
`https://api.hsforms.com/submissions/v3/integration/submit/12345/form_id`
)

data.fields.forEach((field: any) => {

Check warning on line 298 in src/index.test.ts

View workflow job for this annotation

GitHub Actions / build-test (20.x)

Unexpected any. Specify a different type
expect(field.name).toBeTruthy()
expect(field.value).toBeTruthy()
})
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
client.fetch(
`https://track${getRegionPrefix(
regionPrefix
)}.hubspot.com/__ptq.gif?${params}`,
)}.hubspot.com/__ptbe.gif?${params}`,
{
credentials: 'include',
keepalive: true,
Expand Down Expand Up @@ -193,7 +193,7 @@
accountId || settings.accountId
}/${formId}`

const data: any = {

Check warning on line 196 in src/index.ts

View workflow job for this annotation

GitHub Actions / build-test (20.x)

Unexpected any. Specify a different type
fields: Object.entries(restPayload).map(field => {
return {
name: field[0],
Expand Down
2 changes: 2 additions & 0 deletions vitest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
import { defineConfig } from 'vitest/config';
export default defineConfig({})
Loading