Skip to content

Commit

Permalink
fix: cleanup getEnvironmentConfig from nodejs, move tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathannorris committed Sep 26, 2023
1 parent d7cd6d5 commit 51b013c
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 23 deletions.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@ import fetch, { Response } from 'cross-fetch'

global.fetch = fetch

import { getEnvironmentConfig } from '../src/request'
const fetchRequestMock = fetch as jest.MockedFn<typeof fetch>

import { publishEvents, getEnvironmentConfig } from '../src/request'
import { dvcDefaultLogger } from '@devcycle/js-cloud-server-sdk'
const logger = dvcDefaultLogger()

describe('request.ts Unit Tests', () => {
beforeEach(() => {
fetchRequestMock.mockReset()
Expand Down
19 changes: 0 additions & 19 deletions sdk/nodejs/src/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,6 @@ export const HOST = '.devcycle.com'
export const EVENT_URL = 'https://events'
export const EVENTS_PATH = '/v1/events/batch'

export async function getEnvironmentConfig(
url: string,
requestTimeout: number,
etag?: string,
): Promise<Response> {
const headers: Record<string, string> = etag
? { 'If-None-Match': etag }
: {}

return await getWithTimeout(
url,
{
headers: headers,
retries: 1,
},
requestTimeout,
)
}

export async function publishEvents(
logger: DVCLogger,
sdkKey: string,
Expand Down

0 comments on commit 51b013c

Please sign in to comment.