diff options
author | 2022-03-18 04:37:46 -0700 | |
---|---|---|
committer | 2022-03-18 04:37:46 -0700 | |
commit | 07379ecb4efd4a8b8184f1aff1e456173e2282b2 (patch) | |
tree | 47a1c7ad70b78510dabcaf23df2fdc32b496e322 /integration/bunjs-only-snippets/globals.test.js | |
parent | 257f3f997a3a899a17a91aa341525511f26c5186 (diff) | |
download | bun-07379ecb4efd4a8b8184f1aff1e456173e2282b2.tar.gz bun-07379ecb4efd4a8b8184f1aff1e456173e2282b2.tar.zst bun-07379ecb4efd4a8b8184f1aff1e456173e2282b2.zip |
[bun.js] Fix missing `.prototype` on builtins
Diffstat (limited to 'integration/bunjs-only-snippets/globals.test.js')
-rw-r--r-- | integration/bunjs-only-snippets/globals.test.js | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/integration/bunjs-only-snippets/globals.test.js b/integration/bunjs-only-snippets/globals.test.js new file mode 100644 index 000000000..831bbd93f --- /dev/null +++ b/integration/bunjs-only-snippets/globals.test.js @@ -0,0 +1,38 @@ +import { it, describe, expect } from "bun:test"; + +it("extendable", () => { + const classes = [ + Blob, + TextDecoder, + TextEncoder, + Request, + Response, + Headers, + HTMLRewriter, + Bun.Transpiler, + ]; + // None of these should error + for (let Class of classes) { + var Foo = class extends Class {}; + var bar = new Foo(); + expect(bar instanceof Class).toBe(true); + expect(Class.prototype instanceof Class).toBe(true); + } + expect(true).toBe(true); +}); + +it("name", () => { + const classes = [ + ["Blob", Blob], + ["TextDecoder", TextDecoder], + ["TextEncoder", TextEncoder], + ["Request", Request], + ["Response", Response], + ["Headers", Headers], + ["HTMLRewriter", HTMLRewriter], + ["Transpiler", Bun.Transpiler], + ]; + for (let [name, Class] of classes) { + expect(Class.name).toBe(name); + } +}); |