You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/__tests__/offline/node.spec.js
+18-5Lines changed: 18 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -70,9 +70,16 @@ tape('Node.js Offline Mode', function (t) {
70
70
t.test('Trying to specify an invalid extension it will timeout',assert=>{
71
71
constconfig=settingsGenerator('.forbidden');
72
72
73
-
sinon.spy(console,'log');
74
-
75
-
constfactory=SplitFactory({ ...config,debug: 'ERROR'});// enable error level logs to check the message.
73
+
sinon.stub(console,'error');
74
+
sinon.stub(console,'warn');
75
+
sinon.stub(console,'info');
76
+
sinon.stub(console,'debug');
77
+
78
+
constfactory=SplitFactory({
79
+
...config,
80
+
debug: 'ERROR',// enable logs to check the message.
81
+
logger: console// use console as custom logger.
82
+
});
76
83
constclient=factory.client();
77
84
78
85
client.on(client.Event.SDK_READY,()=>{
@@ -84,9 +91,15 @@ tape('Node.js Offline Mode', function (t) {
84
91
client.on(client.Event.SDK_READY_TIMED_OUT,()=>{
85
92
assert.pass('If tried to load a file with invalid extension, we should emit SDK_READY_TIMED_OUT.');
86
93
87
-
assert.ok(console.log.calledWithMatch(`[ERROR] splitio => sync:offline: There was an issue loading the mock feature flags data. No changes will be applied to the current cache. Error: Invalid extension specified for feature flags mock file. Accepted extensions are ".yml" and ".yaml". Your specified file is ${config.features}`));
94
+
assert.ok(console.error.calledWithMatch(`splitio => sync:offline: There was an issue loading the mock feature flags data. No changes will be applied to the current cache. Error: Invalid extension specified for feature flags mock file. Accepted extensions are ".yml" and ".yaml". Your specified file is ${config.features}`));
95
+
assert.notOk(console.warn.called,'warn should not be called');
96
+
assert.ok(console.info.called,'info should be called');
97
+
assert.ok(console.debug.called,'debug should be called');
0 commit comments