-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(proxy-provider-manager): handle setting falsy value
Co-authored-by: Jerry Laloan <[email protected]>
- Loading branch information
1 parent
1bc5e99
commit 846c678
Showing
2 changed files
with
24 additions
and
1 deletion.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
packages/core/src/lib/proxy-provider/proxy-provider-manager.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { ProxyProviderManager } from './proxy-provider-manager'; | ||
import { globalClsService } from '../cls-service.globals'; | ||
|
||
describe('Proxy provider manager', () => { | ||
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); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters