1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-07-26 13:48:33 +02:00

fix: flag-resolver context type

This commit is contained in:
Ivar Conradi Østhus 2025-04-10 10:44:04 +02:00
parent 8f117ac18e
commit 3f5f43933a
No known key found for this signature in database
GPG Key ID: 14F51E4841AF1DE1
2 changed files with 6 additions and 5 deletions

View File

@ -1,6 +1,7 @@
import { PayloadType, type Variant } from 'unleash-client';
import { parseEnvVarBoolean } from '../util';
import { getDefaultVariant } from 'unleash-client/lib/variant';
import type { Context } from '../features/playground/feature-evaluator';
export type IFlagKey =
| 'accessLogs'
@ -345,9 +346,7 @@ export interface IExperimentalOptions {
externalResolver: IExternalFlagResolver;
}
export interface IFlagContext {
[key: string]: string;
}
export interface IFlagContext extends Context {}
export interface IFlagResolver {
getAll: (context?: IFlagContext) => IFlags;

View File

@ -244,7 +244,7 @@ test('should call external resolver getStaticContext ', () => {
return getDefaultVariant();
},
getStaticContext: () => {
return { clientId: 'red' };
return { properties: { clientId: 'red' } };
},
};
@ -264,5 +264,7 @@ test('should call external resolver getStaticContext ', () => {
const resolver = new FlagResolver(config as IExperimentalOptions);
expect(resolver.getStaticContext()).toStrictEqual({ clientId: 'red' });
expect(resolver.getStaticContext()).toStrictEqual({
properties: { clientId: 'red' },
});
});