forked from oven-sh/bun
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fixes oven-sh#7827 * Add some assertions and errors --------- Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
- Loading branch information
1 parent
2b09347
commit 1f90608
Showing
3 changed files
with
108 additions
and
28 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
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
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,22 @@ | ||
import { test, expect, jest } from "bun:test"; | ||
|
||
test("#7827", () => { | ||
for (let i = 0; i < 10; i++) | ||
(function () { | ||
const element = jest.fn(element => { | ||
element.tagName; | ||
}); | ||
const rewriter = new HTMLRewriter().on("p", { | ||
element, | ||
}); | ||
|
||
const content = "<p>Lorem ipsum!</p>"; | ||
|
||
rewriter.transform(new Response(content)); | ||
rewriter.transform(new Response(content)); | ||
|
||
expect(element).toHaveBeenCalledTimes(2); | ||
})(); | ||
|
||
Bun.gc(true); | ||
}); |