From 7847db3a1e84654e253b02cedb5e1ba5e0ee7f10 Mon Sep 17 00:00:00 2001 From: JamieDanielson Date: Mon, 8 Jan 2024 15:34:59 -0500 Subject: [PATCH] fix tests using assert --- .../test/utils/callback.test.ts | 15 +++++++-------- .../opentelemetry-core/test/utils/promise.test.ts | 3 +-- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/packages/opentelemetry-core/test/utils/callback.test.ts b/packages/opentelemetry-core/test/utils/callback.test.ts index 0cdc07be39..ab8b6a9e39 100644 --- a/packages/opentelemetry-core/test/utils/callback.test.ts +++ b/packages/opentelemetry-core/test/utils/callback.test.ts @@ -17,7 +17,6 @@ import * as assert from 'assert'; import * as sinon from 'sinon'; import { BindOnceFuture } from '../../src/utils/callback.js'; -import { assertRejects } from '../test-utils.js'; describe('callback', () => { describe('BindOnceFuture', () => { @@ -34,7 +33,7 @@ describe('callback', () => { assert.deepStrictEqual(stub.firstCall.args, [1]); assert.deepStrictEqual(stub.firstCall.thisValue, that); - assert(future.isCalled); + assert.ok(future.isCalled); }); it('should handle thrown errors', async () => { @@ -42,9 +41,9 @@ describe('callback', () => { stub.throws(new Error('foo')); const future = new BindOnceFuture(stub, undefined); - await assertRejects(future.call(), /foo/); - await assertRejects(future.call(), /foo/); - await assertRejects(future.promise, /foo/); + await assert.rejects(future.call(), /foo/); + await assert.rejects(future.call(), /foo/); + await assert.rejects(future.promise, /foo/); }); it('should handle rejections', async () => { @@ -52,9 +51,9 @@ describe('callback', () => { stub.rejects(new Error('foo')); const future = new BindOnceFuture(stub, undefined); - await assertRejects(future.call(), /foo/); - await assertRejects(future.call(), /foo/); - await assertRejects(future.promise, /foo/); + await assert.rejects(future.call(), /foo/); + await assert.rejects(future.call(), /foo/); + await assert.rejects(future.promise, /foo/); }); }); }); diff --git a/packages/opentelemetry-core/test/utils/promise.test.ts b/packages/opentelemetry-core/test/utils/promise.test.ts index 1df5abdb68..9aaf96cd04 100644 --- a/packages/opentelemetry-core/test/utils/promise.test.ts +++ b/packages/opentelemetry-core/test/utils/promise.test.ts @@ -16,7 +16,6 @@ import * as assert from 'assert'; import { Deferred } from '../../src/utils/promise.js'; -import { assertRejects } from '../test-utils.js'; describe('promise', () => { describe('Deferred', () => { @@ -35,7 +34,7 @@ describe('promise', () => { deferred.reject(new Error('foo')); deferred.reject(new Error('bar')); - await assertRejects(deferred.promise, /foo/); + await assert.rejects(deferred.promise, /foo/); }); }); });