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:
parent
8f117ac18e
commit
3f5f43933a
@ -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;
|
||||
|
@ -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' },
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user