Skip to content

Commit

Permalink
Merge pull request #538 from HubSpot/feature/updateEventsdiscoveries
Browse files Browse the repository at this point in the history
Update Events Send discovery
  • Loading branch information
ksvirkou-hubspot authored Sep 12, 2024
2 parents 721eea6 + 27f58cf commit 26b9776
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/discovery/events/send/SendDiscovery.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
BehavioralEventsTrackingApi,
createConfiguration,
CustomEventDataApi,
RequestContext,
ResponseContext,
ServerConfiguration,
Expand All @@ -11,7 +11,7 @@ import IConfiguration from '../../../configuration/IConfiguration'
import ApiDecoratorService from '../../../services/ApiDecoratorService'

export default class EventsDiscovery {
public behavioralEventsTrackingApi: BehavioralEventsTrackingApi
public customEventDataApi: CustomEventDataApi

constructor(config: IConfiguration) {
const configuration = createConfiguration(
Expand All @@ -24,8 +24,8 @@ export default class EventsDiscovery {
>(config, ServerConfiguration, Observable, Observable),
)

this.behavioralEventsTrackingApi = ApiDecoratorService.getInstance().apply<BehavioralEventsTrackingApi>(
new BehavioralEventsTrackingApi(configuration),
this.customEventDataApi = ApiDecoratorService.getInstance().apply<CustomEventDataApi>(
new CustomEventDataApi(configuration),
)
}
}
2 changes: 2 additions & 0 deletions test/spec/events/events.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import { EventsApi } from '../../../codegen/events/index'
import { Client } from '../../../index'
import SendDiscovery from '../../../src/discovery/events/send/SendDiscovery'

describe('api client', () => {
it('is discoverable', () => {
const client = new Client().events
expect(client.hasOwnProperty('eventsApi')).toBeTruthy()
expect(EventsApi.name).toBe(client.eventsApi.constructor.name)
expect(SendDiscovery.name).toBe(client.send.constructor.name)
})
})
6 changes: 3 additions & 3 deletions test/spec/events/send/send.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { BehavioralEventsTrackingApi } from '../../../../codegen/events/send/index'
import { CustomEventDataApi } from '../../../../codegen/events/send/index'
import { Client } from '../../../../index'

describe('api client', () => {
it('is discoverable', () => {
const client = new Client().events.send
expect(client.hasOwnProperty('behavioralEventsTrackingApi')).toBeTruthy()
expect(BehavioralEventsTrackingApi.name).toBe(client.behavioralEventsTrackingApi.constructor.name)
expect(client.hasOwnProperty('customEventDataApi')).toBeTruthy()
expect(CustomEventDataApi.name).toBe(client.customEventDataApi.constructor.name)
})
})

0 comments on commit 26b9776

Please sign in to comment.