Skip to content

Commit

Permalink
Might as well add a test while we're here
Browse files Browse the repository at this point in the history
  • Loading branch information
tkaemming committed Mar 14, 2024
1 parent 7ddd52a commit 233a86f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,11 @@ test('setupPlugin groupType and groupTypeIndex need to be set', async () => {
await setupPlugin({ ...meta, config: { groupTypeIndex: 0, groupType: 'test' } })
})

test('runEveryMinute', async () => {
test.each([
['Invoice Period End Date', '2022-07-27T16:00:09.000Z'],
['Invoice Payment Date','2022-07-27T17:28:20.000Z'],
])('runEveryMinute', async (invoiceEventTimestampType, invoiceTimestamp) => {
global.getInvoiceTimestamp = INVOICE_EVENT_TIMESTAMP_TYPES[invoiceEventTimestampType]
expect(fetch).toHaveBeenCalledTimes(0)
expect(posthog.capture).toHaveBeenCalledTimes(0)

Expand Down Expand Up @@ -158,7 +162,7 @@ test('runEveryMinute', async () => {

expect(posthog.capture).toHaveBeenNthCalledWith(3, 'Stripe Invoice Paid', {
distinct_id: 'test_distinct_id',
timestamp: '2022-07-27T16:00:09.000Z',
timestamp: invoiceTimestamp,
stripe_customer_id: 'cus_stripeid1',
stripe_amount_paid: 2000,
stripe_amount_due: 2000,
Expand Down

0 comments on commit 233a86f

Please sign in to comment.