File size: 449 Bytes
0e759d2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import CacheableLookup from "cacheable-lookup";
import https from "node:https";
import axios from "axios";

describe("DNS", () => {
  it("cached dns", async () => {
    const cachedDns = new CacheableLookup();
    cachedDns.install(https.globalAgent);
    jest.spyOn(cachedDns, "lookupAsync");

    const res = await axios.get("https://example.com");
    expect(res.status).toBe(200);
    expect(cachedDns.lookupAsync).toHaveBeenCalled();
  });
});