Skip to content

Commit 29697bf

Browse files
authored
fix(shell-api): ensure deprecation is handled in tests (#888)
1 parent 93b16d6 commit 29697bf

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/cli-repl/src/setup-logger-and-telemetry.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ describe('setupLoggerAndTelemetry', () => {
243243

244244
it('buffers deprecated API calls', () => {
245245
setupLoggerAndTelemetry(logId, bus, () => logger, () => analytics);
246-
expect(logOutput).to.be.empty;
246+
expect(logOutput).to.have.lengthOf(1);
247247
expect(analyticsOutput).to.be.empty;
248248

249249
const mongosh_version = require('../package.json').version;

packages/shell-api/src/decorators.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ function wrapWithApiChecks<T extends(...args: any[]) => any>(fn: T, className: s
181181
}
182182

183183
function checkForDeprecation(internalState: ShellInternalState | undefined, className: string, fn: any) {
184-
if (internalState && typeof fn === 'function' && fn.deprecated) {
184+
if (internalState && typeof internalState.emitDeprecatedApiCall === 'function' && typeof fn === 'function' && fn.deprecated) {
185185
internalState.emitDeprecatedApiCall({
186186
method: fn.name,
187187
class: className

0 commit comments

Comments
 (0)