import { describe, it, expect } from "bun:test"; import { gcTick } from "./gc"; import { escapeHTML } from "bun"; describe("escapeHTML", () => { // The matrix of cases we need to test for: // 1. Works with short strings // 2. Works with long strings // 3. Works with latin1 strings // 4. Works with utf16 strings // 5. Works when the text to escape is somewhere in the middle // 6. Works when the text to escape is in the beginning // 7. Works when the text to escape is in the end // 8. Returns the same string when there's no need to escape it("works", () => { expect(escapeHTML("absolutely nothing to do here")).toBe("absolutely nothing to do here"); expect(escapeHTML("")).toBe("<script>alert(1)</script>"); expect(escapeHTML("<")).toBe("<"); expect(escapeHTML(">")).toBe(">"); expect(escapeHTML("&")).toBe("&"); expect(escapeHTML("'")).toBe("'"); expect(escapeHTML('"')).toBe("""); expect(escapeHTML("\n")).toBe("\n"); expect(escapeHTML("\r")).toBe("\r"); expect(escapeHTML("\t")).toBe("\t"); expect(escapeHTML("\f")).toBe("\f"); expect(escapeHTML("\v")).toBe("\v"); expect(escapeHTML("\b")).toBe("\b"); expect(escapeHTML("\u00A0")).toBe("\u00A0"); expect(escapeHTML("" + "lalala")).toBe( "lalala<script>alert(1)</script>lalala", ); expect(escapeHTML("" + "lalala")).toBe("<script>alert(1)</script>lalala"); expect(escapeHTML("lalala" + "")).toBe("lalala" + "<script>alert(1)</script>"); expect(escapeHTML("What does 😊 mean?")).toBe("What does 😊 mean?"); const output = escapeHTML("What does 😊 mean in text?")).toBe("<div>What does 😊 mean in text?"); expect(escapeHTML(("lalala" + "" + "lalala").repeat(900))).toBe( "lalala<script>alert(1)</script>lalala".repeat(900), ); expect(escapeHTML(("" + "lalala").repeat(900))).toBe( "<script>alert(1)</script>lalala".repeat(900), ); expect(escapeHTML(("lalala" + "").repeat(900))).toBe( ("lalala" + "<script>alert(1)</script>").repeat(900), ); // the positions of the unicode codepoint are important // our simd code for U16 is at 8 bytes, so we need to especially check the boundaries expect(escapeHTML("😊lalala" + "" + "lalala")).toBe( "😊lalala<script>alert(1)</script>lalala", ); expect(escapeHTML("" + "lalala")).toBe("<script>😊alert(1)</script>lalala"); expect(escapeHTML("" + "lalala")).toBe("<script>alert(1)😊</script>lalala"); expect(escapeHTML("" + "😊lalala")).toBe("<script>alert(1)</script>😊lalala"); expect(escapeHTML("" + "lal😊ala")).toBe("<script>alert(1)</script>lal😊ala"); expect(escapeHTML("" + "lal😊ala".repeat(10))).toBe( "<script>alert(1)</script>" + "lal😊ala".repeat(10), ); for (let i = 1; i < 10; i++) expect(escapeHTML("" + "la😊".repeat(i))).toBe( "<script>alert(1)</script>" + "la😊".repeat(i), ); expect(escapeHTML("la😊" + "")).toBe("la😊" + "<script>alert(1)</script>"); expect(escapeHTML(("lalala" + "😊").repeat(1))).toBe( ("lalala" + "<script>alert(1)</script>😊").repeat(1), ); expect(escapeHTML("😊".repeat(100))).toBe("😊".repeat(100)); expect(escapeHTML("😊<".repeat(100))).toBe("😊<".repeat(100)); expect(escapeHTML("<😊>".repeat(100))).toBe("<😊>".repeat(100)); expect(escapeHTML("😊")).toBe("😊"); expect(escapeHTML("😊😊")).toBe("😊😊"); expect(escapeHTML("😊lo")).toBe("😊lo"); expect(escapeHTML("lo😊")).toBe("lo😊"); expect(escapeHTML(" ".repeat(32) + "😊")).toBe(" ".repeat(32) + "😊"); expect(escapeHTML(" ".repeat(32) + "😊😊")).toBe(" ".repeat(32) + "😊😊"); expect(escapeHTML(" ".repeat(32) + "😊lo")).toBe(" ".repeat(32) + "😊lo"); expect(escapeHTML(" ".repeat(32) + "lo😊")).toBe(" ".repeat(32) + "lo😊"); }); }); Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/packages/integrations/vercel/test/fixtures/serverless-prerender/astro.config.mjs (unfollow)
AgeCommit message (Collapse)AuthorFilesLines
2023-07-17Fix vercel build error when passing `includeFiles` (#7677)Gravatar Bjorn Lu 1-1/+4
2023-07-17Fix cloudflare runtime env var handling (#7679)Gravatar Bjorn Lu 5-2/+24
Co-authored-by: Emanuele Stoppa <my.burning@gmail.com> Co-authored-by: Matthew Phillips <matthew@skypack.dev>
2023-07-17Handle flaky tests (#7651)Gravatar Bjorn Lu 6-44/+56
2023-07-14[ci] release (#7658)Gravatar Houston (Bot) 8-14/+16
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-14[ci] formatGravatar natemoo-re 2-4/+4
2023-07-14fix(#7654): exclude @vercel/nft (#7659)Gravatar Nate Moore 3-0/+11
2023-07-14[ci] formatGravatar natemoo-re 2-26/+28
2023-07-14Sitemap should only exclude 404 and 500 pages (#7655)Gravatar Nate Moore 7-29/+60
* fix(#7472): sitemap should only exclude 404 and 500 pages * chore: refactor logic, add test
2023-07-14Revert "Clarify SSR limitations of sitemaps of dynamic routes (#7625)" (#7653)Gravatar Matthew Phillips 1-2/+0
This reverts commit 9352ac65f4d8c44a5d0cf9cccc37a1196da538cf.
2023-07-14[ci] formatGravatar ematipico 1-3/+2
2023-07-14refactor: use SSR manifest in dev (#7587)Gravatar Emanuele Stoppa 8-97/+182
2023-07-14[ci] formatGravatar matthewp 1-2/+1
2023-07-14Clarify SSR limitations of sitemaps of dynamic routes (#7625)Gravatar paulrudy 1-0/+3
While this README doesn't distinguish between SSR mode and static mode (and SSR mode was recently made available for the sitemaps integration), there is one important difference: Dynamic routes that are server-rendered can't be used to create sitemap entries. This note makes that clear.
2023-07-14[ci] release (#7645)astro@2.8.3Gravatar Houston (Bot) 44-85/+77
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-14nit: export props has been unnecessary.. forever (#7646)Gravatar Erika 32-39/+39
2023-07-14fix(squoosh): Fix wrong file path in rotation check (#7650)Gravatar Erika 1-1/+3
2023-07-14[docs] fix link in image integration README (#7649)Gravatar Sarah Rainsberger 1-1/+1
2023-07-14Remove weird changeset symbols (#7648)Gravatar Bjorn Lu 2-2/+2
2023-07-14Refactor merge server config (#7639)Gravatar Bjorn Lu 3-28/+26
2023-07-13[ci] formatGravatar matthewp 4-16/+19
2023-07-13Fixes for redirects config (#7644)Gravatar Matthew Phillips 9-14/+110
* Update redirects static generation based on recs Got some great recommendations on how to handle our HTML written redirect code based on SEO best practices. See https://github.com/withastro/roadmap/issues/466#issuecomment-1595940678 This implements them all. * Fix for using the root path / as a redirect Fixes https://github.com/withastro/astro/issues/7478 * Fix static redirects prefer over dynamic page Fixes https://github.com/withastro/astro/issues/7581
2023-07-13fix(assets): Fix images not following EXIF rotation (#7637)Gravatar Erika 7-8/+46
2023-07-13[ci] formatGravatar Princesseuh 1-1/+1
2023-07-13Allow SVGs when using Assets (#7643)Gravatar Alvin Bryan 8-17/+46
* Allow SVG files when using Assets * Fixed TypeScript error * fix: some small nits and add a test * chore: changeset --------- Co-authored-by: Princesseuh <princssdev@gmail.com>
2023-07-13Convert CLI top-level imports as dynamic imports (#7635)Gravatar Bjorn Lu 4-46/+45
2023-07-13[ci] release (#7624)astro@2.8.2@astrojs/vercel@3.7.1@astrojs/underscore-redirects@0.2.0@astrojs/netlify@2.4.0@astrojs/cloudflare@6.6.1Gravatar Houston (Bot) 49-108/+129
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-13[ci] formatGravatar sarah11918 1-5/+10
2023-07-13[docs] update image integration README (#7633)Gravatar Sarah Rainsberger 1-2/+69
Co-authored-by: Yan Thomas <61414485+Yan-Thomas@users.noreply.github.com>
2023-07-13[ci] formatGravatar bluwy 1-1/+1
2023-07-13Move all CLI commands to their subfolders (#7634)Gravatar Bjorn Lu 7-102/+170
2023-07-13[ci] formatGravatar ematipico 1-2/+2
2023-07-13feat(@astrojs/netlify): add `build.split` support (#7615)Gravatar Emanuele Stoppa 20-35/+234
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
2023-07-13Update turbo cache flow (#7631)Gravatar Bjorn Lu 1-33/+36
2023-07-12Fix `build.excludeMiddleware` default type docs (#7630)Gravatar Yan Thomas 1-1/+1
2023-07-12Refactor config loading (#7622)Gravatar Bjorn Lu 6-151/+90
2023-07-12[ci] formatGravatar bluwy 1-1/+1
2023-07-12feat: bumped typescript-eslint to v6 stable πŸ₯³ (#7626)Gravatar Josh Goldberg ✨ 4-43/+49
2023-07-12fix(@astrojs/vercel): improve file detection (#7621)Gravatar Emanuele Stoppa 16-25/+113
2023-07-11[ci] formatGravatar matthewp 1-1/+1
2023-07-11Fixes Response not being cloneable by middleware (#7623)Gravatar Matthew Phillips 5-0/+37
2023-07-11[ci] release (#7594)astro@2.8.1@astrojs/prefetch@0.3.0@astrojs/markdoc@0.4.2Gravatar Houston (Bot) 50-104/+100
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2023-07-11Filter out astro from `peerDependencies` in `astro add` (#7620)Gravatar Chris Swithinbank 2-1/+7
2023-07-11[ci] formatGravatar bluwy 1-1/+1
2023-07-11Refactor simple CLI commands (#7619)Gravatar Bjorn Lu 12-115/+123
2023-07-10fix: `astro info` command fallback for package manager (#7618)Gravatar Emanuele Stoppa 2-1/+7
2023-07-10Add CLI startup speed benchmark (#7617)Gravatar Bjorn Lu 5-11/+95
2023-07-10[ci] formatGravatar bluwy 1-1/+1