Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tobiaslins committed Jan 25, 2024
1 parent 9876cc9 commit 23d3223
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
4 changes: 2 additions & 2 deletions apps/nextjs/e2e/production/beforeSend.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ test.describe('beforeSend', () => {
payload: {
o: 'http://localhost:3000/before-send/first',
sv: expect.any(String),
sdkn: '@vercel/analytics',
sdkn: '@vercel/analytics/next',
sdkv: expect.any(String),
ts: expect.any(Number),
r: '',
Expand All @@ -42,7 +42,7 @@ test.describe('beforeSend', () => {
o: 'http://localhost:3000/before-send/second?secret=REDACTED',
ts: expect.any(Number),
sv: expect.any(String),
sdkn: '@vercel/analytics',
sdkn: '@vercel/analytics/next',
sdkv: expect.any(String),
},
},
Expand Down
4 changes: 2 additions & 2 deletions apps/nextjs/e2e/production/pageview.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ test.describe('pageview', () => {
ts: expect.any(Number),
r: '',
sv: expect.any(String),
sdkn: '@vercel/analytics',
sdkn: '@vercel/analytics/next',
sdkv: expect.any(String),
},
},
Expand All @@ -42,7 +42,7 @@ test.describe('pageview', () => {
o: 'http://localhost:3000/navigation/second',
ts: expect.any(Number),
sv: expect.any(String),
sdkn: '@vercel/analytics',
sdkn: '@vercel/analytics/next',
sdkv: expect.any(String),
},
},
Expand Down
13 changes: 12 additions & 1 deletion apps/nextjs/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,18 @@ import type { AppProps } from 'next/app';
export default function App({ Component, pageProps }: AppProps) {
return (
<>
<Analytics />
<Analytics
beforeSend={(event) => {
const url = new URL(event.url);
if (url.searchParams.has('secret')) {
url.searchParams.set('secret', 'REDACTED');
}
return {
...event,
url: url.toString(),
};
}}
/>
<Component {...pageProps} />
</>
);
Expand Down

0 comments on commit 23d3223

Please sign in to comment.