2023-03-19 06:49:11 -04:00
|
|
|
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
2023-10-27 21:24:37 -04:00
|
|
|
import { assertEquals } from "../../../test_util/std/testing/asserts.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"],
|
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|