Skip to content

Commit cec3bde

Browse files
committed
more test fixes
1 parent 1b21500 commit cec3bde

File tree

3 files changed

+24
-2
lines changed

3 files changed

+24
-2
lines changed

packages/shared/sdk-server-edge/__tests__/createBasicPlatform.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import { PlatformData, SdkData } from '../src/api';
1+
import { PlatformData, SdkData } from '@launchdarkly/js-server-sdk-common';
2+
3+
import { setupCrypto } from './setupCrypto';
24

35
const setupInfo = () => ({
46
platformData: jest.fn(
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { Hasher } from '@launchdarkly/js-sdk-common';
2+
3+
export const setupCrypto = () => {
4+
let counter = 0;
5+
const hasher = {
6+
update: jest.fn((): Hasher => hasher),
7+
digest: jest.fn(() => '1234567890123456'),
8+
};
9+
10+
return {
11+
createHash: jest.fn(() => hasher),
12+
createHmac: jest.fn(),
13+
randomUUID: jest.fn(() => {
14+
counter += 1;
15+
// Will provide a unique value for tests.
16+
// Very much not a UUID of course.
17+
return `${counter}`;
18+
}),
19+
};
20+
};

packages/shared/sdk-server/__tests__/LDClientImpl.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function getUpdateProcessorFactory(shouldError: boolean = false, initTimeoutMs:
1414
return (
1515
_clientContext: LDClientContext,
1616
featureStore: LDFeatureStore,
17-
initSuccessHandler: VoidFunction,
17+
initSuccessHandler: Function,
1818
errorHandler?: (e: Error) => void,
1919
) => ({
2020
start: jest.fn(async () => {

0 commit comments

Comments
 (0)