Skip to content

Commit 6a3eede

Browse files
authored
chore(onboarding): test the public api of the onboarding snippets in python (#91119)
1 parent 9dd61f1 commit 6a3eede

File tree

2 files changed

+59
-19
lines changed

2 files changed

+59
-19
lines changed

static/app/utils/gettingStartedDocs/python.spec.tsx

Lines changed: 58 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,74 @@ jest.mock('sentry/utils/gettingStartedDocs/python', () => {
88
};
99
});
1010

11-
import {getPythonInstallSnippet} from 'sentry/utils/gettingStartedDocs/python';
11+
import {getPythonInstallConfig} from 'sentry/utils/gettingStartedDocs/python';
1212

13-
describe('getPythonInstallSnippet', () => {
13+
describe('getPythonInstallConfig', () => {
1414
it('generates install commands with default parameters', () => {
15-
const result = getPythonInstallSnippet({
15+
const result = getPythonInstallConfig({
1616
packageName: 'sentry-sdk',
17+
description: 'Install the Sentry SDK',
1718
});
1819

19-
expect(result.pip).toBe(`pip install "sentry-sdk"`);
20-
expect(result.uv).toBe(`uv add "sentry-sdk"`);
21-
expect(result.poetry).toBe(`poetry add "sentry-sdk"`);
20+
expect(result).toEqual([
21+
{
22+
description: 'Install the Sentry SDK',
23+
language: 'bash',
24+
code: [
25+
{
26+
label: 'pip',
27+
value: 'pip',
28+
language: 'bash',
29+
code: `pip install "sentry-sdk"`,
30+
},
31+
{
32+
label: 'uv',
33+
value: 'uv',
34+
language: 'bash',
35+
code: `uv add "sentry-sdk"`,
36+
},
37+
{
38+
label: 'poetry',
39+
value: 'poetry',
40+
language: 'bash',
41+
code: `poetry add "sentry-sdk"`,
42+
},
43+
],
44+
},
45+
]);
2246
});
2347

2448
it('generates pip install command with minimum version and extras', () => {
25-
const result = getPythonInstallSnippet({
49+
const result = getPythonInstallConfig({
2650
packageName: 'sentry-sdk[with-extras]',
51+
description: 'Install the Sentry SDK',
2752
minimumVersion: '2.3.4',
2853
});
29-
expect(result.pip).toBe(`pip install --upgrade "sentry-sdk[with-extras]>=2.3.4"`);
30-
expect(result.uv).toBe(`uv add --upgrade "sentry-sdk[with-extras]>=2.3.4"`);
31-
expect(result.poetry).toBe(`poetry add "sentry-sdk[with-extras]>=2.3.4"`);
54+
expect(result).toEqual([
55+
{
56+
description: 'Install the Sentry SDK',
57+
language: 'bash',
58+
code: [
59+
{
60+
label: 'pip',
61+
value: 'pip',
62+
language: 'bash',
63+
code: `pip install --upgrade "sentry-sdk[with-extras]>=2.3.4"`,
64+
},
65+
{
66+
label: 'uv',
67+
value: 'uv',
68+
language: 'bash',
69+
code: `uv add --upgrade "sentry-sdk[with-extras]>=2.3.4"`,
70+
},
71+
{
72+
label: 'poetry',
73+
value: 'poetry',
74+
language: 'bash',
75+
code: `poetry add "sentry-sdk[with-extras]>=2.3.4"`,
76+
},
77+
],
78+
},
79+
]);
3280
});
3381
});

static/app/utils/gettingStartedDocs/python.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import type {
1010
import {AlternativeConfiguration} from 'sentry/gettingStartedDocs/python/python';
1111
import {t, tct} from 'sentry/locale';
1212

13-
export function getPythonInstallSnippet({
13+
function getPythonInstallSnippet({
1414
packageName,
1515
minimumVersion,
1616
}: {
@@ -72,14 +72,6 @@ export function getPythonInstallConfig({
7272
];
7373
}
7474

75-
export function getPythonProfilingMinVersionMessage() {
76-
return tct(
77-
'You need a minimum version [code:2.24.1] of the [code:sentry-python] SDK for the profiling feature.',
78-
{
79-
code: <code />,
80-
}
81-
);
82-
}
8375
export function getPythonAiocontextvarsConfig({
8476
description,
8577
}: {

0 commit comments

Comments
 (0)