refactor: improve function deprecation module (#19012)

* add removeFunction to deprecation module

* clarify deprecate api

* throw error

* change error msg
This commit is contained in:
Micha Hanselmann 2019-07-08 18:01:35 -07:00 committed by Cheng Zhao
parent a90306876e
commit d79e6bbffe
3 changed files with 18 additions and 5 deletions

View file

@ -87,7 +87,7 @@ describe('deprecate', () => {
deprecate.setHandler(m => { msg = m })
function oldFn () { return 'hello' }
const deprecatedFn = deprecate.function(oldFn)
const deprecatedFn = deprecate.removeFunction(oldFn, 'oldFn')
deprecatedFn()
expect(msg).to.be.a('string')
@ -100,7 +100,7 @@ describe('deprecate', () => {
function oldFn () { return 'hello' }
function newFn () { return 'goodbye' }
const deprecatedFn = deprecate.function(oldFn, newFn)
const deprecatedFn = deprecate.renameFunction(oldFn, newFn)
deprecatedFn()
expect(msg).to.be.a('string')