1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-21 23:04:45 -05:00

test(ext/node): add querystring_test.ts and readline_test.ts (#18256)

This commit is contained in:
Sanskar Gauchan 2023-03-19 21:49:11 +11:00 committed by GitHub
parent 472c06b92e
commit 3b1cb8af69
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 44 additions and 0 deletions

View 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"],
});
},
});

View 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);
});