diff options
author | 2023-02-19 00:44:29 +0100 | |
---|---|---|
committer | 2023-02-18 15:44:29 -0800 | |
commit | 8aa6ee5332f793a13269ad884d99b9711fedb091 (patch) | |
tree | 1ef816eb00767356e1cd9738adf0f931d0a692f6 /test/bun.js | |
parent | 963bb54e87ca851fef6eb7160fb7c0c6a53088d4 (diff) | |
download | bun-8aa6ee5332f793a13269ad884d99b9711fedb091.tar.gz bun-8aa6ee5332f793a13269ad884d99b9711fedb091.tar.zst bun-8aa6ee5332f793a13269ad884d99b9711fedb091.zip |
fix: Print URL as object in (#2104)
Diffstat (limited to 'test/bun.js')
-rw-r--r-- | test/bun.js/url.test.ts | 62 |
1 files changed, 60 insertions, 2 deletions
diff --git a/test/bun.js/url.test.ts b/test/bun.js/url.test.ts index 96640c1f9..19e10b262 100644 --- a/test/bun.js/url.test.ts +++ b/test/bun.js/url.test.ts @@ -2,13 +2,71 @@ 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://example.com"))).toBe(`URL { + href: "https://example.com/", + origin: "https://example.com", + protocol: "https:", + username: "", + password: "", + host: "example.com", + hostname: "example.com", + port: "", + pathname: "/", + hash: "", + search: "", + searchParams: URLSearchParams { + append: [Function: append], + delete: [Function: delete], + get: [Function: get], + getAll: [Function: getAll], + has: [Function: has], + set: [Function: set], + sort: [Function: sort], + entries: [Function: entries], + keys: [Function: keys], + values: [Function: values], + forEach: [Function: forEach], + toString: [Function: toString], + [Symbol(Symbol.iterator)]: [Function: entries] + }, + toJSON: [Function: toJSON], + toString: [Function: toString] +}`); expect( Bun.inspect( new URL("https://github.com/oven-sh/bun/issues/135?hello%20i%20have%20spaces%20thank%20you%20good%20night"), ), - ).toBe("https://github.com/oven-sh/bun/issues/135?hello%20i%20have%20spaces%20thank%20you%20good%20night"); + ).toBe(`URL { + href: "https://github.com/oven-sh/bun/issues/135?hello%20i%20have%20spaces%20thank%20you%20good%20night", + origin: "https://github.com", + protocol: "https:", + username: "", + password: "", + host: "github.com", + hostname: "github.com", + port: "", + pathname: "/oven-sh/bun/issues/135", + hash: "", + search: "?hello%20i%20have%20spaces%20thank%20you%20good%20night", + searchParams: URLSearchParams { + append: [Function: append], + delete: [Function: delete], + get: [Function: get], + getAll: [Function: getAll], + has: [Function: has], + set: [Function: set], + sort: [Function: sort], + entries: [Function: entries], + keys: [Function: keys], + values: [Function: values], + forEach: [Function: forEach], + toString: [Function: toString], + [Symbol(Symbol.iterator)]: [Function: entries] + }, + toJSON: [Function: toJSON], + toString: [Function: toString] +}`); }); it("works", () => { const inputs = [ |