We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d952737 commit 33c13aeCopy full SHA for 33c13ae
packages/compass-web/src/logger.spec.tsx
@@ -59,4 +59,25 @@ describe('useCompassWebLogger', function () {
59
},
60
]);
61
});
62
+
63
+ it('should call onLog hook synchronously', function () {
64
+ let callbackExecuted = false;
65
+ const onLog = Sinon.stub().callsFake(() => {
66
+ callbackExecuted = true;
67
+ });
68
69
+ const {
70
+ result: { current: logger },
71
+ } = renderLoggerHook({ onLog });
72
73
+ // Callback should not have been called yet
74
+ expect(callbackExecuted).to.be.false;
75
76
+ // Call the logger
77
+ logger.log.info(mongoLogId(456), 'Test', 'sync test');
78
79
+ // Callback should have been called synchronously before this assertion
80
+ expect(callbackExecuted).to.be.true;
81
+ expect(onLog).to.have.been.calledOnce;
82
83
0 commit comments