diff options
author | 2022-02-24 00:59:19 -0800 | |
---|---|---|
committer | 2022-02-24 00:59:19 -0800 | |
commit | 8effa394100b26805cc9ca298659f1a5a7c3dda9 (patch) | |
tree | 54fda1f4ab7b8d901c984d25b8d1c3c407a0349b /integration/bunjs-only-snippets/fetch.test.js | |
parent | 5f50de2b390ef1ddfe2e108d285024ef45d4c421 (diff) | |
download | bun-8effa394100b26805cc9ca298659f1a5a7c3dda9.tar.gz bun-8effa394100b26805cc9ca298659f1a5a7c3dda9.tar.zst bun-8effa394100b26805cc9ca298659f1a5a7c3dda9.zip |
[bun.js] Add `ShadowRealm`
Diffstat (limited to 'integration/bunjs-only-snippets/fetch.test.js')
-rw-r--r-- | integration/bunjs-only-snippets/fetch.test.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/integration/bunjs-only-snippets/fetch.test.js b/integration/bunjs-only-snippets/fetch.test.js new file mode 100644 index 000000000..72b80cd35 --- /dev/null +++ b/integration/bunjs-only-snippets/fetch.test.js @@ -0,0 +1,22 @@ +import { it, describe } from "bun:test"; +import fs from "fs"; + +describe("fetch", () => { + const urls = ["https://example.com", "http://example.com"]; + for (let url of urls) { + it(url, async () => { + const response = await fetch(url); + const text = await response.text(); + + if ( + fs.readFileSync( + import.meta.path.substring(0, import.meta.path.lastIndexOf("/")) + + "/fetch.js.txt", + "utf8" + ) !== text + ) { + throw new Error("Expected fetch.js.txt to match snapshot"); + } + }); + } +}); |