From a52014bc5c17df5e24f018680af449bf9e5ecb71 Mon Sep 17 00:00:00 2001 From: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com> Date: Wed, 4 Sep 2024 12:41:39 -0700 Subject: [PATCH] chore: Standardize test organization. --- CONTRIBUTING.md | 12 +++++++++--- .../akamai-base/{src => }/__tests__/index.test.ts | 2 +- .../akamai-base/{src => }/__tests__/testData.json | 0 .../__tests__/edgekv/edgeKVProvider.test.ts | 6 +++--- .../{src => }/__tests__/index.test.ts | 6 +++--- .../{src => }/__tests__/testData.json | 0 .../cloudflare/{src => __tests__}/index.test.ts | 2 +- .../cloudflare/{src => __tests__}/testData.json | 0 .../ReactNativeLDClient.storage.test.ts | 2 +- .../{src => __tests__}/ReactNativeLDClient.test.ts | 14 +++++++------- .../react-native-sse/EventSource.test.ts | 2 +- .../{src => __tests__}/options.test.ts | 4 ++-- .../platform/ConnectionManager.test.ts | 2 +- .../platform/crypto/PlatformHasher.test.ts | 2 +- .../provider/LDProvider.test.tsx | 12 ++++++------ .../provider/setupListeners.test.ts | 6 +++--- .../{src => __tests__}/index.test.ts | 0 .../{src => __tests__}/createPlatformInfo.test.ts | 2 +- .../sdk/vercel/{src => __tests__}/index.test.ts | 2 +- .../utils/mockEdgeConfigClient.ts | 0 .../vercel/{src => __tests__}/utils/testData.json | 0 .../{src => }/__tests__/featureStore/index.test.ts | 2 +- .../{src => }/__tests__/index.test.ts | 2 +- .../__tests__/platform/info/index.test.ts | 4 ++-- .../{src => }/__tests__/platform/requests.test.ts | 2 +- .../{src => }/__tests__/testData.json | 0 .../__tests__/utils/createCallbacks.test.ts | 2 +- .../__tests__/utils/createOptions.test.ts | 2 +- .../__tests__/utils/validateOptions.test.ts | 4 ++-- .../{src => __tests__}/LDClientImpl.events.test.ts | 4 ++-- .../LDClientImpl.storage.test.ts | 10 +++++----- .../{src => __tests__}/LDClientImpl.test.ts | 4 ++-- .../LDClientImpl.timeout.test.ts | 6 +++--- .../LDClientImpl.variation.test.ts | 4 ++-- .../{src => __tests__}/LDEmitter.test.ts | 2 +- .../configuration/Configuration.test.ts | 2 +- .../{src => __tests__}/context/addAutoEnv.test.ts | 4 ++-- .../{src => __tests__}/context/ensureKey.test.ts | 2 +- .../createDiagnosticsInitConfig.test.ts | 4 ++-- .../evaluation/mockResponse.json | 0 .../flag-manager/ContextIndex.test.ts | 2 +- .../flag-manager/FlagPersistence.test.ts | 10 +++++----- .../flag-manager/FlagUpdater.test.ts | 6 +++--- .../polling/PollingProcessot.test.ts | 2 +- .../storage/getOrGenerateKey.test.ts | 2 +- .../storage/namespaceUtils.test.ts | 2 +- .../api/EdgeFeatureStore.test.ts | 6 +++--- .../{src => __tests__}/api/LDClient.test.ts | 2 +- .../{src => __tests__}/api/createCallbacks.test.ts | 2 +- .../{src => __tests__}/api/createOptions.test.ts | 2 +- .../{src/utils => __tests__/api}/testData.json | 0 .../utils/validateOptions.test.ts | 4 ++-- .../{src => __tests__}/TracingHook.test.ts | 2 +- 53 files changed, 92 insertions(+), 86 deletions(-) rename packages/sdk/akamai-base/{src => }/__tests__/index.test.ts (98%) rename packages/sdk/akamai-base/{src => }/__tests__/testData.json (100%) rename packages/sdk/akamai-edgekv/{src => }/__tests__/edgekv/edgeKVProvider.test.ts (85%) rename packages/sdk/akamai-edgekv/{src => }/__tests__/index.test.ts (96%) rename packages/sdk/akamai-edgekv/{src => }/__tests__/testData.json (100%) rename packages/sdk/cloudflare/{src => __tests__}/index.test.ts (98%) rename packages/sdk/cloudflare/{src => __tests__}/testData.json (100%) rename packages/sdk/react-native/{src => __tests__}/ReactNativeLDClient.storage.test.ts (93%) rename packages/sdk/react-native/{src => __tests__}/ReactNativeLDClient.test.ts (95%) rename packages/sdk/react-native/{src => __tests__}/fromExternal/react-native-sse/EventSource.test.ts (96%) rename packages/sdk/react-native/{src => __tests__}/options.test.ts (96%) rename packages/sdk/react-native/{src => __tests__}/platform/ConnectionManager.test.ts (99%) rename packages/sdk/react-native/{src => __tests__}/platform/crypto/PlatformHasher.test.ts (96%) rename packages/sdk/react-native/{src => __tests__}/provider/LDProvider.test.tsx (84%) rename packages/sdk/react-native/{src => __tests__}/provider/setupListeners.test.ts (82%) rename packages/sdk/react-universal/{src => __tests__}/index.test.ts (100%) rename packages/sdk/vercel/{src => __tests__}/createPlatformInfo.test.ts (88%) rename packages/sdk/vercel/{src => __tests__}/index.test.ts (98%) rename packages/sdk/vercel/{src => __tests__}/utils/mockEdgeConfigClient.ts (100%) rename packages/sdk/vercel/{src => __tests__}/utils/testData.json (100%) rename packages/shared/akamai-edgeworker-sdk/{src => }/__tests__/featureStore/index.test.ts (98%) rename packages/shared/akamai-edgeworker-sdk/{src => }/__tests__/index.test.ts (99%) rename packages/shared/akamai-edgeworker-sdk/{src => }/__tests__/platform/info/index.test.ts (84%) rename packages/shared/akamai-edgeworker-sdk/{src => }/__tests__/platform/requests.test.ts (95%) rename packages/shared/akamai-edgeworker-sdk/{src => }/__tests__/testData.json (100%) rename packages/shared/akamai-edgeworker-sdk/{src => }/__tests__/utils/createCallbacks.test.ts (89%) rename packages/shared/akamai-edgeworker-sdk/{src => }/__tests__/utils/createOptions.test.ts (87%) rename packages/shared/akamai-edgeworker-sdk/{src => }/__tests__/utils/validateOptions.test.ts (94%) rename packages/shared/sdk-client/{src => __tests__}/LDClientImpl.events.test.ts (98%) rename packages/shared/sdk-client/{src => __tests__}/LDClientImpl.storage.test.ts (98%) rename packages/shared/sdk-client/{src => __tests__}/LDClientImpl.test.ts (98%) rename packages/shared/sdk-client/{src => __tests__}/LDClientImpl.timeout.test.ts (97%) rename packages/shared/sdk-client/{src => __tests__}/LDClientImpl.variation.test.ts (97%) rename packages/shared/sdk-client/{src => __tests__}/LDEmitter.test.ts (99%) rename packages/shared/sdk-client/{src => __tests__}/configuration/Configuration.test.ts (98%) rename packages/shared/sdk-client/{src => __tests__}/context/addAutoEnv.test.ts (99%) rename packages/shared/sdk-client/{src => __tests__}/context/ensureKey.test.ts (98%) rename packages/shared/sdk-client/{src => __tests__}/diagnostics/createDiagnosticsInitConfig.test.ts (93%) rename packages/shared/sdk-client/{src => __tests__}/evaluation/mockResponse.json (100%) rename packages/shared/sdk-client/{src => __tests__}/flag-manager/ContextIndex.test.ts (98%) rename packages/shared/sdk-client/{src => __tests__}/flag-manager/FlagPersistence.test.ts (97%) rename packages/shared/sdk-client/{src => __tests__}/flag-manager/FlagUpdater.test.ts (97%) rename packages/shared/sdk-client/{src => __tests__}/polling/PollingProcessot.test.ts (99%) rename packages/shared/sdk-client/{src => __tests__}/storage/getOrGenerateKey.test.ts (97%) rename packages/shared/sdk-client/{src => __tests__}/storage/namespaceUtils.test.ts (93%) rename packages/shared/sdk-server-edge/{src => __tests__}/api/EdgeFeatureStore.test.ts (95%) rename packages/shared/sdk-server-edge/{src => __tests__}/api/LDClient.test.ts (96%) rename packages/shared/sdk-server-edge/{src => __tests__}/api/createCallbacks.test.ts (97%) rename packages/shared/sdk-server-edge/{src => __tests__}/api/createOptions.test.ts (83%) rename packages/shared/sdk-server-edge/{src/utils => __tests__/api}/testData.json (100%) rename packages/shared/sdk-server-edge/{src => __tests__}/utils/validateOptions.test.ts (91%) rename packages/telemetry/node-server-sdk-otel/{src => __tests__}/TracingHook.test.ts (99%) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3cde4e2eb8..dbcde575e3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -27,14 +27,20 @@ To install project dependencies, from the project root directory: yarn ``` -### Testing +### Build -To run all unit tests: +To build all projects, from the root directory: ``` -yarn test +yarn build ``` +### Testing + +Unit tests should be implemented in a `__tests__` folder in the root of the package. The directory structure inside of `__tests__` should mirror that of the source directory. + +Each package has its own testing requirements and tests should be only ran for single projects. + To run the SDK contract test suite (see [`contract-tests/README.md`](./contract-tests/README.md)): The SDK contract test suite will run the Node.js Server version of the SDK. diff --git a/packages/sdk/akamai-base/src/__tests__/index.test.ts b/packages/sdk/akamai-base/__tests__/index.test.ts similarity index 98% rename from packages/sdk/akamai-base/src/__tests__/index.test.ts rename to packages/sdk/akamai-base/__tests__/index.test.ts index f70caae05f..e62833ea26 100644 --- a/packages/sdk/akamai-base/src/__tests__/index.test.ts +++ b/packages/sdk/akamai-base/__tests__/index.test.ts @@ -1,4 +1,4 @@ -import { EdgeProvider, init } from '../index'; +import { EdgeProvider, init } from '../src/index'; import * as testData from './testData.json'; const sdkKey = 'test-sdk-key'; diff --git a/packages/sdk/akamai-base/src/__tests__/testData.json b/packages/sdk/akamai-base/__tests__/testData.json similarity index 100% rename from packages/sdk/akamai-base/src/__tests__/testData.json rename to packages/sdk/akamai-base/__tests__/testData.json diff --git a/packages/sdk/akamai-edgekv/src/__tests__/edgekv/edgeKVProvider.test.ts b/packages/sdk/akamai-edgekv/__tests__/edgekv/edgeKVProvider.test.ts similarity index 85% rename from packages/sdk/akamai-edgekv/src/__tests__/edgekv/edgeKVProvider.test.ts rename to packages/sdk/akamai-edgekv/__tests__/edgekv/edgeKVProvider.test.ts index 13d61d3d82..b97366dd27 100644 --- a/packages/sdk/akamai-edgekv/src/__tests__/edgekv/edgeKVProvider.test.ts +++ b/packages/sdk/akamai-edgekv/__tests__/edgekv/edgeKVProvider.test.ts @@ -1,7 +1,7 @@ -import { EdgeKV } from '../../edgekv/edgekv'; -import EdgeKVProvider from '../../edgekv/edgeKVProvider'; +import { EdgeKV } from '../../src/edgekv/edgekv'; +import EdgeKVProvider from '../../src/edgekv/edgeKVProvider'; -jest.mock('../../edgekv/edgekv', () => ({ +jest.mock('../../src/edgekv/edgekv', () => ({ EdgeKV: jest.fn(), })); diff --git a/packages/sdk/akamai-edgekv/src/__tests__/index.test.ts b/packages/sdk/akamai-edgekv/__tests__/index.test.ts similarity index 96% rename from packages/sdk/akamai-edgekv/src/__tests__/index.test.ts rename to packages/sdk/akamai-edgekv/__tests__/index.test.ts index 778a37e2a9..90fd9e9249 100644 --- a/packages/sdk/akamai-edgekv/src/__tests__/index.test.ts +++ b/packages/sdk/akamai-edgekv/__tests__/index.test.ts @@ -1,8 +1,8 @@ -import EdgeKVProvider from '../edgekv/edgeKVProvider'; -import { init as initWithEdgeKV, LDClient, LDContext } from '../index'; +import EdgeKVProvider from '../src/edgekv/edgeKVProvider'; +import { init as initWithEdgeKV, LDClient, LDContext } from '../src/index'; import * as testData from './testData.json'; -jest.mock('../edgekv/edgekv', () => ({ +jest.mock('../src/edgekv/edgekv', () => ({ EdgeKV: jest.fn(), })); diff --git a/packages/sdk/akamai-edgekv/src/__tests__/testData.json b/packages/sdk/akamai-edgekv/__tests__/testData.json similarity index 100% rename from packages/sdk/akamai-edgekv/src/__tests__/testData.json rename to packages/sdk/akamai-edgekv/__tests__/testData.json diff --git a/packages/sdk/cloudflare/src/index.test.ts b/packages/sdk/cloudflare/__tests__/index.test.ts similarity index 98% rename from packages/sdk/cloudflare/src/index.test.ts rename to packages/sdk/cloudflare/__tests__/index.test.ts index 747bc75e17..941438c0a5 100644 --- a/packages/sdk/cloudflare/src/index.test.ts +++ b/packages/sdk/cloudflare/__tests__/index.test.ts @@ -3,7 +3,7 @@ import { Miniflare } from 'miniflare'; import { LDClient, LDContext } from '@launchdarkly/js-server-sdk-common-edge'; -import { init } from './index'; +import { init } from '../src/index'; import * as allFlagsSegments from './testData.json'; const mf = new Miniflare({ diff --git a/packages/sdk/cloudflare/src/testData.json b/packages/sdk/cloudflare/__tests__/testData.json similarity index 100% rename from packages/sdk/cloudflare/src/testData.json rename to packages/sdk/cloudflare/__tests__/testData.json diff --git a/packages/sdk/react-native/src/ReactNativeLDClient.storage.test.ts b/packages/sdk/react-native/__tests__/ReactNativeLDClient.storage.test.ts similarity index 93% rename from packages/sdk/react-native/src/ReactNativeLDClient.storage.test.ts rename to packages/sdk/react-native/__tests__/ReactNativeLDClient.storage.test.ts index 26b6dd7c42..53bde5c121 100644 --- a/packages/sdk/react-native/src/ReactNativeLDClient.storage.test.ts +++ b/packages/sdk/react-native/__tests__/ReactNativeLDClient.storage.test.ts @@ -1,6 +1,6 @@ import { AutoEnvAttributes, LDLogger } from '@launchdarkly/js-client-sdk-common'; -import ReactNativeLDClient from './ReactNativeLDClient'; +import ReactNativeLDClient from '../src/ReactNativeLDClient'; it('uses custom storage', async () => { // This test just validates that the custom storage instance is being called. diff --git a/packages/sdk/react-native/src/ReactNativeLDClient.test.ts b/packages/sdk/react-native/__tests__/ReactNativeLDClient.test.ts similarity index 95% rename from packages/sdk/react-native/src/ReactNativeLDClient.test.ts rename to packages/sdk/react-native/__tests__/ReactNativeLDClient.test.ts index 8f79acc411..7a4f594c68 100644 --- a/packages/sdk/react-native/src/ReactNativeLDClient.test.ts +++ b/packages/sdk/react-native/__tests__/ReactNativeLDClient.test.ts @@ -1,11 +1,11 @@ import { AutoEnvAttributes, LDLogger, Response } from '@launchdarkly/js-client-sdk-common'; -import createPlatform from './platform'; -import PlatformCrypto from './platform/crypto'; -import PlatformEncoding from './platform/PlatformEncoding'; -import PlatformInfo from './platform/PlatformInfo'; -import PlatformStorage from './platform/PlatformStorage'; -import ReactNativeLDClient from './ReactNativeLDClient'; +import createPlatform from '../src/platform'; +import PlatformCrypto from '../src/platform/crypto'; +import PlatformEncoding from '../src/platform/PlatformEncoding'; +import PlatformInfo from '../src/platform/PlatformInfo'; +import PlatformStorage from '../src/platform/PlatformStorage'; +import ReactNativeLDClient from '../src/ReactNativeLDClient'; function mockResponse(value: string, statusCode: number) { const response: Response = { @@ -34,7 +34,7 @@ function mockFetch(value: string, statusCode: number = 200) { return f; } -jest.mock('./platform', () => ({ +jest.mock('../src/platform', () => ({ __esModule: true, default: jest.fn((logger: LDLogger) => ({ crypto: new PlatformCrypto(), diff --git a/packages/sdk/react-native/src/fromExternal/react-native-sse/EventSource.test.ts b/packages/sdk/react-native/__tests__/fromExternal/react-native-sse/EventSource.test.ts similarity index 96% rename from packages/sdk/react-native/src/fromExternal/react-native-sse/EventSource.test.ts rename to packages/sdk/react-native/__tests__/fromExternal/react-native-sse/EventSource.test.ts index 268215b516..550e41e9f0 100644 --- a/packages/sdk/react-native/src/fromExternal/react-native-sse/EventSource.test.ts +++ b/packages/sdk/react-native/__tests__/fromExternal/react-native-sse/EventSource.test.ts @@ -1,7 +1,7 @@ import { type EventName } from '@launchdarkly/js-client-sdk-common'; import { createLogger } from '@launchdarkly/private-js-mocks'; -import EventSource, { backoff, jitter } from './EventSource'; +import EventSource, { backoff, jitter } from '../../../src/fromExternal/react-native-sse/EventSource'; let logger: ReturnType; diff --git a/packages/sdk/react-native/src/options.test.ts b/packages/sdk/react-native/__tests__/options.test.ts similarity index 96% rename from packages/sdk/react-native/src/options.test.ts rename to packages/sdk/react-native/__tests__/options.test.ts index 91f179a026..e219d28aae 100644 --- a/packages/sdk/react-native/src/options.test.ts +++ b/packages/sdk/react-native/__tests__/options.test.ts @@ -1,7 +1,7 @@ import { LDLogger } from '@launchdarkly/js-client-sdk-common'; -import validateOptions, { filterToBaseOptions } from './options'; -import { RNStorage } from './RNOptions'; +import validateOptions, { filterToBaseOptions } from '../src/options'; +import { RNStorage } from '../src/RNOptions'; it('logs no warnings when all configuration is valid', () => { const logger: LDLogger = { diff --git a/packages/sdk/react-native/src/platform/ConnectionManager.test.ts b/packages/sdk/react-native/__tests__/platform/ConnectionManager.test.ts similarity index 99% rename from packages/sdk/react-native/src/platform/ConnectionManager.test.ts rename to packages/sdk/react-native/__tests__/platform/ConnectionManager.test.ts index 2ce2db3d2b..9bc8e20c1a 100644 --- a/packages/sdk/react-native/src/platform/ConnectionManager.test.ts +++ b/packages/sdk/react-native/__tests__/platform/ConnectionManager.test.ts @@ -6,7 +6,7 @@ import { ConnectionManager, NetworkState, StateDetector, -} from './ConnectionManager'; +} from '../../src/platform/ConnectionManager'; function mockDestination(): ConnectionDestination { return { diff --git a/packages/sdk/react-native/src/platform/crypto/PlatformHasher.test.ts b/packages/sdk/react-native/__tests__/platform/crypto/PlatformHasher.test.ts similarity index 96% rename from packages/sdk/react-native/src/platform/crypto/PlatformHasher.test.ts rename to packages/sdk/react-native/__tests__/platform/crypto/PlatformHasher.test.ts index 38135983ca..ae416add2c 100644 --- a/packages/sdk/react-native/src/platform/crypto/PlatformHasher.test.ts +++ b/packages/sdk/react-native/__tests__/platform/crypto/PlatformHasher.test.ts @@ -1,4 +1,4 @@ -import PlatformHasher from './PlatformHasher'; +import PlatformHasher from '../../../src/platform/crypto/PlatformHasher'; /** * The links below are different from js-sha256 and are useful to verify the diff --git a/packages/sdk/react-native/src/provider/LDProvider.test.tsx b/packages/sdk/react-native/__tests__/provider/LDProvider.test.tsx similarity index 84% rename from packages/sdk/react-native/src/provider/LDProvider.test.tsx rename to packages/sdk/react-native/__tests__/provider/LDProvider.test.tsx index 4d5d9a5dbc..95e6a54147 100644 --- a/packages/sdk/react-native/src/provider/LDProvider.test.tsx +++ b/packages/sdk/react-native/__tests__/provider/LDProvider.test.tsx @@ -2,13 +2,13 @@ import { render } from '@testing-library/react'; import { AutoEnvAttributes, LDContext, LDOptions } from '@launchdarkly/js-client-sdk-common'; -import { useLDClient } from '../hooks'; -import ReactNativeLDClient from '../ReactNativeLDClient'; -import LDProvider from './LDProvider'; -import setupListeners from './setupListeners'; +import { useLDClient } from '../../src/hooks'; +import ReactNativeLDClient from '../../src/ReactNativeLDClient'; +import LDProvider from '../../src/provider/LDProvider'; +import setupListeners from '../../src/provider/setupListeners'; -jest.mock('../ReactNativeLDClient'); -jest.mock('./setupListeners'); +jest.mock('../../src/ReactNativeLDClient'); +jest.mock('../../src/provider/setupListeners'); const TestApp = () => { const ldClient = useLDClient(); diff --git a/packages/sdk/react-native/src/provider/setupListeners.test.ts b/packages/sdk/react-native/__tests__/provider/setupListeners.test.ts similarity index 82% rename from packages/sdk/react-native/src/provider/setupListeners.test.ts rename to packages/sdk/react-native/__tests__/provider/setupListeners.test.ts index 4d6878a292..58a9db89c8 100644 --- a/packages/sdk/react-native/src/provider/setupListeners.test.ts +++ b/packages/sdk/react-native/__tests__/provider/setupListeners.test.ts @@ -1,11 +1,11 @@ import { AutoEnvAttributes } from '@launchdarkly/js-client-sdk-common'; -import ReactNativeLDClient from '../ReactNativeLDClient'; -import setupListeners from './setupListeners'; +import ReactNativeLDClient from '../../src/ReactNativeLDClient'; +import setupListeners from '../../src/provider/setupListeners'; import resetAllMocks = jest.resetAllMocks; -jest.mock('../ReactNativeLDClient'); +jest.mock('../../src/ReactNativeLDClient'); describe('setupListeners', () => { let ldc: ReactNativeLDClient; diff --git a/packages/sdk/react-universal/src/index.test.ts b/packages/sdk/react-universal/__tests__/index.test.ts similarity index 100% rename from packages/sdk/react-universal/src/index.test.ts rename to packages/sdk/react-universal/__tests__/index.test.ts diff --git a/packages/sdk/vercel/src/createPlatformInfo.test.ts b/packages/sdk/vercel/__tests__/createPlatformInfo.test.ts similarity index 88% rename from packages/sdk/vercel/src/createPlatformInfo.test.ts rename to packages/sdk/vercel/__tests__/createPlatformInfo.test.ts index 6db8f24f96..5378dee119 100644 --- a/packages/sdk/vercel/src/createPlatformInfo.test.ts +++ b/packages/sdk/vercel/__tests__/createPlatformInfo.test.ts @@ -1,4 +1,4 @@ -import createPlatformInfo from './createPlatformInfo'; +import createPlatformInfo from '../src/createPlatformInfo'; const packageJson = require('../package.json'); diff --git a/packages/sdk/vercel/src/index.test.ts b/packages/sdk/vercel/__tests__/index.test.ts similarity index 98% rename from packages/sdk/vercel/src/index.test.ts rename to packages/sdk/vercel/__tests__/index.test.ts index 5c631f7f00..d95d2b107c 100644 --- a/packages/sdk/vercel/src/index.test.ts +++ b/packages/sdk/vercel/__tests__/index.test.ts @@ -1,6 +1,6 @@ import { LDClient, LDContext } from '@launchdarkly/js-server-sdk-common-edge'; -import { init } from './index'; +import { init } from '../src/index'; import mockEdgeConfigClient from './utils/mockEdgeConfigClient'; import * as testData from './utils/testData.json'; diff --git a/packages/sdk/vercel/src/utils/mockEdgeConfigClient.ts b/packages/sdk/vercel/__tests__/utils/mockEdgeConfigClient.ts similarity index 100% rename from packages/sdk/vercel/src/utils/mockEdgeConfigClient.ts rename to packages/sdk/vercel/__tests__/utils/mockEdgeConfigClient.ts diff --git a/packages/sdk/vercel/src/utils/testData.json b/packages/sdk/vercel/__tests__/utils/testData.json similarity index 100% rename from packages/sdk/vercel/src/utils/testData.json rename to packages/sdk/vercel/__tests__/utils/testData.json diff --git a/packages/shared/akamai-edgeworker-sdk/src/__tests__/featureStore/index.test.ts b/packages/shared/akamai-edgeworker-sdk/__tests__/featureStore/index.test.ts similarity index 98% rename from packages/shared/akamai-edgeworker-sdk/src/__tests__/featureStore/index.test.ts rename to packages/shared/akamai-edgeworker-sdk/__tests__/featureStore/index.test.ts index e692e3b719..ce243c6ed3 100644 --- a/packages/shared/akamai-edgeworker-sdk/src/__tests__/featureStore/index.test.ts +++ b/packages/shared/akamai-edgeworker-sdk/__tests__/featureStore/index.test.ts @@ -1,6 +1,6 @@ import { AsyncStoreFacade, LDFeatureStore } from '@launchdarkly/js-server-sdk-common'; -import { EdgeFeatureStore, EdgeProvider } from '../../featureStore'; +import { EdgeFeatureStore, EdgeProvider } from '../../src/featureStore'; import * as testData from '../testData.json'; describe('EdgeFeatureStore', () => { diff --git a/packages/shared/akamai-edgeworker-sdk/src/__tests__/index.test.ts b/packages/shared/akamai-edgeworker-sdk/__tests__/index.test.ts similarity index 99% rename from packages/shared/akamai-edgeworker-sdk/src/__tests__/index.test.ts rename to packages/shared/akamai-edgeworker-sdk/__tests__/index.test.ts index aa8f16fe9b..9b0264f820 100644 --- a/packages/shared/akamai-edgeworker-sdk/src/__tests__/index.test.ts +++ b/packages/shared/akamai-edgeworker-sdk/__tests__/index.test.ts @@ -1,4 +1,4 @@ -import { EdgeProvider, init, LDLogger, LDMultiKindContext, LDSingleKindContext } from '../..'; +import { EdgeProvider, init, LDLogger, LDMultiKindContext, LDSingleKindContext } from '../dist'; import * as testData from './testData.json'; const createClient = (sdkKey: string, mockLogger: LDLogger, mockEdgeProvider: EdgeProvider) => diff --git a/packages/shared/akamai-edgeworker-sdk/src/__tests__/platform/info/index.test.ts b/packages/shared/akamai-edgeworker-sdk/__tests__/platform/info/index.test.ts similarity index 84% rename from packages/shared/akamai-edgeworker-sdk/src/__tests__/platform/info/index.test.ts rename to packages/shared/akamai-edgeworker-sdk/__tests__/platform/info/index.test.ts index 9890146d6c..7e6ef0abcb 100644 --- a/packages/shared/akamai-edgeworker-sdk/src/__tests__/platform/info/index.test.ts +++ b/packages/shared/akamai-edgeworker-sdk/__tests__/platform/info/index.test.ts @@ -1,6 +1,6 @@ -import createPlatformInfo from '../../../platform/info'; +import createPlatformInfo from '../../../src/platform/info'; -const packageJson = require('../../../../package.json'); +const packageJson = require('../../../package.json'); describe('Akamai Platform Info', () => { const { name, version } = packageJson; diff --git a/packages/shared/akamai-edgeworker-sdk/src/__tests__/platform/requests.test.ts b/packages/shared/akamai-edgeworker-sdk/__tests__/platform/requests.test.ts similarity index 95% rename from packages/shared/akamai-edgeworker-sdk/src/__tests__/platform/requests.test.ts rename to packages/shared/akamai-edgeworker-sdk/__tests__/platform/requests.test.ts index e96e1ecb33..e70836b070 100644 --- a/packages/shared/akamai-edgeworker-sdk/src/__tests__/platform/requests.test.ts +++ b/packages/shared/akamai-edgeworker-sdk/__tests__/platform/requests.test.ts @@ -1,6 +1,6 @@ import { EventSourceInitDict } from '@launchdarkly/js-server-sdk-common'; -import EdgeRequests from '../../platform/requests'; +import EdgeRequests from '../../src/platform/requests'; const TEXT_RESPONSE = ''; const JSON_RESPONSE = {}; diff --git a/packages/shared/akamai-edgeworker-sdk/src/__tests__/testData.json b/packages/shared/akamai-edgeworker-sdk/__tests__/testData.json similarity index 100% rename from packages/shared/akamai-edgeworker-sdk/src/__tests__/testData.json rename to packages/shared/akamai-edgeworker-sdk/__tests__/testData.json diff --git a/packages/shared/akamai-edgeworker-sdk/src/__tests__/utils/createCallbacks.test.ts b/packages/shared/akamai-edgeworker-sdk/__tests__/utils/createCallbacks.test.ts similarity index 89% rename from packages/shared/akamai-edgeworker-sdk/src/__tests__/utils/createCallbacks.test.ts rename to packages/shared/akamai-edgeworker-sdk/__tests__/utils/createCallbacks.test.ts index 818fe553d2..ef5b7963ad 100644 --- a/packages/shared/akamai-edgeworker-sdk/src/__tests__/utils/createCallbacks.test.ts +++ b/packages/shared/akamai-edgeworker-sdk/__tests__/utils/createCallbacks.test.ts @@ -1,4 +1,4 @@ -import { createCallbacks } from '../../utils/createCallbacks'; +import { createCallbacks } from '../../src/utils/createCallbacks'; describe('create callback', () => { it('creates valid callbacks', () => { diff --git a/packages/shared/akamai-edgeworker-sdk/src/__tests__/utils/createOptions.test.ts b/packages/shared/akamai-edgeworker-sdk/__tests__/utils/createOptions.test.ts similarity index 87% rename from packages/shared/akamai-edgeworker-sdk/src/__tests__/utils/createOptions.test.ts rename to packages/shared/akamai-edgeworker-sdk/__tests__/utils/createOptions.test.ts index 66895ab381..735a2c9f3d 100644 --- a/packages/shared/akamai-edgeworker-sdk/src/__tests__/utils/createOptions.test.ts +++ b/packages/shared/akamai-edgeworker-sdk/__tests__/utils/createOptions.test.ts @@ -1,4 +1,4 @@ -import { createOptions, defaultOptions } from '../../utils/createOptions'; +import { createOptions, defaultOptions } from '../../src/utils/createOptions'; describe('create options', () => { it('returns default options', () => { diff --git a/packages/shared/akamai-edgeworker-sdk/src/__tests__/utils/validateOptions.test.ts b/packages/shared/akamai-edgeworker-sdk/__tests__/utils/validateOptions.test.ts similarity index 94% rename from packages/shared/akamai-edgeworker-sdk/src/__tests__/utils/validateOptions.test.ts rename to packages/shared/akamai-edgeworker-sdk/__tests__/utils/validateOptions.test.ts index 22615875c9..4126a9fe81 100644 --- a/packages/shared/akamai-edgeworker-sdk/src/__tests__/utils/validateOptions.test.ts +++ b/packages/shared/akamai-edgeworker-sdk/__tests__/utils/validateOptions.test.ts @@ -1,7 +1,7 @@ import { BasicLogger } from '@launchdarkly/js-server-sdk-common'; -import { EdgeFeatureStore } from '../../featureStore'; -import { LDOptionsInternal, validateOptions } from '../../utils/validateOptions'; +import { EdgeFeatureStore } from '../../src/featureStore'; +import { LDOptionsInternal, validateOptions } from '../../src/utils/validateOptions'; const SDK_KEY = 'test-key'; diff --git a/packages/shared/sdk-client/src/LDClientImpl.events.test.ts b/packages/shared/sdk-client/__tests__/LDClientImpl.events.test.ts similarity index 98% rename from packages/shared/sdk-client/src/LDClientImpl.events.test.ts rename to packages/shared/sdk-client/__tests__/LDClientImpl.events.test.ts index b62971b3b6..005b074d36 100644 --- a/packages/shared/sdk-client/src/LDClientImpl.events.test.ts +++ b/packages/shared/sdk-client/__tests__/LDClientImpl.events.test.ts @@ -14,8 +14,8 @@ import { } from '@launchdarkly/private-js-mocks'; import * as mockResponseJson from './evaluation/mockResponse.json'; -import LDClientImpl from './LDClientImpl'; -import { Flags } from './types'; +import LDClientImpl from '../src/LDClientImpl'; +import { Flags } from '../src/types'; type InputCustomEvent = internal.InputCustomEvent; type InputIdentifyEvent = internal.InputIdentifyEvent; diff --git a/packages/shared/sdk-client/src/LDClientImpl.storage.test.ts b/packages/shared/sdk-client/__tests__/LDClientImpl.storage.test.ts similarity index 98% rename from packages/shared/sdk-client/src/LDClientImpl.storage.test.ts rename to packages/shared/sdk-client/__tests__/LDClientImpl.storage.test.ts index 4b25031c6f..6ba21be23d 100644 --- a/packages/shared/sdk-client/src/LDClientImpl.storage.test.ts +++ b/packages/shared/sdk-client/__tests__/LDClientImpl.storage.test.ts @@ -5,11 +5,11 @@ import { setupMockStreamingProcessor, } from '@launchdarkly/private-js-mocks'; -import { toMulti } from './context/addAutoEnv'; +import { toMulti } from '../src/context/addAutoEnv'; import * as mockResponseJson from './evaluation/mockResponse.json'; -import LDClientImpl from './LDClientImpl'; -import LDEmitter from './LDEmitter'; -import { DeleteFlag, Flags, PatchFlag } from './types'; +import LDClientImpl from '../src/LDClientImpl'; +import LDEmitter from '../src/LDEmitter'; +import { DeleteFlag, Flags, PatchFlag } from '../src/types'; let mockPlatform: ReturnType; let logger: ReturnType; @@ -186,7 +186,7 @@ describe('sdk-client storage', () => { test('not emitting change event when changed keys is empty', async () => { let LDClientImplTestNoChange; jest.isolateModules(async () => { - LDClientImplTestNoChange = jest.requireActual('./LDClientImpl').default; + LDClientImplTestNoChange = jest.requireActual('../src/LDClientImpl').default; ldc = new LDClientImplTestNoChange(testSdkKey, AutoEnvAttributes.Enabled, mockPlatform, { logger, sendEvents: false, diff --git a/packages/shared/sdk-client/src/LDClientImpl.test.ts b/packages/shared/sdk-client/__tests__/LDClientImpl.test.ts similarity index 98% rename from packages/shared/sdk-client/src/LDClientImpl.test.ts rename to packages/shared/sdk-client/__tests__/LDClientImpl.test.ts index 34008c4974..df71280e1c 100644 --- a/packages/shared/sdk-client/src/LDClientImpl.test.ts +++ b/packages/shared/sdk-client/__tests__/LDClientImpl.test.ts @@ -7,8 +7,8 @@ import { } from '@launchdarkly/private-js-mocks'; import * as mockResponseJson from './evaluation/mockResponse.json'; -import LDClientImpl from './LDClientImpl'; -import { Flags } from './types'; +import LDClientImpl from '../src/LDClientImpl'; +import { Flags } from '../src/types'; jest.mock('@launchdarkly/js-sdk-common', () => { const actual = jest.requireActual('@launchdarkly/js-sdk-common'); diff --git a/packages/shared/sdk-client/src/LDClientImpl.timeout.test.ts b/packages/shared/sdk-client/__tests__/LDClientImpl.timeout.test.ts similarity index 97% rename from packages/shared/sdk-client/src/LDClientImpl.timeout.test.ts rename to packages/shared/sdk-client/__tests__/LDClientImpl.timeout.test.ts index 9ed81aca53..49b1bf41d1 100644 --- a/packages/shared/sdk-client/src/LDClientImpl.timeout.test.ts +++ b/packages/shared/sdk-client/__tests__/LDClientImpl.timeout.test.ts @@ -5,10 +5,10 @@ import { setupMockStreamingProcessor, } from '@launchdarkly/private-js-mocks'; -import { toMulti } from './context/addAutoEnv'; +import { toMulti } from '../src/context/addAutoEnv'; import * as mockResponseJson from './evaluation/mockResponse.json'; -import LDClientImpl from './LDClientImpl'; -import { Flags } from './types'; +import LDClientImpl from '../src/LDClientImpl'; +import { Flags } from '../src/types'; let mockPlatform: ReturnType; let logger: ReturnType; diff --git a/packages/shared/sdk-client/src/LDClientImpl.variation.test.ts b/packages/shared/sdk-client/__tests__/LDClientImpl.variation.test.ts similarity index 97% rename from packages/shared/sdk-client/src/LDClientImpl.variation.test.ts rename to packages/shared/sdk-client/__tests__/LDClientImpl.variation.test.ts index 39d63065d6..d067435e90 100644 --- a/packages/shared/sdk-client/src/LDClientImpl.variation.test.ts +++ b/packages/shared/sdk-client/__tests__/LDClientImpl.variation.test.ts @@ -6,8 +6,8 @@ import { } from '@launchdarkly/private-js-mocks'; import * as mockResponseJson from './evaluation/mockResponse.json'; -import LDClientImpl from './LDClientImpl'; -import { Flags } from './types'; +import LDClientImpl from '../src/LDClientImpl'; +import { Flags } from '../src/types'; let mockPlatform: ReturnType; let logger: ReturnType; diff --git a/packages/shared/sdk-client/src/LDEmitter.test.ts b/packages/shared/sdk-client/__tests__/LDEmitter.test.ts similarity index 99% rename from packages/shared/sdk-client/src/LDEmitter.test.ts rename to packages/shared/sdk-client/__tests__/LDEmitter.test.ts index def8355a39..66a2a57d90 100644 --- a/packages/shared/sdk-client/src/LDEmitter.test.ts +++ b/packages/shared/sdk-client/__tests__/LDEmitter.test.ts @@ -1,6 +1,6 @@ import { LDContext, LDLogger } from '@launchdarkly/js-sdk-common'; -import LDEmitter from './LDEmitter'; +import LDEmitter from '../src/LDEmitter'; describe('LDEmitter', () => { const error = { type: 'network', message: 'unreachable' }; diff --git a/packages/shared/sdk-client/src/configuration/Configuration.test.ts b/packages/shared/sdk-client/__tests__/configuration/Configuration.test.ts similarity index 98% rename from packages/shared/sdk-client/src/configuration/Configuration.test.ts rename to packages/shared/sdk-client/__tests__/configuration/Configuration.test.ts index 9936234f9a..6ce2922953 100644 --- a/packages/shared/sdk-client/src/configuration/Configuration.test.ts +++ b/packages/shared/sdk-client/__tests__/configuration/Configuration.test.ts @@ -1,5 +1,5 @@ /* eslint-disable no-console */ -import Configuration from './Configuration'; +import Configuration from '../../src/configuration/Configuration'; describe('Configuration', () => { beforeEach(() => { diff --git a/packages/shared/sdk-client/src/context/addAutoEnv.test.ts b/packages/shared/sdk-client/__tests__/context/addAutoEnv.test.ts similarity index 99% rename from packages/shared/sdk-client/src/context/addAutoEnv.test.ts rename to packages/shared/sdk-client/__tests__/context/addAutoEnv.test.ts index a363794559..93eadeb9d4 100644 --- a/packages/shared/sdk-client/src/context/addAutoEnv.test.ts +++ b/packages/shared/sdk-client/__tests__/context/addAutoEnv.test.ts @@ -7,8 +7,8 @@ import { } from '@launchdarkly/js-sdk-common'; import { createBasicPlatform, createLogger } from '@launchdarkly/private-js-mocks'; -import Configuration from '../configuration'; -import { addApplicationInfo, addAutoEnv, addDeviceInfo, toMulti } from './addAutoEnv'; +import Configuration from '../../src/configuration'; +import { addApplicationInfo, addAutoEnv, addDeviceInfo, toMulti } from '../../src/context/addAutoEnv'; let mockPlatform: ReturnType; let logger: ReturnType; diff --git a/packages/shared/sdk-client/src/context/ensureKey.test.ts b/packages/shared/sdk-client/__tests__/context/ensureKey.test.ts similarity index 98% rename from packages/shared/sdk-client/src/context/ensureKey.test.ts rename to packages/shared/sdk-client/__tests__/context/ensureKey.test.ts index a985427c01..2faf601778 100644 --- a/packages/shared/sdk-client/src/context/ensureKey.test.ts +++ b/packages/shared/sdk-client/__tests__/context/ensureKey.test.ts @@ -7,7 +7,7 @@ import type { } from '@launchdarkly/js-sdk-common'; import { createBasicPlatform } from '@launchdarkly/private-js-mocks'; -import { ensureKey } from './ensureKey'; +import { ensureKey } from '../../src/context/ensureKey'; let mockPlatform: ReturnType; diff --git a/packages/shared/sdk-client/src/diagnostics/createDiagnosticsInitConfig.test.ts b/packages/shared/sdk-client/__tests__/diagnostics/createDiagnosticsInitConfig.test.ts similarity index 93% rename from packages/shared/sdk-client/src/diagnostics/createDiagnosticsInitConfig.test.ts rename to packages/shared/sdk-client/__tests__/diagnostics/createDiagnosticsInitConfig.test.ts index aa70b134ec..1a30e21e15 100644 --- a/packages/shared/sdk-client/src/diagnostics/createDiagnosticsInitConfig.test.ts +++ b/packages/shared/sdk-client/__tests__/diagnostics/createDiagnosticsInitConfig.test.ts @@ -1,9 +1,9 @@ import { secondsToMillis } from '@launchdarkly/js-sdk-common'; -import Configuration from '../configuration'; +import Configuration from '../../src/configuration'; import createDiagnosticsInitConfig, { type DiagnosticsInitConfig, -} from './createDiagnosticsInitConfig'; +} from '../../src/diagnostics/createDiagnosticsInitConfig'; describe('createDiagnosticsInitConfig', () => { let initConfig: DiagnosticsInitConfig; diff --git a/packages/shared/sdk-client/src/evaluation/mockResponse.json b/packages/shared/sdk-client/__tests__/evaluation/mockResponse.json similarity index 100% rename from packages/shared/sdk-client/src/evaluation/mockResponse.json rename to packages/shared/sdk-client/__tests__/evaluation/mockResponse.json diff --git a/packages/shared/sdk-client/src/flag-manager/ContextIndex.test.ts b/packages/shared/sdk-client/__tests__/flag-manager/ContextIndex.test.ts similarity index 98% rename from packages/shared/sdk-client/src/flag-manager/ContextIndex.test.ts rename to packages/shared/sdk-client/__tests__/flag-manager/ContextIndex.test.ts index aa9bd45ded..5edb004c49 100644 --- a/packages/shared/sdk-client/src/flag-manager/ContextIndex.test.ts +++ b/packages/shared/sdk-client/__tests__/flag-manager/ContextIndex.test.ts @@ -1,4 +1,4 @@ -import ContextIndex from './ContextIndex'; +import ContextIndex from '../../src/flag-manager/ContextIndex'; describe('ContextIndex tests', () => { test('notice adds to index', async () => { diff --git a/packages/shared/sdk-client/src/flag-manager/FlagPersistence.test.ts b/packages/shared/sdk-client/__tests__/flag-manager/FlagPersistence.test.ts similarity index 97% rename from packages/shared/sdk-client/src/flag-manager/FlagPersistence.test.ts rename to packages/shared/sdk-client/__tests__/flag-manager/FlagPersistence.test.ts index 2cd26cd1b0..ddc5e8ccb3 100644 --- a/packages/shared/sdk-client/src/flag-manager/FlagPersistence.test.ts +++ b/packages/shared/sdk-client/__tests__/flag-manager/FlagPersistence.test.ts @@ -1,11 +1,11 @@ /* eslint-disable @typescript-eslint/no-use-before-define */ import { Context, Crypto, Hasher, LDLogger, Platform, Storage } from '@launchdarkly/js-sdk-common'; -import { namespaceForContextData, namespaceForContextIndex } from '../storage/namespaceUtils'; -import { Flag, Flags } from '../types'; -import FlagPersistence from './FlagPersistence'; -import { DefaultFlagStore } from './FlagStore'; -import FlagUpdater from './FlagUpdater'; +import { namespaceForContextData, namespaceForContextIndex } from '../../src/storage/namespaceUtils'; +import { Flag, Flags } from '../../src/types'; +import FlagPersistence from '../../src/flag-manager/FlagPersistence'; +import { DefaultFlagStore } from '../../src/flag-manager/FlagStore'; +import FlagUpdater from '../../src/flag-manager/FlagUpdater'; const TEST_NAMESPACE = 'TestNamespace'; diff --git a/packages/shared/sdk-client/src/flag-manager/FlagUpdater.test.ts b/packages/shared/sdk-client/__tests__/flag-manager/FlagUpdater.test.ts similarity index 97% rename from packages/shared/sdk-client/src/flag-manager/FlagUpdater.test.ts rename to packages/shared/sdk-client/__tests__/flag-manager/FlagUpdater.test.ts index 26b5d42daa..1936b242a6 100644 --- a/packages/shared/sdk-client/src/flag-manager/FlagUpdater.test.ts +++ b/packages/shared/sdk-client/__tests__/flag-manager/FlagUpdater.test.ts @@ -1,8 +1,8 @@ import { Context, LDLogger } from '@launchdarkly/js-sdk-common'; -import { Flag } from '../types'; -import { DefaultFlagStore } from './FlagStore'; -import FlagUpdater, { FlagsChangeCallback } from './FlagUpdater'; +import { Flag } from '../../src/types'; +import { DefaultFlagStore } from '../../src/flag-manager/FlagStore'; +import FlagUpdater, { FlagsChangeCallback } from '../../src/flag-manager/FlagUpdater'; function makeMockFlag(): Flag { // the values of the flag object itself are not relevant for these tests, the diff --git a/packages/shared/sdk-client/src/polling/PollingProcessot.test.ts b/packages/shared/sdk-client/__tests__/polling/PollingProcessot.test.ts similarity index 99% rename from packages/shared/sdk-client/src/polling/PollingProcessot.test.ts rename to packages/shared/sdk-client/__tests__/polling/PollingProcessot.test.ts index ce0a6a8e02..b6a98ae3eb 100644 --- a/packages/shared/sdk-client/src/polling/PollingProcessot.test.ts +++ b/packages/shared/sdk-client/__tests__/polling/PollingProcessot.test.ts @@ -10,7 +10,7 @@ import { SdkData, } from '@launchdarkly/js-sdk-common'; -import PollingProcessor, { PollingConfig } from './PollingProcessor'; +import PollingProcessor, { PollingConfig } from '../../src/polling/PollingProcessor'; function mockResponse(value: string, statusCode: number) { const response: Response = { diff --git a/packages/shared/sdk-client/src/storage/getOrGenerateKey.test.ts b/packages/shared/sdk-client/__tests__/storage/getOrGenerateKey.test.ts similarity index 97% rename from packages/shared/sdk-client/src/storage/getOrGenerateKey.test.ts rename to packages/shared/sdk-client/__tests__/storage/getOrGenerateKey.test.ts index 94403c3e4c..8065871ff9 100644 --- a/packages/shared/sdk-client/src/storage/getOrGenerateKey.test.ts +++ b/packages/shared/sdk-client/__tests__/storage/getOrGenerateKey.test.ts @@ -1,7 +1,7 @@ import { Crypto, Storage } from '@launchdarkly/js-sdk-common'; import { createBasicPlatform } from '@launchdarkly/private-js-mocks'; -import { getOrGenerateKey } from './getOrGenerateKey'; +import { getOrGenerateKey } from '../../src/storage/getOrGenerateKey'; let mockPlatform: ReturnType; diff --git a/packages/shared/sdk-client/src/storage/namespaceUtils.test.ts b/packages/shared/sdk-client/__tests__/storage/namespaceUtils.test.ts similarity index 93% rename from packages/shared/sdk-client/src/storage/namespaceUtils.test.ts rename to packages/shared/sdk-client/__tests__/storage/namespaceUtils.test.ts index 73058eeb0d..0ee0c70cf2 100644 --- a/packages/shared/sdk-client/src/storage/namespaceUtils.test.ts +++ b/packages/shared/sdk-client/__tests__/storage/namespaceUtils.test.ts @@ -1,4 +1,4 @@ -import { concatNamespacesAndValues } from './namespaceUtils'; +import { concatNamespacesAndValues } from '../../src/storage/namespaceUtils'; const mockHash = (input: string) => `${input}Hashed`; const noop = (input: string) => input; diff --git a/packages/shared/sdk-server-edge/src/api/EdgeFeatureStore.test.ts b/packages/shared/sdk-server-edge/__tests__/api/EdgeFeatureStore.test.ts similarity index 95% rename from packages/shared/sdk-server-edge/src/api/EdgeFeatureStore.test.ts rename to packages/shared/sdk-server-edge/__tests__/api/EdgeFeatureStore.test.ts index 4b8acf6f13..c1de7fc704 100644 --- a/packages/shared/sdk-server-edge/src/api/EdgeFeatureStore.test.ts +++ b/packages/shared/sdk-server-edge/__tests__/api/EdgeFeatureStore.test.ts @@ -1,8 +1,8 @@ import { AsyncStoreFacade, LDFeatureStore } from '@launchdarkly/js-server-sdk-common'; -import mockEdgeProvider from '../utils/mockEdgeProvider'; -import * as testData from '../utils/testData.json'; -import { EdgeFeatureStore } from './EdgeFeatureStore'; +import mockEdgeProvider from '../../src/utils/mockEdgeProvider'; +import * as testData from './testData.json'; +import { EdgeFeatureStore } from '../../src/api/EdgeFeatureStore'; describe('EdgeFeatureStore', () => { const sdkKey = 'sdkKey'; diff --git a/packages/shared/sdk-server-edge/src/api/LDClient.test.ts b/packages/shared/sdk-server-edge/__tests__/api/LDClient.test.ts similarity index 96% rename from packages/shared/sdk-server-edge/src/api/LDClient.test.ts rename to packages/shared/sdk-server-edge/__tests__/api/LDClient.test.ts index d91e1a751c..6173757786 100644 --- a/packages/shared/sdk-server-edge/src/api/LDClient.test.ts +++ b/packages/shared/sdk-server-edge/__tests__/api/LDClient.test.ts @@ -1,7 +1,7 @@ import { internal } from '@launchdarkly/js-server-sdk-common'; import { createBasicPlatform } from '@launchdarkly/private-js-mocks'; -import LDClient from './LDClient'; +import LDClient from '../../src/api/LDClient'; jest.mock('@launchdarkly/js-sdk-common', () => { const actual = jest.requireActual('@launchdarkly/js-sdk-common'); diff --git a/packages/shared/sdk-server-edge/src/api/createCallbacks.test.ts b/packages/shared/sdk-server-edge/__tests__/api/createCallbacks.test.ts similarity index 97% rename from packages/shared/sdk-server-edge/src/api/createCallbacks.test.ts rename to packages/shared/sdk-server-edge/__tests__/api/createCallbacks.test.ts index 43d8d8150b..957542a6c3 100644 --- a/packages/shared/sdk-server-edge/src/api/createCallbacks.test.ts +++ b/packages/shared/sdk-server-edge/__tests__/api/createCallbacks.test.ts @@ -3,7 +3,7 @@ import { EventEmitter } from 'node:events'; import { noop } from '@launchdarkly/js-server-sdk-common'; import { createLogger } from '@launchdarkly/private-js-mocks'; -import createCallbacks from './createCallbacks'; +import createCallbacks from '../../src/api/createCallbacks'; let logger: ReturnType; diff --git a/packages/shared/sdk-server-edge/src/api/createOptions.test.ts b/packages/shared/sdk-server-edge/__tests__/api/createOptions.test.ts similarity index 83% rename from packages/shared/sdk-server-edge/src/api/createOptions.test.ts rename to packages/shared/sdk-server-edge/__tests__/api/createOptions.test.ts index 4c5d4962b5..02fcc4b45d 100644 --- a/packages/shared/sdk-server-edge/src/api/createOptions.test.ts +++ b/packages/shared/sdk-server-edge/__tests__/api/createOptions.test.ts @@ -1,6 +1,6 @@ import { BasicLogger } from '@launchdarkly/js-server-sdk-common'; -import createOptions, { defaultOptions } from './createOptions'; +import createOptions, { defaultOptions } from '../../src/api/createOptions'; describe('createOptions', () => { test('default options', () => { diff --git a/packages/shared/sdk-server-edge/src/utils/testData.json b/packages/shared/sdk-server-edge/__tests__/api/testData.json similarity index 100% rename from packages/shared/sdk-server-edge/src/utils/testData.json rename to packages/shared/sdk-server-edge/__tests__/api/testData.json diff --git a/packages/shared/sdk-server-edge/src/utils/validateOptions.test.ts b/packages/shared/sdk-server-edge/__tests__/utils/validateOptions.test.ts similarity index 91% rename from packages/shared/sdk-server-edge/src/utils/validateOptions.test.ts rename to packages/shared/sdk-server-edge/__tests__/utils/validateOptions.test.ts index 4836160eec..cc39f925c2 100644 --- a/packages/shared/sdk-server-edge/src/utils/validateOptions.test.ts +++ b/packages/shared/sdk-server-edge/__tests__/utils/validateOptions.test.ts @@ -1,7 +1,7 @@ import { BasicLogger } from '@launchdarkly/js-server-sdk-common'; -import mockFeatureStore from './mockFeatureStore'; -import validateOptions from './validateOptions'; +import mockFeatureStore from '../../src/utils/mockFeatureStore'; +import validateOptions from '../../src/utils/validateOptions'; describe('validateOptions', () => { test('throws without SDK key', () => { diff --git a/packages/telemetry/node-server-sdk-otel/src/TracingHook.test.ts b/packages/telemetry/node-server-sdk-otel/__tests__/TracingHook.test.ts similarity index 99% rename from packages/telemetry/node-server-sdk-otel/src/TracingHook.test.ts rename to packages/telemetry/node-server-sdk-otel/__tests__/TracingHook.test.ts index 7438fe9c39..edc110b1ec 100644 --- a/packages/telemetry/node-server-sdk-otel/src/TracingHook.test.ts +++ b/packages/telemetry/node-server-sdk-otel/__tests__/TracingHook.test.ts @@ -4,7 +4,7 @@ import { InMemorySpanExporter, SimpleSpanProcessor } from '@opentelemetry/sdk-tr import { basicLogger, init, integrations } from '@launchdarkly/node-server-sdk'; -import TracingHook from './TracingHook'; +import TracingHook from '../src/TracingHook'; const spanExporter = new InMemorySpanExporter(); const sdk = new NodeSDK({