Skip to content

Commit

Permalink
Remove out-of-date tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra committed Nov 13, 2024
1 parent 4afa6c8 commit 3c018f2
Showing 1 changed file with 1 addition and 30 deletions.
31 changes: 1 addition & 30 deletions src/__tests__/posthog-core.beforeSend.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { uuidv7 } from '../uuidv7'
import { defaultPostHog } from './helpers/posthog-instance'
import { logger } from '../utils/logger'
import { CaptureResult, knownUnEditableEvent, knownUnsafeEditableEvent, PostHogConfig } from '../types'
import { CaptureResult, knownUnsafeEditableEvent, PostHogConfig } from '../types'
import { PostHog } from '../posthog-core'

jest.mock('../utils/logger')
Expand Down Expand Up @@ -78,20 +78,6 @@ describe('posthog core - before send', () => {
})
})

it('cannot reject an un-editable event', () => {
const posthog = posthogWith({
before_send: rejectingEventFn,
})
;(posthog._send_request as jest.Mock).mockClear()
// chooses a random string from knownUnEditableEvent
const randomUneditableEvent = knownUnEditableEvent[Math.floor(Math.random() * knownUnEditableEvent.length)]

const capturedData = posthog.capture(randomUneditableEvent, {}, {})

expect(capturedData).not.toBeUndefined()
expect(posthog._send_request).toHaveBeenCalled()
})

it('can sanitize $set event', () => {
const posthog = posthogWith({
before_send: (cr) => {
Expand Down Expand Up @@ -139,21 +125,6 @@ describe('posthog core - before send', () => {
)
})

it('cannot edit an un-editable event', () => {
const posthog = posthogWith({
before_send: editingEventFn,
})
;(posthog._send_request as jest.Mock).mockClear()
// chooses a random string from knownUnEditableEvent
const randomUneditableEvent = knownUnEditableEvent[Math.floor(Math.random() * knownUnEditableEvent.length)]

const capturedData = posthog.capture(randomUneditableEvent, {}, {})

expect(capturedData).not.toHaveProperty(['properties', 'edited'])
expect(capturedData).not.toHaveProperty(['$set', 'edited'])
expect(posthog._send_request).toHaveBeenCalled()
})

it('logs a warning when rejecting an unsafe to edit event', () => {
const posthog = posthogWith({
before_send: rejectingEventFn,
Expand Down

0 comments on commit 3c018f2

Please sign in to comment.