Skip to content

Commit 4a29639

Browse files
committed
fix tests
1 parent a86a731 commit 4a29639

2 files changed

Lines changed: 15 additions & 29 deletions

File tree

  • dev-packages
    • browser-integration-tests/suites/integrations/supabase/db-operations
    • e2e-tests/test-applications/supabase-nextjs/tests

dev-packages/browser-integration-tests/suites/integrations/supabase/db-operations/init.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Sentry.init({
99
dsn: 'https://public@dsn.ingest.sentry.io/1337',
1010
integrations: [Sentry.browserTracingIntegration(), Sentry.supabaseIntegration({ supabaseClient })],
1111
tracesSampleRate: 1.0,
12+
sendDefaultPii: true,
1213
});
1314

1415
// Simulate database operations

dev-packages/e2e-tests/test-applications/supabase-nextjs/tests/performance.test.ts

Lines changed: 14 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -57,37 +57,16 @@ test('Sends client-side Supabase db-operation spans and breadcrumbs to Sentry',
5757

5858
const transactionEvent = await pageloadTransactionPromise;
5959

60-
expect(transactionEvent.spans).toContainEqual(
61-
expect.objectContaining({
62-
description: 'select(*) filter(order, asc) from(todos)',
63-
op: 'db',
64-
data: expect.objectContaining({
65-
'db.operation': 'select',
66-
'db.query': ['select(*)', 'filter(order, asc)'],
67-
'db.system': 'postgresql',
68-
'sentry.op': 'db',
69-
'sentry.origin': 'auto.db.supabase',
70-
}),
71-
parent_span_id: expect.stringMatching(/[a-f0-9]{16}/),
72-
span_id: expect.stringMatching(/[a-f0-9]{16}/),
73-
start_timestamp: expect.any(Number),
74-
status: 'ok',
75-
timestamp: expect.any(Number),
76-
trace_id: expect.stringMatching(/[a-f0-9]{32}/),
77-
origin: 'auto.db.supabase',
78-
}),
79-
);
80-
81-
expect(transactionEvent.spans).toContainEqual({
60+
// Client uses default sendDefaultPii: false — URL filters and bodies are not attached to spans/breadcrumbs.
61+
const redactedSelectSpan = expect.objectContaining({
62+
description: '[redacted] from(todos)',
63+
op: 'db',
8264
data: expect.objectContaining({
8365
'db.operation': 'select',
84-
'db.query': ['select(*)', 'filter(order, asc)'],
8566
'db.system': 'postgresql',
8667
'sentry.op': 'db',
8768
'sentry.origin': 'auto.db.supabase',
8869
}),
89-
description: 'select(*) filter(order, asc) from(todos)',
90-
op: 'db',
9170
parent_span_id: expect.stringMatching(/[a-f0-9]{16}/),
9271
span_id: expect.stringMatching(/[a-f0-9]{16}/),
9372
start_timestamp: expect.any(Number),
@@ -97,20 +76,26 @@ test('Sends client-side Supabase db-operation spans and breadcrumbs to Sentry',
9776
origin: 'auto.db.supabase',
9877
});
9978

79+
expect(transactionEvent.spans).toContainEqual(redactedSelectSpan);
80+
81+
const selectSpan = transactionEvent.spans?.find(
82+
(s: { description?: string }) => s.description === '[redacted] from(todos)',
83+
);
84+
expect(selectSpan).toBeDefined();
85+
expect(selectSpan!.data).not.toHaveProperty('db.query');
86+
10087
expect(transactionEvent.breadcrumbs).toContainEqual({
10188
timestamp: expect.any(Number),
10289
type: 'supabase',
10390
category: 'db.select',
104-
message: 'select(*) filter(order, asc) from(todos)',
105-
data: expect.any(Object),
91+
message: '[redacted] from(todos)',
10692
});
10793

10894
expect(transactionEvent.breadcrumbs).toContainEqual({
10995
timestamp: expect.any(Number),
11096
type: 'supabase',
11197
category: 'db.insert',
112-
message: 'insert(...) select(*) from(todos)',
113-
data: expect.any(Object),
98+
message: 'insert(...) [redacted] from(todos)',
11499
});
115100
});
116101

0 commit comments

Comments
 (0)