File tree Expand file tree Collapse file tree 3 files changed +5
-7
lines changed
libs/providers/go-feature-flag/src/lib Expand file tree Collapse file tree 3 files changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,7 @@ import { EvaluationType } from '../model';
77// Mock the EvaluateWasm class
88jest . mock ( '../wasm/evaluate-wasm' , ( ) => ( {
99 EvaluateWasm : jest . fn ( ) . mockImplementation ( ( ) => ( {
10+ initialize : jest . fn ( ) . mockResolvedValue ( undefined ) ,
1011 evaluate : jest . fn ( ) . mockResolvedValue ( {
1112 value : true ,
1213 reason : 'TARGETING_MATCH' ,
Original file line number Diff line number Diff line change @@ -64,8 +64,9 @@ export class InProcessEvaluator implements IEvaluator {
6464 * Initialize the evaluator.
6565 */
6666 async initialize ( ) : Promise < void > {
67- await this . loadConfiguration ( true ) ;
67+ await this . evaluationEngine . initialize ( ) ;
6868
69+ await this . loadConfiguration ( true ) ;
6970 // Start periodic configuration polling
7071 if ( this . options . flagChangePollingIntervalMs && this . options . flagChangePollingIntervalMs > 0 ) {
7172 this . periodicRunner = setInterval (
Original file line number Diff line number Diff line change @@ -23,17 +23,13 @@ export class EvaluateWasm {
2323 constructor ( logger ?: Logger ) {
2424 this . logger = logger ;
2525 this . go = new Go ( ) ;
26- // Initialize WASM asynchronously
27- this . initializeWasm ( ) . catch ( ( error ) => {
28- logger ?. error ( 'Failed to initialize WASM:' , error ) ;
29- } ) ;
3026 }
3127
3228 /**
3329 * Initializes the WASM module.
3430 * In a real implementation, this would load the WASM binary and instantiate it.
3531 */
36- private async initializeWasm ( ) : Promise < void > {
32+ public async initialize ( ) : Promise < void > {
3733 try {
3834 // Load the WASM binary
3935 const wasmBuffer = await this . loadWasmBinary ( ) ;
@@ -119,7 +115,7 @@ export class EvaluateWasm {
119115 try {
120116 // Ensure WASM is initialized
121117 if ( ! this . wasmExports || ! this . wasmMemory ) {
122- await this . initializeWasm ( ) ;
118+ await this . initialize ( ) ;
123119 }
124120
125121 // Serialize the input to JSON
You can’t perform that action at this time.
0 commit comments