mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 07:14:47 -05:00
test(ext/node): add querystring_test.ts and readline_test.ts (#18256)
This commit is contained in:
parent
472c06b92e
commit
3b1cb8af69
2 changed files with 44 additions and 0 deletions
30
cli/tests/unit_node/querystring_test.ts
Normal file
30
cli/tests/unit_node/querystring_test.ts
Normal file
|
@ -0,0 +1,30 @@
|
|||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
import { assertEquals } from "../../../test_util/std/testing/asserts.ts";
|
||||
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"],
|
||||
});
|
||||
},
|
||||
});
|
14
cli/tests/unit_node/readline_test.ts
Normal file
14
cli/tests/unit_node/readline_test.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
import { createInterface, Interface } from "node:readline";
|
||||
import { assertInstanceOf } from "../../../test_util/std/testing/asserts.ts";
|
||||
import { Readable, Writable } from "node:stream";
|
||||
|
||||
Deno.test("[node/readline] createInstance", () => {
|
||||
const rl = createInterface({
|
||||
input: new Readable({ read() {} }),
|
||||
output: new Writable(),
|
||||
});
|
||||
|
||||
// deno-lint-ignore no-explicit-any
|
||||
assertInstanceOf(rl, Interface as any);
|
||||
});
|
Loading…
Reference in a new issue