Skip to content

Commit

Permalink
fix: update edge SDK tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathannorris committed Oct 24, 2023
1 parent f9c2779 commit 5478c6d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DVCRequestEvent, EventTypes } from '@devcycle/server-request'
import { DVCRequestEvent, EventTypes } from '../../src'

describe('DVCRequestEvent Unit Tests', () => {
it('should construct custom DVCRequestEvent from DVCEvent', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import {
checkParamDefined,
checkParamType,
typeEnum,
} from '../../../../lib/shared/server-request/src/utils/paramUtils'
import { checkParamDefined, checkParamType, typeEnum } from '../../src'

describe('paramUtils Unit Tests', () => {
describe('checkParamDefined', () => {
Expand Down
6 changes: 6 additions & 0 deletions sdk/edge-worker-server/__tests__/client.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ const mockGenerateBucketedConfig = jest.fn().mockReturnValue({
type: 'release',
},
},
variableVariationMap: {
'test-key': {
_feature: 'test-id',
_variation: 'variation-id',
},
},
})
jest.mock('@devcycle/bucketing', () => {
return {
Expand Down
6 changes: 4 additions & 2 deletions sdk/edge-worker-server/src/eventsPublisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@ export function generateAggEvent(
user_id: string,
type: string,
variableKey: string,
variableVariationMap: BucketedUserConfig['variableVariationMap'],
variableVariationMap?: BucketedUserConfig['variableVariationMap'],
): DVCRequestEvent {
return new DVCRequestEvent(
{
type,
target: variableKey,
value: 1,
metaData: variableVariationMap[variableKey],
metaData: variableVariationMap
? variableVariationMap[variableKey]
: undefined,
},
user_id,
)
Expand Down

0 comments on commit 5478c6d

Please sign in to comment.