diff --git a/packages/browser-destinations/destinations/heap/src/__tests__/__snapshots__/index.test.ts.snap b/packages/browser-destinations/destinations/heap/src/__tests__/__snapshots__/index.test.ts.snap
new file mode 100644
index 0000000000..8348373ffc
--- /dev/null
+++ b/packages/browser-destinations/destinations/heap/src/__tests__/__snapshots__/index.test.ts.snap
@@ -0,0 +1,18 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Heap loading 1`] = `
+NodeList [
+ ,
+ ,
+ ,
+]
+`;
diff --git a/packages/browser-destinations/destinations/heap/src/__tests__/index.test.ts b/packages/browser-destinations/destinations/heap/src/__tests__/index.test.ts
index 3153c7c418..ba04dd2e12 100644
--- a/packages/browser-destinations/destinations/heap/src/__tests__/index.test.ts
+++ b/packages/browser-destinations/destinations/heap/src/__tests__/index.test.ts
@@ -1,6 +1,6 @@
import { Analytics, Context } from '@segment/analytics-next'
import heapDestination, { destination } from '../index'
-import { HEAP_TEST_ENV_ID, mockHeapJsHttpRequest } from '../test-utilities'
+import { HEAP_TEST_ENV_ID } from '../test-utilities'
const subscriptions = [
{
@@ -16,19 +16,19 @@ describe('Heap', () => {
test('loading', async () => {
jest.spyOn(destination, 'initialize')
- mockHeapJsHttpRequest()
-
const [event] = await heapDestination({ appId: HEAP_TEST_ENV_ID, subscriptions })
await event.load(Context.system(), {} as Analytics)
expect(destination.initialize).toHaveBeenCalled()
expect(window.heap.appid).toEqual(HEAP_TEST_ENV_ID)
+
+ const scripts = window.document.querySelectorAll('script')
+ expect(scripts).toMatchSnapshot()
})
+
test('loading with cdn', async () => {
jest.spyOn(destination, 'initialize')
- mockHeapJsHttpRequest()
-
const [event] = await heapDestination({
appId: HEAP_TEST_ENV_ID,
subscriptions,
diff --git a/packages/browser-destinations/destinations/heap/src/test-utilities.ts b/packages/browser-destinations/destinations/heap/src/test-utilities.ts
index f8367604ec..0cdb949390 100644
--- a/packages/browser-destinations/destinations/heap/src/test-utilities.ts
+++ b/packages/browser-destinations/destinations/heap/src/test-utilities.ts
@@ -1,6 +1,5 @@
import { HeapApi } from './types'
import { Subscription } from '@segment/browser-destination-runtime/types'
-import nock from 'nock'
export const HEAP_TEST_ENV_ID = '1'
@@ -18,6 +17,7 @@ export const createMockedHeapJsSdk = (): HeapApi => {
addUserProperties: jest.fn()
}
}
+
export const trackEventSubscription: Subscription = {
partnerAction: 'trackEvent',
name: 'Track Event',
@@ -59,7 +59,3 @@ export const identifyUserSubscription: Subscription = {
}
}
}
-
-export const mockHeapJsHttpRequest = (): void => {
- nock('https://cdn.heapanalytics.com').get(`/js/heap-${HEAP_TEST_ENV_ID}.js`).reply(200, {})
-}