-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Restore correct functionToString behavior for updated fill method (
- Loading branch information
1 parent
61385c3
commit a876d46
Showing
3 changed files
with
28 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
packages/core/test/lib/integrations/functiontostring.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { fill } from '../../../../utils/src/object'; | ||
import { FunctionToString } from '../../../src/integrations/functiontostring'; | ||
|
||
describe('FunctionToString', () => { | ||
it('it works as expected', () => { | ||
const foo = { | ||
bar(wat: boolean): boolean { | ||
return wat; | ||
}, | ||
}; | ||
const originalFunction = foo.bar.toString(); | ||
fill(foo, 'bar', function wat(whatever: boolean): () => void { | ||
return function watwat(): boolean { | ||
return whatever; | ||
}; | ||
}); | ||
|
||
expect(foo.bar.toString()).not.toBe(originalFunction); | ||
|
||
const fts = new FunctionToString(); | ||
fts.setupOnce(); | ||
|
||
expect(foo.bar.toString()).toBe(originalFunction); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters