mirror of
https://github.com/denoland/deno.git
synced 2025-01-20 20:42:19 -05:00
test(ext/dns): Test for dns resolving
This commit is contained in:
parent
e9a1b8e83a
commit
3bc7642dcf
1 changed files with 24 additions and 0 deletions
24
tests/unit/dns_test.ts
Normal file
24
tests/unit/dns_test.ts
Normal file
|
@ -0,0 +1,24 @@
|
|||
// Copyright 2018-2025 the Deno authors. MIT license.
|
||||
|
||||
import { resolve4, resolve6 } from "node:dns/promises";
|
||||
import { assertEquals } from "@std/assert/equals";
|
||||
|
||||
Deno.test({
|
||||
name: "Dns resolving for ttl values, A and AAAA records",
|
||||
async fn() {
|
||||
const ARecord = "34.120.54.55";
|
||||
const AAAARecord = "2600:1901::6d85::";
|
||||
|
||||
const ARes1 = await Deno.resolveDns("deno.com", "A", { ttl: true });
|
||||
const ARes2 = await resolve4("deno.com", { ttl: true });
|
||||
|
||||
assertEquals(ARes1[0].data, ARecord);
|
||||
assertEquals(ARes2[0].address, ARecord);
|
||||
|
||||
const AAAARes1 = await Deno.resolveDns("deno.com", "AAAA", { ttl: true });
|
||||
const AAAARes2 = await resolve6("deno.com", { ttl: true });
|
||||
|
||||
assertEquals(AAAARes1[0].data, AAAARecord);
|
||||
assertEquals(AAAARes2[0].address, AAAARecord);
|
||||
},
|
||||
});
|
Loading…
Add table
Reference in a new issue