Skip to content
Merged
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
24 changes: 12 additions & 12 deletions packages/cli/scripts/test-integration-account-management.sh
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ npx tsx scripts/test-account-methods.ts get-account > /dev/null 2>&1 || true

# Get account from database (most recently synced)
ACCOUNT_ID=$(docker exec stripe-sync-test-db psql -U postgres -d app_db -t -c \
"SELECT _id FROM stripe.accounts ORDER BY _last_synced_at DESC LIMIT 1;" 2>/dev/null | tr -d ' ')
"SELECT id FROM stripe.accounts ORDER BY _last_synced_at DESC LIMIT 1;" 2>/dev/null | tr -d ' ')

if [[ "$ACCOUNT_ID" == acct_* ]]; then
echo "✓ Account fetched: $ACCOUNT_ID"
Expand All @@ -126,14 +126,14 @@ else
fi

ACCOUNT_EMAIL=$(docker exec stripe-sync-test-db psql -U postgres -d app_db -t -c \
"SELECT (_raw_data)->>'email' FROM stripe.accounts WHERE _id = '$ACCOUNT_ID';" 2>/dev/null | tr -d ' ')
"SELECT (_raw_data)->>'email' FROM stripe.accounts WHERE id = '$ACCOUNT_ID';" 2>/dev/null | tr -d ' ')
echo " Email: $ACCOUNT_EMAIL"
echo ""

# Test 1.2: Database Persistence Check
echo "TEST 1.2: Database Persistence"
DB_COUNT=$(docker exec stripe-sync-test-db psql -U postgres -d app_db -t -c \
"SELECT COUNT(*) FROM stripe.accounts WHERE _id = '$ACCOUNT_ID';" 2>/dev/null | tr -d ' ')
"SELECT COUNT(*) FROM stripe.accounts WHERE id = '$ACCOUNT_ID';" 2>/dev/null | tr -d ' ')

if [ "$DB_COUNT" -eq 1 ]; then
echo "✓ Account persisted to database"
Expand All @@ -144,7 +144,7 @@ fi

# Verify raw_data column exists
RAW_DATA=$(docker exec stripe-sync-test-db psql -U postgres -d app_db -t -c \
"SELECT _raw_data::text FROM stripe.accounts WHERE _id = '$ACCOUNT_ID' LIMIT 1;" 2>/dev/null | tr -d ' ' | head -c 20)
"SELECT _raw_data::text FROM stripe.accounts WHERE id = '$ACCOUNT_ID' LIMIT 1;" 2>/dev/null | tr -d ' ' | head -c 20)

if [ -n "$RAW_DATA" ]; then
echo "✓ raw_data column populated"
Expand Down Expand Up @@ -179,7 +179,7 @@ else
fi

FIRST_ID=$(docker exec stripe-sync-test-db psql -U postgres -d app_db -t -c \
"SELECT _id FROM stripe.accounts ORDER BY _last_synced_at DESC LIMIT 1;" 2>/dev/null | tr -d ' ')
"SELECT id FROM stripe.accounts ORDER BY _last_synced_at DESC LIMIT 1;" 2>/dev/null | tr -d ' ')
if [ "$FIRST_ID" = "$ACCOUNT_ID" ]; then
echo "✓ Account ID matches: $FIRST_ID"
else
Expand All @@ -190,7 +190,7 @@ echo ""
# Test 2.2: Database Data Validation
echo "TEST 2.2: Database Data Validation"
RAW_DATA_CHECK=$(docker exec stripe-sync-test-db psql -U postgres -d app_db -t -c \
"SELECT CASE WHEN _raw_data IS NOT NULL THEN 1 ELSE 0 END FROM stripe.accounts WHERE _id = '$ACCOUNT_ID';" 2>/dev/null | tr -d ' ')
"SELECT CASE WHEN _raw_data IS NOT NULL THEN 1 ELSE 0 END FROM stripe.accounts WHERE id = '$ACCOUNT_ID';" 2>/dev/null | tr -d ' ')
if [ "$RAW_DATA_CHECK" -eq 1 ]; then
echo "✓ Valid account data in database"
else
Expand All @@ -202,7 +202,7 @@ echo ""
# Test 2.3: Ordering Check (via database)
echo "TEST 2.3: Ordering by Last Synced"
FIRST_ACCOUNT_ID=$(docker exec stripe-sync-test-db psql -U postgres -d app_db -t -c \
"SELECT _id FROM stripe.accounts ORDER BY _last_synced_at DESC LIMIT 1;" 2>/dev/null | tr -d ' ')
"SELECT id FROM stripe.accounts ORDER BY _last_synced_at DESC LIMIT 1;" 2>/dev/null | tr -d ' ')
if [ -n "$FIRST_ACCOUNT_ID" ]; then
echo "✓ First account: $FIRST_ACCOUNT_ID"
else
Expand Down Expand Up @@ -311,7 +311,7 @@ PRODUCTS_TO_DELETE=$(docker exec stripe-sync-test-db psql -U postgres -d app_db
CUSTOMERS_TO_DELETE=$(docker exec stripe-sync-test-db psql -U postgres -d app_db -t -c \
"SELECT COUNT(*) FROM stripe.customers WHERE _account_id = '$ACCOUNT_ID';" 2>/dev/null | tr -d ' ')
ACCOUNTS_TO_DELETE=$(docker exec stripe-sync-test-db psql -U postgres -d app_db -t -c \
"SELECT COUNT(*) FROM stripe.accounts WHERE _id = '$ACCOUNT_ID';" 2>/dev/null | tr -d ' ')
"SELECT COUNT(*) FROM stripe.accounts WHERE id = '$ACCOUNT_ID';" 2>/dev/null | tr -d ' ')

# Perform actual deletion
npx tsx scripts/test-account-methods.ts delete-account "$ACCOUNT_ID" > /dev/null 2>&1 || true
Expand All @@ -322,7 +322,7 @@ PRODUCTS_AFTER=$(docker exec stripe-sync-test-db psql -U postgres -d app_db -t -
CUSTOMERS_AFTER=$(docker exec stripe-sync-test-db psql -U postgres -d app_db -t -c \
"SELECT COUNT(*) FROM stripe.customers WHERE _account_id = '$ACCOUNT_ID';" 2>/dev/null | tr -d ' ')
ACCOUNTS_AFTER=$(docker exec stripe-sync-test-db psql -U postgres -d app_db -t -c \
"SELECT COUNT(*) FROM stripe.accounts WHERE _id = '$ACCOUNT_ID';" 2>/dev/null | tr -d ' ')
"SELECT COUNT(*) FROM stripe.accounts WHERE id = '$ACCOUNT_ID';" 2>/dev/null | tr -d ' ')

FINAL_DELETED_PRODUCTS=$((PRODUCTS_TO_DELETE - PRODUCTS_AFTER))
FINAL_DELETED_CUSTOMERS=$((CUSTOMERS_TO_DELETE - CUSTOMERS_AFTER))
Expand Down Expand Up @@ -365,7 +365,7 @@ REMAINING_CUSTOMERS=$(docker exec stripe-sync-test-db psql -U postgres -d app_db
"SELECT COUNT(*) FROM stripe.customers WHERE _account_id = '$ACCOUNT_ID';" 2>/dev/null | tr -d ' ')

REMAINING_ACCOUNT=$(docker exec stripe-sync-test-db psql -U postgres -d app_db -t -c \
"SELECT COUNT(*) FROM stripe.accounts WHERE _id = '$ACCOUNT_ID';" 2>/dev/null | tr -d ' ')
"SELECT COUNT(*) FROM stripe.accounts WHERE id = '$ACCOUNT_ID';" 2>/dev/null | tr -d ' ')

if [ "$REMAINING_PRODUCTS" -eq 0 ]; then
echo "✓ All products removed from database"
Expand Down Expand Up @@ -393,14 +393,14 @@ echo ""
echo "TEST 3.4: Delete Non-Existent Account Error Handling"
# Count accounts with this fake ID before deletion attempt
BEFORE_COUNT=$(docker exec stripe-sync-test-db psql -U postgres -d app_db -t -c \
"SELECT COUNT(*) FROM stripe.accounts WHERE _id = 'acct_nonexistent';" 2>/dev/null | tr -d ' ')
"SELECT COUNT(*) FROM stripe.accounts WHERE id = 'acct_nonexistent';" 2>/dev/null | tr -d ' ')

# Attempt deletion (should handle gracefully)
npx tsx scripts/test-account-methods.ts delete-account "acct_nonexistent" > /dev/null 2>&1 || true

# Count after (should still be 0)
AFTER_COUNT=$(docker exec stripe-sync-test-db psql -U postgres -d app_db -t -c \
"SELECT COUNT(*) FROM stripe.accounts WHERE _id = 'acct_nonexistent';" 2>/dev/null | tr -d ' ')
"SELECT COUNT(*) FROM stripe.accounts WHERE id = 'acct_nonexistent';" 2>/dev/null | tr -d ' ')

DELETED_ACCOUNT_COUNT=$((BEFORE_COUNT - AFTER_COUNT))

Expand Down
12 changes: 6 additions & 6 deletions packages/cli/scripts/test-integration-backfill.sh
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ CUSTOMER_COUNT=$(docker exec stripe-sync-test-db psql -U postgres -d app_db -t -
echo " Customers table: $CUSTOMER_COUNT rows (expected: 3)"
if [ "$CUSTOMER_COUNT" -ge 3 ]; then
echo " ✓ Customer data successfully backfilled"
docker exec stripe-sync-test-db psql -U postgres -d app_db -c "SELECT _id, email, name FROM stripe.customers WHERE email LIKE 'test-backfill-%' LIMIT 3;" 2>/dev/null | head -n 7
docker exec stripe-sync-test-db psql -U postgres -d app_db -c "SELECT id, email, name FROM stripe.customers WHERE email LIKE 'test-backfill-%' LIMIT 3;" 2>/dev/null | head -n 7
else
echo " ❌ Expected at least 3 customers, found $CUSTOMER_COUNT"
exit 1
Expand All @@ -253,7 +253,7 @@ PRODUCT_COUNT=$(docker exec stripe-sync-test-db psql -U postgres -d app_db -t -c
echo " Products table: $PRODUCT_COUNT rows (expected: 3)"
if [ "$PRODUCT_COUNT" -ge 3 ]; then
echo " ✓ Product data successfully backfilled"
docker exec stripe-sync-test-db psql -U postgres -d app_db -c "SELECT _id, name, active FROM stripe.products WHERE name LIKE '%Backfill%' LIMIT 3;" 2>/dev/null | head -n 7
docker exec stripe-sync-test-db psql -U postgres -d app_db -c "SELECT id, name, active FROM stripe.products WHERE name LIKE '%Backfill%' LIMIT 3;" 2>/dev/null | head -n 7
else
echo " ❌ Expected at least 3 products, found $PRODUCT_COUNT"
exit 1
Expand All @@ -266,7 +266,7 @@ PRICE_COUNT=$(docker exec stripe-sync-test-db psql -U postgres -d app_db -t -c "
echo " Prices table: $PRICE_COUNT rows (expected: 3)"
if [ "$PRICE_COUNT" -ge 3 ]; then
echo " ✓ Price data successfully backfilled"
docker exec stripe-sync-test-db psql -U postgres -d app_db -c "SELECT _id, product, currency, unit_amount, nickname FROM stripe.prices WHERE nickname LIKE 'Test Price%' LIMIT 3;" 2>/dev/null | head -n 7
docker exec stripe-sync-test-db psql -U postgres -d app_db -c "SELECT id, product, currency, unit_amount, nickname FROM stripe.prices WHERE nickname LIKE 'Test Price%' LIMIT 3;" 2>/dev/null | head -n 7
else
echo " ❌ Expected at least 3 prices, found $PRICE_COUNT"
exit 1
Expand Down Expand Up @@ -367,10 +367,10 @@ fi
echo ""

# Verify new product was synced
PROD4_IN_DB=$(docker exec stripe-sync-test-db psql -U postgres -d app_db -t -c "SELECT COUNT(*) FROM stripe.products WHERE _id = '$PROD4_ID';" 2>/dev/null | tr -d ' ' || echo "0")
PROD4_IN_DB=$(docker exec stripe-sync-test-db psql -U postgres -d app_db -t -c "SELECT COUNT(*) FROM stripe.products WHERE id = '$PROD4_ID';" 2>/dev/null | tr -d ' ' || echo "0")
if [ "$PROD4_IN_DB" -eq 1 ]; then
echo " ✓ New product synced incrementally"
docker exec stripe-sync-test-db psql -U postgres -d app_db -c "SELECT _id, name FROM stripe.products WHERE _id = '$PROD4_ID';" 2>/dev/null | head -n 5
docker exec stripe-sync-test-db psql -U postgres -d app_db -c "SELECT id, name FROM stripe.products WHERE id = '$PROD4_ID';" 2>/dev/null | head -n 5
else
echo " ❌ New product not found in database"
exit 1
Expand All @@ -385,7 +385,7 @@ echo ""
echo ""

# Verify all test products exist in DB
TOTAL_TEST_PRODUCTS=$(docker exec stripe-sync-test-db psql -U postgres -d app_db -t -c "SELECT COUNT(*) FROM stripe.products WHERE _id IN ('$PROD1_ID', '$PROD2_ID', '$PROD3_ID', '$PROD4_ID');" 2>/dev/null | tr -d ' ' || echo "0")
TOTAL_TEST_PRODUCTS=$(docker exec stripe-sync-test-db psql -U postgres -d app_db -t -c "SELECT COUNT(*) FROM stripe.products WHERE id IN ('$PROD1_ID', '$PROD2_ID', '$PROD3_ID', '$PROD4_ID');" 2>/dev/null | tr -d ' ' || echo "0")
echo " Test products in DB: $TOTAL_TEST_PRODUCTS (expected: 4)"
if [ "$TOTAL_TEST_PRODUCTS" -eq 4 ]; then
echo " ✓ All test products synced successfully"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ else
fi

# Verify no data was lost
ACTUAL_TEST_PRODUCTS=$(docker exec stripe-sync-test-db psql -U postgres -d app_db -t -c "SELECT COUNT(*) FROM stripe.products WHERE _id = ANY(ARRAY[$(printf "'%s'," "${PRODUCT_IDS[@]}" | sed 's/,$//')]::text[]);" 2>/dev/null | tr -d ' ' || echo "0")
ACTUAL_TEST_PRODUCTS=$(docker exec stripe-sync-test-db psql -U postgres -d app_db -t -c "SELECT COUNT(*) FROM stripe.products WHERE id = ANY(ARRAY[$(printf "'%s'," "${PRODUCT_IDS[@]}" | sed 's/,$//')]::text[]);" 2>/dev/null | tr -d ' ' || echo "0")
if [ "$ACTUAL_TEST_PRODUCTS" -eq 200 ]; then
echo " ✓ No data lost - all 200 test products in database"
else
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/scripts/test-integration-webhooks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ if ps -p $CLI_PID > /dev/null 2>&1; then
echo " Customers table: $CUSTOMER_COUNT rows"
if [ "$CUSTOMER_COUNT" -gt 0 ]; then
echo " ✓ Customer data found"
docker exec stripe-sync-test-db psql -U postgres -d app_db -c "SELECT _id, email, name, created FROM stripe.customers LIMIT 1;" 2>/dev/null | head -n 5
docker exec stripe-sync-test-db psql -U postgres -d app_db -c "SELECT id, email, name, created FROM stripe.customers LIMIT 1;" 2>/dev/null | head -n 5
else
echo " ⚠ No customer data found (webhook may not have processed yet)"
fi
Expand All @@ -181,7 +181,7 @@ if ps -p $CLI_PID > /dev/null 2>&1; then
echo " Products table: $PRODUCT_COUNT rows"
if [ "$PRODUCT_COUNT" -gt 0 ]; then
echo " ✓ Product data found"
docker exec stripe-sync-test-db psql -U postgres -d app_db -c "SELECT _id, name, active, created FROM stripe.products LIMIT 1;" 2>/dev/null | head -n 5
docker exec stripe-sync-test-db psql -U postgres -d app_db -c "SELECT id, name, active, created FROM stripe.products LIMIT 1;" 2>/dev/null | head -n 5
else
echo " ⚠ No product data found (webhook may not have processed yet)"
fi
Expand All @@ -193,7 +193,7 @@ if ps -p $CLI_PID > /dev/null 2>&1; then
echo " Prices table: $PRICE_COUNT rows"
if [ "$PRICE_COUNT" -gt 0 ]; then
echo " ✓ Price data found"
docker exec stripe-sync-test-db psql -U postgres -d app_db -c "SELECT _id, product, currency, unit_amount, created FROM stripe.prices LIMIT 1;" 2>/dev/null | head -n 5
docker exec stripe-sync-test-db psql -U postgres -d app_db -c "SELECT id, product, currency, unit_amount, created FROM stripe.prices LIMIT 1;" 2>/dev/null | head -n 5
else
echo " ⚠ No price data found (webhook may not have processed yet)"
fi
Expand Down
6 changes: 3 additions & 3 deletions packages/cli/scripts/test-integration-wss.sh
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ if ps -p $CLI_PID > /dev/null 2>&1; then
echo " Customers table: $CUSTOMER_COUNT rows"
if [ "$CUSTOMER_COUNT" -gt 0 ]; then
echo " ✓ Customer data found"
docker exec stripe-sync-test-db psql -U postgres -d app_db -c "SELECT _id, email, name, created FROM stripe.customers LIMIT 1;" 2>/dev/null | head -n 5
docker exec stripe-sync-test-db psql -U postgres -d app_db -c "SELECT id, email, name, created FROM stripe.customers LIMIT 1;" 2>/dev/null | head -n 5
else
echo " ⚠ No customer data found (webhook may not have processed yet)"
fi
Expand All @@ -168,7 +168,7 @@ if ps -p $CLI_PID > /dev/null 2>&1; then
echo " Products table: $PRODUCT_COUNT rows"
if [ "$PRODUCT_COUNT" -gt 0 ]; then
echo " ✓ Product data found"
docker exec stripe-sync-test-db psql -U postgres -d app_db -c "SELECT _id, name, active, created FROM stripe.products LIMIT 1;" 2>/dev/null | head -n 5
docker exec stripe-sync-test-db psql -U postgres -d app_db -c "SELECT id, name, active, created FROM stripe.products LIMIT 1;" 2>/dev/null | head -n 5
else
echo " ⚠ No product data found (webhook may not have processed yet)"
fi
Expand All @@ -180,7 +180,7 @@ if ps -p $CLI_PID > /dev/null 2>&1; then
echo " Prices table: $PRICE_COUNT rows"
if [ "$PRICE_COUNT" -gt 0 ]; then
echo " ✓ Price data found"
docker exec stripe-sync-test-db psql -U postgres -d app_db -c "SELECT _id, product, currency, unit_amount, created FROM stripe.prices LIMIT 1;" 2>/dev/null | head -n 5
docker exec stripe-sync-test-db psql -U postgres -d app_db -c "SELECT id, product, currency, unit_amount, created FROM stripe.prices LIMIT 1;" 2>/dev/null | head -n 5
else
echo " ⚠ No price data found (webhook may not have processed yet)"
fi
Expand Down
6 changes: 3 additions & 3 deletions packages/fastify-app/src/test/checkoutSessions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,11 @@ describe('checkout sessions', () => {
await stripeSync.upsertCheckoutSessions(checkoutSessions, TEST_ACCOUNT_ID, false)

const lineItems = await stripeSync.postgresClient.query(
`select _id, object, amount_discount, amount_subtotal, amount_tax, amount_total, currency, description, price, quantity from stripe.checkout_session_line_items where checkout_session = 'cs_live_9RBjcHiy2i5p99Tf1MYM90c3SHK1grU0E6Ae6pKWR2KPA4ZiuKiB2X1Y3X'`
`select id, object, amount_discount, amount_subtotal, amount_tax, amount_total, currency, description, price, quantity from stripe.checkout_session_line_items where checkout_session = 'cs_live_9RBjcHiy2i5p99Tf1MYM90c3SHK1grU0E6Ae6pKWR2KPA4ZiuKiB2X1Y3X'`
)

expect(lineItems.rows).toContainEqual({
_id: 'li_123',
id: 'li_123',
object: 'item',
amount_discount: 0,
amount_subtotal: 2198,
Expand All @@ -192,7 +192,7 @@ describe('checkout sessions', () => {
})

expect(lineItems.rows).toContainEqual({
_id: 'li_456',
id: 'li_456',
object: 'item',
amount_discount: 0,
amount_subtotal: 2198,
Expand Down
6 changes: 3 additions & 3 deletions packages/fastify-app/src/test/entitlements.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ afterAll(async () => {
stripeSync.postgresClient.query(
`delete from stripe.active_entitlements where customer = '${customerId}'`
),
stripeSync.postgresClient.query(`delete from stripe.customers where _id = '${customerId}'`),
stripeSync.postgresClient.query(`delete from stripe.customers where id = '${customerId}'`),
])
})

Expand Down Expand Up @@ -70,7 +70,7 @@ describe('entitlements', () => {

expect(entitlements.rows).toEqual([
{
_id: activeEntitlements[0].id,
id: activeEntitlements[0].id,
object: activeEntitlements[0].object,
feature: activeEntitlements[0].feature,
livemode: activeEntitlements[0].livemode,
Expand Down Expand Up @@ -118,7 +118,7 @@ describe('entitlements', () => {

expect(updatedEntitlements.rows).toEqual(
newActiveEntitlements.map((entitlement) => ({
_id: entitlement.id,
id: entitlement.id,
object: entitlement.object,
feature: entitlement.feature,
livemode: entitlement.livemode,
Expand Down
6 changes: 3 additions & 3 deletions packages/fastify-app/src/test/incremental-sync.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ afterAll(async () => {
describe('Incremental Sync', () => {
beforeEach(async () => {
// Clean up test data before each test
await stripeSync.postgresClient.pool.query('DELETE FROM stripe.products WHERE _id LIKE $1', [
await stripeSync.postgresClient.pool.query('DELETE FROM stripe.products WHERE id LIKE $1', [
'test_prod_%',
])
await stripeSync.postgresClient.pool.query(
Expand Down Expand Up @@ -105,7 +105,7 @@ describe('Incremental Sync', () => {

// Verify products were inserted
const firstResult = await stripeSync.postgresClient.pool.query(
'SELECT COUNT(*) FROM stripe.products WHERE _id LIKE $1',
'SELECT COUNT(*) FROM stripe.products WHERE id LIKE $1',
['test_prod_%']
)
expect(parseInt(firstResult.rows[0].count)).toBe(3)
Expand Down Expand Up @@ -135,7 +135,7 @@ describe('Incremental Sync', () => {

// Verify new product was inserted
const secondResult = await stripeSync.postgresClient.pool.query(
'SELECT COUNT(*) FROM stripe.products WHERE _id LIKE $1',
'SELECT COUNT(*) FROM stripe.products WHERE id LIKE $1',
['test_prod_%']
)
expect(parseInt(secondResult.rows[0].count)).toBe(4)
Expand Down
4 changes: 2 additions & 2 deletions packages/fastify-app/src/test/invoices.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('invoices', () => {
await stripeSync.upsertInvoices(invoices, TEST_ACCOUNT_ID, false)

const lineItems = await stripeSync.postgresClient.query(
`select lines->'data' as lines from stripe.invoices where _id = 'in_xyz' limit 1`
`select lines->'data' as lines from stripe.invoices where id = 'in_xyz' limit 1`
)
expect(lineItems.rows[0].lines).toEqual([{ id: 'li_123' }])
})
Expand All @@ -83,7 +83,7 @@ describe('invoices', () => {
await stripeSync.upsertInvoices(invoices, TEST_ACCOUNT_ID, false)

const lineItems = await stripeSync.postgresClient.query(
`select lines->'data' as lines from stripe.invoices where _id = 'in_xyz2' limit 1`
`select lines->'data' as lines from stripe.invoices where id = 'in_xyz2' limit 1`
)
expect(lineItems.rows[0].lines).toEqual([{ id: 'li_123' }, { id: 'li_1234' }])
})
Expand Down
4 changes: 2 additions & 2 deletions packages/fastify-app/src/test/revalidate.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('invoices', () => {
await stripeSync.processEvent(eventBody as unknown as Stripe.Event)

const result = await stripeSync.postgresClient.query(
`select customer from stripe.invoices where _id = 'in_1KJdKkJDPojXS6LNSwSWkZSN' limit 1`
`select customer from stripe.invoices where id = 'in_1KJdKkJDPojXS6LNSwSWkZSN' limit 1`
)
expect(mockStripe.invoices.retrieve).toHaveBeenCalled()
expect(result.rows[0].customer).toEqual('cus_J7Mkgr8mvbl1eK') // from stripe mock
Expand All @@ -55,7 +55,7 @@ describe('invoices', () => {
await stripeSync.processEvent(eventBody as unknown as Stripe.Event)

const result = await stripeSync.postgresClient.query(
`select customer from stripe.invoices where _id = 'in_1KJqKBJDPojXS6LNJbvLUgEy' limit 1`
`select customer from stripe.invoices where id = 'in_1KJqKBJDPojXS6LNJbvLUgEy' limit 1`
)
expect(mockStripe.invoices.retrieve).not.toHaveBeenCalled()
expect(result.rows[0].customer).toEqual('cus_JsuO3bmrj0QlAw') // from webhook, no refetch
Expand Down
Loading