mirror of
https://github.com/oven-sh/bun
synced 2026-02-09 10:28:47 +00:00
29 lines
765 B
JavaScript
29 lines
765 B
JavaScript
import { describe, test } from "bun:test";
|
|
import assert from "node:assert";
|
|
import url from "node:url";
|
|
|
|
describe("url.format", () => {
|
|
// TODO: Support error code.
|
|
test.todo("invalid input", () => {
|
|
const throwsObjsAndReportTypes = [undefined, null, true, false, 0, function () {}, Symbol("foo")];
|
|
|
|
for (const urlObject of throwsObjsAndReportTypes) {
|
|
assert.throws(
|
|
() => {
|
|
url.format(urlObject);
|
|
},
|
|
{
|
|
code: "ERR_INVALID_ARG_TYPE",
|
|
name: "TypeError",
|
|
message: 'The "urlObject" argument must be one of type object or string.',
|
|
},
|
|
);
|
|
}
|
|
});
|
|
|
|
test("empty", () => {
|
|
assert.strictEqual(url.format(""), "");
|
|
assert.strictEqual(url.format({}), "");
|
|
});
|
|
});
|