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
+6
-5
@@ -1,7 +1,8 @@
|
||||
import ava from "ava";
|
||||
import test from "node:test";
|
||||
import assert from "node:assert";
|
||||
import { parsePing } from "../lib/ping";
|
||||
|
||||
ava("linux Case-1", (t) => {
|
||||
void test("linux Case-1", () => {
|
||||
const platform = "linux";
|
||||
const stdout =
|
||||
"PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data\n64 bytes from 8.8.8.8: icmp_seq=1 ttl=118 time=6.66 ms\n64 bytes from 8.8.8.8: icmp_seq=2 ttl=118 time=6.50 ms\n64 bytes from 8.8.8.8: icmp_seq=3 ttl=118 time=6.38 ms\n\n--- 8.8.8.8 ping statistics ---\n3 packets transmitted, 3 received, 0% packet loss, time 402ms\nrtt min/avg/max/mdev = 6.381/6.511/6.656/0.112 ms";
|
||||
@@ -15,10 +16,10 @@ ava("linux Case-1", (t) => {
|
||||
mdev: 0.112,
|
||||
};
|
||||
const parsed = parsePing(platform, stdout);
|
||||
t.deepEqual(parsedResult, parsed);
|
||||
assert.deepStrictEqual(parsedResult, parsed);
|
||||
});
|
||||
|
||||
ava("linux Case-2", (t) => {
|
||||
void test("linux Case-2", () => {
|
||||
const platform = "linux";
|
||||
const stdout =
|
||||
"PING 10.251.9.108 (10.251.9.108): 56 data bytes\n64 bytes from 10.251.9.108: icmp_seq=0 ttl=57 time=36.758 ms\n64 bytes from 10.251.9.108: icmp_seq=1 ttl=57 time=69.094 ms\n64 bytes from 10.251.9.108: icmp_seq=2 ttl=57 time=28.868 ms\n--- 10.251.9.108 ping statistics ---3 packets transmitted, 3 packets received, 0% packet loss\nround-trip min/avg/max/stddev = 28.868/44.907/69.094/17.404 ms";
|
||||
@@ -32,5 +33,5 @@ ava("linux Case-2", (t) => {
|
||||
mdev: 17.404,
|
||||
};
|
||||
const parsed = parsePing(platform, stdout);
|
||||
t.deepEqual(parsedResult, parsed);
|
||||
assert.deepStrictEqual(parsedResult, parsed);
|
||||
});
|
||||
Reference in new issue
Block a user