diff options
author | 2022-06-22 23:21:48 -0700 | |
---|---|---|
committer | 2022-06-22 23:21:48 -0700 | |
commit | 729d445b6885f69dd2c6355f38707bd42851c791 (patch) | |
tree | f87a7c408929ea3f57bbb7ace380cf869da83c0e /integration/bunjs-only-snippets/url.test.ts | |
parent | 25f820c6bf1d8ec6d444ef579cc036b8c0607b75 (diff) | |
download | bun-jarred/rename.tar.gz bun-jarred/rename.tar.zst bun-jarred/rename.zip |
change the directory structurejarred/rename
Diffstat (limited to 'integration/bunjs-only-snippets/url.test.ts')
-rw-r--r-- | integration/bunjs-only-snippets/url.test.ts | 102 |
1 files changed, 0 insertions, 102 deletions
diff --git a/integration/bunjs-only-snippets/url.test.ts b/integration/bunjs-only-snippets/url.test.ts deleted file mode 100644 index 37ea2008b..000000000 --- a/integration/bunjs-only-snippets/url.test.ts +++ /dev/null @@ -1,102 +0,0 @@ -import { describe, it, expect } from "bun:test"; - -describe("url", () => { - it("prints", () => { - expect(Bun.inspect(new URL("https://example.com"))).toBe( - "https://example.com/" - ); - - expect( - Bun.inspect( - new URL( - "https://github.com/Jarred-Sumner/bun/issues/135?hello%20i%20have%20spaces%20thank%20you%20good%20night" - ) - ) - ).toBe( - "https://github.com/Jarred-Sumner/bun/issues/135?hello%20i%20have%20spaces%20thank%20you%20good%20night" - ); - }); - it("works", () => { - const inputs: [ - [ - string, - { - hash: string; - host: string; - hostname: string; - href: string; - origin: string; - password: string; - pathname: string; - port: string; - protocol: string; - search: string; - username: string; - } - ] - ] = [ - [ - "https://username:password@api.foo.bar.com:9999/baz/okay/i/123?ran=out&of=things#to-use-as-a-placeholder", - { - hash: "#to-use-as-a-placeholder", - host: "api.foo.bar.com:9999", - hostname: "api.foo.bar.com", - href: "https://username:password@api.foo.bar.com:9999/baz/okay/i/123?ran=out&of=things#to-use-as-a-placeholder", - origin: "https://api.foo.bar.com:9999", - password: "password", - pathname: "/baz/okay/i/123", - port: "9999", - protocol: "https:", - search: "?ran=out&of=things", - username: "username", - }, - ], - [ - "https://url.spec.whatwg.org/#url-serializing", - { - hash: "#url-serializing", - host: "url.spec.whatwg.org", - hostname: "url.spec.whatwg.org", - href: "https://url.spec.whatwg.org/#url-serializing", - origin: "https://url.spec.whatwg.org", - password: "", - pathname: "/", - port: "", - protocol: "https:", - search: "", - username: "", - }, - ], - [ - "https://url.spec.whatwg.org#url-serializing", - { - hash: "#url-serializing", - host: "url.spec.whatwg.org", - hostname: "url.spec.whatwg.org", - href: "https://url.spec.whatwg.org/#url-serializing", - origin: "https://url.spec.whatwg.org", - password: "", - pathname: "/", - port: "", - protocol: "https:", - search: "", - username: "", - }, - ], - ]; - - for (let [url, values] of inputs) { - const result = new URL(url); - expect(result.hash).toBe(values.hash); - expect(result.host).toBe(values.host); - expect(result.hostname).toBe(values.hostname); - expect(result.href).toBe(values.href); - expect(result.password).toBe(values.password); - expect(result.pathname).toBe(values.pathname); - expect(result.port).toBe(values.port); - expect(result.protocol).toBe(values.protocol); - expect(result.search).toBe(values.search); - expect(result.username).toBe(values.username); - } - }); -}); |