Migrate from Ava test framework to node:test
This commit is contained in:
1 parent
0c9c027a77
commit
ddb240d542
12 files changed
+146
-4572
No files matched your search
+18
-17
@@ -1,34 +1,35 @@
|
||||
import ava from "ava";
|
||||
import test from "node:test";
|
||||
import assert from "node:assert";
|
||||
import Path from "../lib/common/path";
|
||||
import PathSet from "../lib/common/path-set";
|
||||
|
||||
ava("depth", (t) => {
|
||||
void test("depth", () => {
|
||||
const pathSet = new PathSet();
|
||||
t.is(pathSet.depth, 0);
|
||||
assert.strictEqual(pathSet.depth, 0);
|
||||
pathSet.add(Path.parse(""));
|
||||
t.is(pathSet.depth, 1);
|
||||
assert.strictEqual(pathSet.depth, 1);
|
||||
pathSet.add(Path.parse("a"));
|
||||
t.is(pathSet.depth, 2);
|
||||
assert.strictEqual(pathSet.depth, 2);
|
||||
});
|
||||
|
||||
ava("add", (t) => {
|
||||
void test("add", () => {
|
||||
const pathSet = new PathSet();
|
||||
pathSet.add(Path.parse("a"));
|
||||
pathSet.add(Path.parse("a"));
|
||||
t.is(pathSet.find(Path.parse("a"), true, true, 99).length, 1);
|
||||
assert.strictEqual(pathSet.find(Path.parse("a"), true, true, 99).length, 1);
|
||||
});
|
||||
|
||||
ava("get", (t) => {
|
||||
void test("get", () => {
|
||||
const pathSet = new PathSet();
|
||||
pathSet.add(Path.parse("a.*"));
|
||||
pathSet.add(Path.parse("a.a"));
|
||||
pathSet.add(Path.parse("*.*"));
|
||||
|
||||
t.is(pathSet.get(Path.parse("a.*")).toString(), "a.*");
|
||||
t.is(pathSet.get(Path.parse("*.a")), null);
|
||||
assert.strictEqual(pathSet.get(Path.parse("a.*")).toString(), "a.*");
|
||||
assert.strictEqual(pathSet.get(Path.parse("*.a")), null);
|
||||
});
|
||||
|
||||
ava("find", (t) => {
|
||||
void test("find", () => {
|
||||
const pathSet = new PathSet();
|
||||
pathSet.add(Path.parse("a"));
|
||||
pathSet.add(Path.parse("a.*"));
|
||||
@@ -36,32 +37,32 @@ ava("find", (t) => {
|
||||
pathSet.add(Path.parse("*.a"));
|
||||
pathSet.add(Path.parse("*.*"));
|
||||
|
||||
t.deepEqual(
|
||||
assert.deepStrictEqual(
|
||||
pathSet.find(Path.parse(""), true, true, 1).map((p) => p.toString()),
|
||||
["a"],
|
||||
);
|
||||
|
||||
t.deepEqual(
|
||||
assert.deepStrictEqual(
|
||||
pathSet.find(Path.parse(""), false, false, 2).map((p) => p.toString()),
|
||||
["a", "a.*", "a.a", "*.a", "*.*"],
|
||||
);
|
||||
|
||||
t.deepEqual(
|
||||
assert.deepStrictEqual(
|
||||
pathSet.find(Path.parse("a.*"), false, false).map((p) => p.toString()),
|
||||
["a.*"],
|
||||
);
|
||||
|
||||
t.deepEqual(
|
||||
assert.deepStrictEqual(
|
||||
pathSet.find(Path.parse("a.*"), false, true).map((p) => p.toString()),
|
||||
["a.*", "a.a"],
|
||||
);
|
||||
|
||||
t.deepEqual(
|
||||
assert.deepStrictEqual(
|
||||
pathSet.find(Path.parse("a.*"), true, false).map((p) => p.toString()),
|
||||
["a.*", "*.*"],
|
||||
);
|
||||
|
||||
t.deepEqual(
|
||||
assert.deepStrictEqual(
|
||||
pathSet.find(Path.parse("a.*"), true, true).map((p) => p.toString()),
|
||||
["a.*", "a.a", "*.a", "*.*"],
|
||||
);
|
||||
|
||||
Reference in new issue
Block a user