Skip to content

Commit 0d9917a

Browse files
evanpurkhiserandrewshie-sentry
authored andcommitted
ref(js): Prefer testing in UTC (#91819)
These two tests where just testing that DateTime does what is supposed to, but we can leave that testing up to the DateTime tests themselves.
1 parent 41034e3 commit 0d9917a

File tree

2 files changed

+2
-47
lines changed

2 files changed

+2
-47
lines changed

static/app/utils/discover/fieldRenderers.spec.tsx

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import {ConfigFixture} from 'sentry-fixture/config';
21
import {ThemeFixture} from 'sentry-fixture/theme';
32
import {UserFixture} from 'sentry-fixture/user';
43

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

8-
import ConfigStore from 'sentry/stores/configStore';
97
import ProjectsStore from 'sentry/stores/projectsStore';
108
import EventView from 'sentry/utils/discover/eventView';
119
import {getFieldRenderer} from 'sentry/utils/discover/fieldRenderers';
@@ -148,26 +146,13 @@ describe('getFieldRenderer', function () {
148146
});
149147

150148
describe('date', function () {
151-
beforeEach(function () {
152-
ConfigStore.loadInitialData(
153-
ConfigFixture({
154-
user: UserFixture({
155-
options: {
156-
...UserFixture().options,
157-
timezone: 'America/Los_Angeles',
158-
},
159-
}),
160-
})
161-
);
162-
});
163-
164149
it('can render date fields', async function () {
165150
const renderer = getFieldRenderer('createdAt', {createdAt: 'date'});
166151
render(
167152
renderer(data, {location, organization, theme}) as React.ReactElement<any, any>
168153
);
169154

170-
await screen.findByText('Oct 3, 2019 9:13:14 AM PDT');
155+
await screen.findByText('Oct 3, 2019 4:13:14 PM UTC');
171156
});
172157

173158
it('can render date fields using utc when query string has utc set to true', async function () {
@@ -194,18 +179,6 @@ describe('getFieldRenderer', function () {
194179
});
195180

196181
it('can render timestamp.to_day', function () {
197-
// Set timezone
198-
ConfigStore.loadInitialData(
199-
ConfigFixture({
200-
user: UserFixture({
201-
options: {
202-
...UserFixture().options,
203-
timezone: 'America/Los_Angeles',
204-
},
205-
}),
206-
})
207-
);
208-
209182
const renderer = getFieldRenderer('timestamp.to_day', {'timestamp.to_day': 'date'});
210183
render(
211184
renderer(data, {location, organization, theme}) as React.ReactElement<any, any>

static/app/views/settings/organizationAuditLog/index.spec.tsx

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,28 +5,10 @@ import {initializeOrg} from 'sentry-test/initializeOrg';
55
import {render, screen} from 'sentry-test/reactTestingLibrary';
66
import {textWithMarkupMatcher} from 'sentry-test/utils';
77

8-
import ConfigStore from 'sentry/stores/configStore';
98
import ProjectsStore from 'sentry/stores/projectsStore';
10-
import type {Config} from 'sentry/types/system';
11-
import type {User} from 'sentry/types/user';
129
import OrganizationAuditLog from 'sentry/views/settings/organizationAuditLog';
1310

1411
describe('OrganizationAuditLog', function () {
15-
const user: User = {
16-
...UserFixture(),
17-
options: {
18-
...UserFixture().options,
19-
clock24Hours: true,
20-
timezone: 'America/Los_Angeles',
21-
},
22-
};
23-
24-
const config: Config = {...ConfigStore.getState(), user};
25-
26-
beforeEach(() => {
27-
ConfigStore.loadInitialData(config);
28-
});
29-
3012
it('renders', async function () {
3113
MockApiClient.addMockResponse({
3214
url: `/organizations/org-slug/audit-logs/`,
@@ -72,7 +54,7 @@ describe('OrganizationAuditLog', function () {
7254
expect(await screen.findByText('project.remove')).toBeInTheDocument();
7355
expect(screen.getByText('org.create')).toBeInTheDocument();
7456
expect(screen.getAllByText('127.0.0.1')).toHaveLength(2);
75-
expect(screen.getByText('17:29 PDT')).toBeInTheDocument();
57+
expect(screen.getByText('12:29 AM UTC')).toBeInTheDocument();
7658
});
7759

7860
it('Displays pretty dynamic sampling logs', async function () {

0 commit comments

Comments
 (0)