Skip to content

Commit 3762d16

Browse files
committed
fix: container and eval unit-test errors
1 parent 29c135e commit 3762d16

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

packages/core/src/__tests__/container.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ describe('container', () => {
136136
it('should resolve circular references without creating duplicate service instances', () => {
137137
// Arrange
138138
const testContainer = new Container(Logger.null);
139-
testContainer.registerType(ServiceImplCircular, [ServiceImplCircular]);
140-
testContainer.registerType(CircularRef, [CircularRef]);
139+
testContainer.registerType(ServiceImplCircular, [ServiceImplCircular], { lifecycle: LifecyclePolicy.singleton });
140+
testContainer.registerType(CircularRef, [CircularRef], { lifecycle: LifecyclePolicy.singleton });
141141

142142
// Act
143143
const result = testContainer.resolve(ServiceImplCircular)!;

packages/util/src/__tests__/string.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ describe('util', () => {
3636
expect(string.evalExpr('\'Foo \' + bar', { bar: 'bar'})).toEqual('Foo bar');
3737
});
3838
it('complex expression should return evaluated result as string', () => {
39-
expect(string.evalExpr('\'Foo \' + (i == 0 ? (bar || foo) : \'bla\')', { i: 0, foo: 'bar'})).toEqual('Foo bar');
39+
expect(string.evalExpr('\'Foo \' + (i == 0 ? (bar || foo) : \'bla\')', { i: 0, foo: 'bar', bar: undefined})).toEqual('Foo bar');
4040
});
4141
});
4242

packages/util/src/string.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ export function format(formatStr: string, ...args: any[]) {
7676
* @param contextValues context values supplied
7777
*/
7878
export function evalExpr(expr: string, contextValues: any) : string {
79-
const fn = compileFunction(`return ${expr};`);
79+
const fn = compileFunction(`return ${expr}`);
8080
return fn(contextValues, false);
8181
}
8282

@@ -86,7 +86,7 @@ export function evalExpr(expr: string, contextValues: any) : string {
8686
* @param contextValues context values supplied
8787
*/
8888
export function evalTemplate(expr: string, contextValues: any) : string {
89-
const fn = compileFunction(`return \`${expr}\`;`);
89+
const fn = compileFunction(`return \`${expr}\``);
9090
return fn(contextValues, false);
9191
}
9292

0 commit comments

Comments
 (0)