@@ -2,13 +2,7 @@ import type { Integration, Options } from '@sentry/types';
22import { logger } from '@sentry/utils' ;
33import { getCurrentScope } from '../../src/currentScopes' ;
44
5- import {
6- addIntegration ,
7- convertIntegrationFnToClass ,
8- getIntegrationsToSetup ,
9- installedIntegrations ,
10- setupIntegration ,
11- } from '../../src/integration' ;
5+ import { addIntegration , getIntegrationsToSetup , installedIntegrations , setupIntegration } from '../../src/integration' ;
126import { setCurrentClient } from '../../src/sdk' ;
137import { TestClient , getDefaultTestClientOptions } from '../mocks/client' ;
148
@@ -699,74 +693,3 @@ describe('addIntegration', () => {
699693 expect ( logs ) . toHaveBeenCalledWith ( 'Integration skipped because it was already installed: test' ) ;
700694 } ) ;
701695} ) ;
702-
703- describe ( 'convertIntegrationFnToClass' , ( ) => {
704- /* eslint-disable deprecation/deprecation */
705- it ( 'works with a minimal integration' , ( ) => {
706- const integrationFn = ( ) => ( {
707- name : 'testName' ,
708- setupOnce : ( ) => { } ,
709- } ) ;
710-
711- const IntegrationClass = convertIntegrationFnToClass ( 'testName' , integrationFn ) ;
712-
713- expect ( IntegrationClass . id ) . toBe ( 'testName' ) ;
714-
715- const integration = new IntegrationClass ( ) ;
716- expect ( integration ) . toEqual ( {
717- name : 'testName' ,
718- setupOnce : expect . any ( Function ) ,
719- } ) ;
720- } ) ;
721-
722- it ( 'works with options' , ( ) => {
723- const integrationFn = ( _options : { num : number } ) => ( {
724- name : 'testName' ,
725- setupOnce : ( ) => { } ,
726- } ) ;
727-
728- const IntegrationClass = convertIntegrationFnToClass ( 'testName' , integrationFn ) ;
729-
730- expect ( IntegrationClass . id ) . toBe ( 'testName' ) ;
731-
732- // not type safe options by default :(
733- new IntegrationClass ( ) ;
734-
735- const integration = new IntegrationClass ( { num : 3 } ) ;
736- expect ( integration ) . toEqual ( {
737- name : 'testName' ,
738- setupOnce : expect . any ( Function ) ,
739- } ) ;
740- } ) ;
741-
742- it ( 'works with integration hooks' , ( ) => {
743- const setup = jest . fn ( ) ;
744- const setupOnce = jest . fn ( ) ;
745- const processEvent = jest . fn ( ) ;
746- const preprocessEvent = jest . fn ( ) ;
747-
748- const integrationFn = ( ) => {
749- return {
750- name : 'testName' ,
751- setup,
752- setupOnce,
753- processEvent,
754- preprocessEvent,
755- } ;
756- } ;
757-
758- const IntegrationClass = convertIntegrationFnToClass ( 'testName' , integrationFn ) ;
759-
760- expect ( IntegrationClass . id ) . toBe ( 'testName' ) ;
761-
762- const integration = new IntegrationClass ( ) ;
763- expect ( integration ) . toEqual ( {
764- name : 'testName' ,
765- setupOnce,
766- setup,
767- processEvent,
768- preprocessEvent,
769- } ) ;
770- } ) ;
771- /* eslint-enable deprecation/deprecation */
772- } ) ;
0 commit comments