aboutsummaryrefslogtreecommitdiff
path: root/integration/bunjs-only-snippets
diff options
context:
space:
mode:
Diffstat (limited to 'integration/bunjs-only-snippets')
-rw-r--r--integration/bunjs-only-snippets/response.file.test.js49
1 files changed, 49 insertions, 0 deletions
diff --git a/integration/bunjs-only-snippets/response.file.test.js b/integration/bunjs-only-snippets/response.file.test.js
new file mode 100644
index 000000000..442a527f2
--- /dev/null
+++ b/integration/bunjs-only-snippets/response.file.test.js
@@ -0,0 +1,49 @@
+import fs from "fs";
+import { it, expect } from "bun:test";
+import path from "path";
+it("Response.file", async () => {
+ const file = path.join(import.meta.dir, "fetch.js.txt");
+ expect(await Response.file(file).text()).toBe(fs.readFileSync(file, "utf8"));
+});
+
+it("Response.file as a blob", async () => {
+ const file = path.join(import.meta.url, "../fetch.js.txt");
+ var response = Response.file(file);
+ var blob = await response.blob();
+ expect(blob.size).toBe(0);
+ expect(await blob.text()).toBe(fs.readFileSync(file, "utf8"));
+ expect(blob.size).toBe(1256);
+ expect(await blob.text()).toBe(fs.readFileSync(file, "utf8"));
+
+ const array = new Uint8Array(await blob.arrayBuffer());
+ const text = fs.readFileSync(file, "utf8");
+ for (let i = 0; i < text.length; i++) {
+ expect(array[i]).toBe(text.charCodeAt(i));
+ }
+ expect(blob.size).toBe(1256);
+ blob = null;
+ response = null;
+ Bun.gc(true);
+ await new Promise((resolve) => setTimeout(resolve, 1));
+});
+
+it("Response.file as a blob", async () => {
+ const file = path.join(import.meta.url, "../fetch.js.txt");
+ var response = Response.file(file);
+ var blob = await response.blob();
+
+ expect(blob.size).toBe(0);
+ expect(await blob.text()).toBe(fs.readFileSync(file, "utf8"));
+ expect(blob.size).toBe(1256);
+ expect(await blob.text()).toBe(fs.readFileSync(file, "utf8"));
+ const array = new Uint8Array(await blob.arrayBuffer());
+ const text = fs.readFileSync(file, "utf8");
+ for (let i = 0; i < text.length; i++) {
+ expect(array[i]).toBe(text.charCodeAt(i));
+ }
+ expect(blob.size).toBe(1256);
+ blob = null;
+ response = null;
+ Bun.gc(true);
+ await new Promise((resolve) => setTimeout(resolve, 1));
+});
ercel@3.0.0-beta.1'>refslogtreecommitdiff
path: root/packages/integrations/react (unfollow)
AgeCommit message (Collapse)AuthorFilesLines
2023-01-12[ci] release (beta) (#5792)create-astro@2.0.0-beta.0astro@2.0.0-beta.2@astrojs/webapi@2.0.0-beta.0@astrojs/vue@2.0.0-beta.1@astrojs/vercel@3.0.0-beta.1@astrojs/telemetry@2.0.0-beta.0@astrojs/tailwind@3.0.0-beta.1@astrojs/svelte@2.0.0-beta.1@astrojs/solid-js@2.0.0-beta.0@astrojs/react@2.0.0-beta.0@astrojs/prism@2.0.0-beta.0@astrojs/preact@2.0.0-beta.0@astrojs/partytown@1.0.3-beta.0@astrojs/node@5.0.0-beta.1@astrojs/netlify@2.0.0-beta.2@astrojs/mdx@1.0.0-beta.2@astrojs/markdown-remark@2.0.0-beta.2@astrojs/lit@1.0.2-beta.0@astrojs/image@1.0.0-beta.2@astrojs/deno@4.0.0-beta.2@astrojs/cloudflare@6.0.0-beta.1Gravatar Fred K. Bot 2-1/+7
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-01-12 Add `.astro/` to `.gitignore` in example projects (#5841)Gravatar Chris Swithinbank 24-98/+46
* Delete committed types in with-content example * Add `.astro/` to `.gitignore` in example projects
2023-01-12chore: update changeset for `_astro` directory (#5843)Gravatar Nate Moore 1-2/+2
Co-authored-by: Nate Moore <nate@astro.build>
2023-01-12fix: pass flags to dev (#5840)Gravatar Sam Chen 3-1/+9
* fix: pass flags to dev * add changeset * Update .changeset/eleven-bulldogs-provide.md Co-authored-by: Nate Moore <natemoo-re@users.noreply.github.com>
2023-01-12chore: update changelogs, add changeset for `_astro` directory (#5842)Gravatar Nate Moore 5-18/+10
Co-authored-by: Nate Moore <nate@astro.build>
2023-01-12[ci] formatGravatar natemoo-re 1-1/+1
2023-01-12fix(core): handle encoded characters when matching routes (#5836)Gravatar Nate Moore 8-2/+85
Co-authored-by: Nate Moore <nate@astro.build>
2023-01-12Handle compiler breaking change (#5803)Gravatar Bjorn Lu 12-328/+109
2023-01-12fix shiki css class replace logic in md and mdx integrations (#5837)Gravatar Giuseppe La Torre 3-3/+9
2023-01-11[ci] formatGravatar matthewp 2-2/+2
2023-01-11Simplify HMR handling (#5811)Gravatar Bjorn Lu 8-108/+46
* Simplify HMR handling * Try skip test to reveal other test result * Support virtual files * Fix head injection * Revert CI changes * Bring back normalizeFilename * Refactor * Add changeset
2023-01-11[Content collections] Remove experimental flag (#5825)Gravatar Ben Holmes 27-103/+58
* refactor: remove experimental.cc from core * chore: remove experimental flag from tests * fix: mock contentDir in remark tests * fix: check vfile.path in rel-image-error plugin * fix: move .astro/ excludes to all test/fixtures * fix: include test/**/fixtures in ignore * chore: changeset
2023-01-11[Content collections] Improve content config handling (#5824)Gravatar Ben Holmes 5-58/+78
* fix: always generate types on init * fix: skip type generation when no content dir found * fix: avoid stripping `.ts` for existsSync check * chore: changeset * fix: run type gen when content/ dir added in dev
2023-01-11Run sync as part of `astro check` (#5823)Gravatar Chris Swithinbank 3-2/+13
Co-authored-by: Ben Holmes <hey@bholmes.dev>
2023-01-11[ci] update lockfile (#5815)Gravatar Fred K. Bot 1-257/+256
Co-authored-by: FredKSchott <FredKSchott@users.noreply.github.com>
2023-01-11Fix order-of-execution bug when generating pages (#5822)Gravatar Nate Moore 2-2/+7
* fix: bundle all pages into a single chunk * chore: add changeset Co-authored-by: Nate Moore <nate@astro.build>
2023-01-11Fix `Code.astro` shiki css class replace logic (#5829)Gravatar Giuseppe La Torre 2-1/+6