Просмотр исходного кода

chore(ts): Convert a few more test stubs (#53343)

- Remove unused stub
- TestStubs.EventsStats
- TestStubs.DetailedEvents
- TestStubs.Event
- TestStubs.EventIdQueryResult
- TestStubs.EventEntryStacktrace
- TestStubs.EventEntryDebugMeta
- TestStubs.EventAttachment
- TestStubs.DiscoverSavedQuery
- TestStubs.DocIntegration
- TestStubs.EventEntry
- TestStubs.DebugFile
- TestStubs.Commit
- TestStubs.CodeOwner
George Gritsouk 1 год назад
Родитель
Сommit
ea9060112b

+ 3 - 1
fixtures/js-stubs/codeOwner.js → fixtures/js-stubs/codeOwner.ts

@@ -1,3 +1,5 @@
+import {type CodeOwner as TCodeOwner} from 'sentry/types';
+
 import {GitHubIntegration} from './githubIntegration';
 import {Project} from './project';
 import {Repository} from './repository';
@@ -8,7 +10,7 @@ export function CodeOwner({
   repo = Repository(),
   integration = GitHubIntegration(),
   ...params
-} = {}) {
+} = {}): TCodeOwner {
   return {
     id: '1225',
     raw: '',

+ 5 - 5
fixtures/js-stubs/commit.js → fixtures/js-stubs/commit.ts

@@ -1,14 +1,14 @@
-import {CommitAuthor} from './commitAuthor';
-import {Repository} from './repository';
+import {type Commit as TCommit} from 'sentry/types';
 
-export function Commit(params = {}) {
+export function Commit(params = {}): TCommit {
   return {
     dateCreated: '2018-11-30T18:46:31Z',
     message:
       '(improve) Add Links to Spike-Protection Email (#2408)\n\n* (improve) Add Links to Spike-Protection Email\r\n\r\nUsers now have access to useful links from the blogs and docs on Spike-protection.\r\n\r\n* fixed wording',
     id: 'f7f395d14b2fe29a4e253bf1d3094d61e6ad4434',
-    author: CommitAuthor(),
-    repository: Repository(),
+    author: TestStubs.CommitAuthor(),
+    repository: TestStubs.Repository(),
+    releases: [],
     ...params,
   };
 }

+ 9 - 3
fixtures/js-stubs/debugFile.js → fixtures/js-stubs/debugFile.ts

@@ -1,12 +1,18 @@
-export function DebugFile(params = {}) {
+import {
+  type DebugFile as TDebugFile,
+  DebugFileFeature,
+  DebugFileType,
+} from 'sentry/types';
+
+export function DebugFile(params = {}): TDebugFile {
   return {
     objectName: 'libS.so',
     symbolType: 'elf',
     dateCreated: '2010-04-23T02:08:51.179486Z',
     debugId: '2oihoi4h5ioh34534oi5h',
     data: {
-      type: 'lib',
-      features: ['unwind'],
+      type: DebugFileType.LIB,
+      features: [DebugFileFeature.UNWIND],
     },
     id: '12345',
     size: 12345,

+ 4 - 1
fixtures/js-stubs/discover.js → fixtures/js-stubs/discover.ts

@@ -1,10 +1,13 @@
-export function DiscoverSavedQuery(params = {}) {
+import type {SavedQuery} from 'sentry/types';
+
+export function DiscoverSavedQuery(params = {}): SavedQuery {
   return {
     id: '1',
     name: 'Saved query #1',
     dateCreated: '2018-09-24T00:00:00.000Z',
     dateUpdated: '2018-09-24T00:00:00.000Z',
     fields: ['test'],
+    version: 2,
     ...params,
   };
 }

+ 5 - 3
fixtures/js-stubs/docIntegration.js → fixtures/js-stubs/docIntegration.ts

@@ -1,12 +1,14 @@
-export function DocIntegration(params = {}) {
+import {type DocIntegration as TDocIntegration} from 'sentry/types';
+
+export function DocIntegration(params = {}): TDocIntegration {
   return {
     name: 'Sample Doc',
     slug: 'sample-doc',
     author: 'The Sentry Team',
     url: 'https://example.com/sentry',
-    popularity: '10',
+    popularity: 10,
     description: 'A helpful tutorial on how to setup this integration with Sentry',
-    isDraft: 'false',
+    isDraft: false,
     features: [
       {
         featureId: 5,

+ 0 - 13
fixtures/js-stubs/event.js

@@ -1,13 +0,0 @@
-export function Event(params = {}) {
-  return {
-    id: '1',
-    message: 'ApiException',
-    title: 'ApiException',
-    groupID: '1',
-    eventID: '12345678901234567890123456789012',
-    dateCreated: '2019-05-21T18:01:48.762Z',
-    tags: [],
-    errors: [],
-    ...params,
-  };
-}

+ 29 - 0
fixtures/js-stubs/event.ts

@@ -0,0 +1,29 @@
+import {type Event as TEvent, EventOrGroupType} from 'sentry/types';
+
+export function Event(params = {}): TEvent {
+  return {
+    id: '1',
+    message: 'ApiException',
+    title: 'ApiException',
+    metadata: {},
+    entries: [],
+    projectID: '1',
+    groupID: '1',
+    eventID: '12345678901234567890123456789012',
+    dateCreated: '2019-05-21T18:01:48.762Z',
+    dateReceived: '2019-05-21T18:01:48.762Z',
+    tags: [],
+    errors: [],
+    crashFile: null,
+    size: 0,
+    dist: null,
+    fingerprints: [],
+    culprit: '',
+    user: null,
+    location: '',
+    type: EventOrGroupType.ERROR,
+    occurrence: null,
+    contexts: {},
+    ...params,
+  };
+}

+ 3 - 1
fixtures/js-stubs/eventAttachment.js → fixtures/js-stubs/eventAttachment.ts

@@ -1,4 +1,6 @@
-export function EventAttachment(params = {}) {
+import type {EventAttachment as TEventAttachment} from 'sentry/types';
+
+export function EventAttachment(params = {}): TEventAttachment {
   return {
     id: '1',
     name: 'screenshot.png',

+ 0 - 10
fixtures/js-stubs/eventEntry.js

@@ -1,10 +0,0 @@
-export function EventEntry(params = {}) {
-  return {
-    id: '1',
-    type: 'message',
-    data: {
-      formatted: 'Blocked script',
-    },
-    ...params,
-  };
-}

+ 11 - 0
fixtures/js-stubs/eventEntry.ts

@@ -0,0 +1,11 @@
+import {type Entry as TEntry, EntryType} from 'sentry/types';
+
+export function EventEntry(params = {}): TEntry {
+  return {
+    type: EntryType.MESSAGE,
+    data: {
+      formatted: 'Blocked script',
+    },
+    ...params,
+  };
+}

Некоторые файлы не были показаны из-за большого количества измененных файлов