Skip to content

Commit

Permalink
move test to proxy-providers.spec.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandre-abrioux committed Jan 31, 2024
1 parent 846c678 commit 1623c21
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.

This file was deleted.

23 changes: 23 additions & 0 deletions packages/core/test/proxy-providers/proxy-providers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import {
ProxyResult,
ProxyResults,
} from './expect-ids-proxy';
import { globalClsService } from '../../src/lib/cls-service.globals';
import { ProxyProviderManager } from '../../src/lib/proxy-provider';

@Injectable()
class InjectedClass {
Expand Down Expand Up @@ -142,3 +144,24 @@ describe('Proxy providers', () => {
await expectOkIdsProxy(app);
});
});

describe('Edge cases', () => {
it('proxy should allow setting falsy value', async () => {
const clsService = globalClsService;
const symbol = Symbol('testSymbol');
const proxyProvider = ProxyProviderManager.createProxyProvider({
provide: symbol,
type: 'object',
useFactory: () => ({
booleanTest: true,
}),
});
const proxy = proxyProvider.useFactory();
await clsService.run(async () => {
await ProxyProviderManager.resolveProxyProviders();
expect(proxy.booleanTest).toBe(true);
proxy.booleanTest = false;
expect(proxy.booleanTest).toBe(false);
});
});
});

0 comments on commit 1623c21

Please sign in to comment.