2023-03-19 06:49:11 -04:00
|
|
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
2023-11-21 20:03:03 -05:00
|
|
|
import { assertEquals } from "../../../test_util/std/assert/mod.ts";
|
2023-03-19 06:49:11 -04:00
|
|
|
import { parse, stringify } from "node:querystring";
|
|
|
|
|
|
|
|
Deno.test({
|
|
|
|
name: "stringify",
|
|
|
|
fn() {
|
|
|
|
assertEquals(
|
|
|
|
stringify({
|
|
|
|
a: "hello",
|
|
|
|
b: 5,
|
|
|
|
c: true,
|
|
|
|
d: ["foo", "bar"],
|
|
|
|
}),
|
|
|
|
"a=hello&b=5&c=true&d=foo&d=bar",
|
|
|
|
);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
Deno.test({
|
|
|
|
name: "parse",
|
|
|
|
fn() {
|
|
|
|
assertEquals(parse("a=hello&b=5&c=true&d=foo&d=bar"), {
|
|
|
|
a: "hello",
|
|
|
|
b: "5",
|
|
|
|
c: "true",
|
|
|
|
d: ["foo", "bar"],
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|