chore: fix promisify helper (#16544)
* chore: fix promise deprecation helper * fix deprecations * update deprecation tests
This commit is contained in:
parent
63bf370cc0
commit
5a35c3a279
12 changed files with 65 additions and 48 deletions
|
@ -138,7 +138,7 @@ describe('deprecations', () => {
|
|||
|
||||
it('acts as a pass-through for promise-based invocations', async () => {
|
||||
enableCallbackWarnings()
|
||||
promiseFunc = deprecate.promisify(promiseFunc, 1)
|
||||
promiseFunc = deprecate.promisify(promiseFunc)
|
||||
|
||||
const actual = await promiseFunc(expected)
|
||||
expect(actual).to.equal(expected)
|
||||
|
@ -147,12 +147,11 @@ describe('deprecations', () => {
|
|||
|
||||
it('warns exactly once for callback-based invocations', (done) => {
|
||||
enableCallbackWarnings()
|
||||
promiseFunc = deprecate.promisify(promiseFunc, 1)
|
||||
promiseFunc = deprecate.promisify(promiseFunc)
|
||||
|
||||
let callbackCount = 0
|
||||
const invocationCount = 3
|
||||
const callback = (error, actual) => {
|
||||
expect(error).to.be.null()
|
||||
const callback = (actual) => {
|
||||
expect(actual).to.equal(expected)
|
||||
expect(warnings).to.have.lengthOf(1)
|
||||
expect(warnings[0]).to.include('promiseFunc')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue