mirror of
https://github.com/Unleash/unleash.git
synced 2025-07-31 13:47:02 +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 { PayloadType, type Variant } from 'unleash-client';
|
||||||
import { parseEnvVarBoolean } from '../util';
|
import { parseEnvVarBoolean } from '../util';
|
||||||
import { getDefaultVariant } from 'unleash-client/lib/variant';
|
import { getDefaultVariant } from 'unleash-client/lib/variant';
|
||||||
|
import type { Context } from '../features/playground/feature-evaluator';
|
||||||
|
|
||||||
export type IFlagKey =
|
export type IFlagKey =
|
||||||
| 'accessLogs'
|
| 'accessLogs'
|
||||||
@ -345,9 +346,7 @@ export interface IExperimentalOptions {
|
|||||||
externalResolver: IExternalFlagResolver;
|
externalResolver: IExternalFlagResolver;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IFlagContext {
|
export interface IFlagContext extends Context {}
|
||||||
[key: string]: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface IFlagResolver {
|
export interface IFlagResolver {
|
||||||
getAll: (context?: IFlagContext) => IFlags;
|
getAll: (context?: IFlagContext) => IFlags;
|
||||||
|
@ -244,7 +244,7 @@ test('should call external resolver getStaticContext ', () => {
|
|||||||
return getDefaultVariant();
|
return getDefaultVariant();
|
||||||
},
|
},
|
||||||
getStaticContext: () => {
|
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);
|
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