Skip to content

Commit ac73648

Browse files
committed
✅ Fix failing tests
1 parent 909abea commit ac73648

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

Diff for: static/app/components/events/contexts/contextCard.spec.tsx

+7-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import startCase from 'lodash/startCase';
21
import {EventFixture} from 'sentry-fixture/event';
32
import {GroupFixture} from 'sentry-fixture/group';
43
import {ProjectFixture} from 'sentry-fixture/project';
54

65
import {render, screen} from 'sentry-test/reactTestingLibrary';
76

87
import ContextCard from 'sentry/components/events/contexts/contextCard';
8+
import * as utils from 'sentry/components/events/contexts/utils';
99

1010
describe('ContextCard', function () {
1111
const group = GroupFixture();
@@ -42,7 +42,7 @@ describe('ContextCard', function () {
4242
/>
4343
);
4444

45-
expect(screen.getByText(startCase(alias))).toBeInTheDocument();
45+
expect(screen.getByText(alias)).toBeInTheDocument();
4646
Object.entries(simpleContext).forEach(([key, value]) => {
4747
expect(screen.getByText(key)).toBeInTheDocument();
4848
expect(screen.getByText(value)).toBeInTheDocument();
@@ -57,10 +57,11 @@ describe('ContextCard', function () {
5757

5858
it('renders with icons if able', function () {
5959
const event = EventFixture();
60+
const iconSpy = jest.spyOn(utils, 'getContextIcon');
6061

6162
const browserContext = {
6263
type: 'browser',
63-
name: 'Firefox',
64+
name: 'firefox',
6465
version: 'Infinity',
6566
};
6667
const browserCard = render(
@@ -73,7 +74,8 @@ describe('ContextCard', function () {
7374
project={project}
7475
/>
7576
);
76-
expect(screen.getByRole('img')).toBeInTheDocument();
77+
expect(iconSpy.mock.results[0].value.props.name).toBe('firefox');
78+
iconSpy.mockReset();
7779
browserCard.unmount();
7880

7981
const unknownContext = {
@@ -91,7 +93,7 @@ describe('ContextCard', function () {
9193
project={project}
9294
/>
9395
);
94-
expect(screen.queryByRole('img')).not.toBeInTheDocument();
96+
expect(iconSpy.mock.results[0].value).toBeUndefined();
9597
});
9698

9799
it('renders the annotated text and errors', function () {

Diff for: static/app/components/events/contexts/operatingSystem/index.spec.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ describe('operating system event context', function () {
4747
},
4848
});
4949

50-
expect(screen.getByText('Raw Description')).toBeInTheDocument(); // subject
50+
expect(screen.getByText('raw_description')).toBeInTheDocument(); // subject
5151
await userEvent.hover(screen.getByText(/redacted/));
5252
expect(
5353
await screen.findByText(

Diff for: static/app/components/events/contexts/utils.spec.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ describe('contexts utils', function () {
2424
const unknownData = getUnknownData({allData, knownKeys});
2525

2626
expect(unknownData).toEqual([
27-
{key: 'username', value: 'a', subject: 'Username', meta: undefined},
28-
{key: 'count', value: 1000, subject: 'Count', meta: undefined},
27+
{key: 'username', value: 'a', subject: 'username', meta: undefined},
28+
{key: 'count', value: 1000, subject: 'count', meta: undefined},
2929
]);
3030
});
3131
});

0 commit comments

Comments
 (0)