Skip to content

Commit 2b516e9

Browse files
committed
fix: stringify sinon.Call.args[1] before regex test
CI's TypeScript was stricter than the local version and rejected the untyped `c.args[1]` passed to `RegExp.test()`. Wrap in `String(...)` so the tests compile on Node 14/16/18/20 runners. Co-authored-by: Isaac Signed-off-by: samikshya-chand_data <samikshya.chand@databricks.com>
1 parent 7ba52a5 commit 2b516e9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

tests/unit/telemetry/DatabricksTelemetryExporter.test.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,9 @@ describe('DatabricksTelemetryExporter', () => {
308308
await exporter.export([makeMetric()]);
309309
await exporter.export([makeMetric()]);
310310

311-
const warnCalls = logSpy.getCalls().filter((c) => c.args[0] === LogLevel.warn && /Authorization/.test(c.args[1]));
311+
const warnCalls = logSpy
312+
.getCalls()
313+
.filter((c) => c.args[0] === LogLevel.warn && /Authorization/.test(String(c.args[1])));
312314
expect(warnCalls.length).to.equal(1);
313315
});
314316

@@ -327,7 +329,9 @@ describe('DatabricksTelemetryExporter', () => {
327329
headers = {};
328330
await exporter.export([makeMetric()]); // warns again
329331

330-
const warnCalls = logSpy.getCalls().filter((c) => c.args[0] === LogLevel.warn && /Authorization/.test(c.args[1]));
332+
const warnCalls = logSpy
333+
.getCalls()
334+
.filter((c) => c.args[0] === LogLevel.warn && /Authorization/.test(String(c.args[1])));
331335
expect(warnCalls.length).to.equal(2);
332336
});
333337
});

0 commit comments

Comments
 (0)