Debian Codegraph @

debian/tests/network

raw
1 #!/bin/sh
2 set -e
3 DIR=$(mktemp -d)
4 trap "rm -rf $DIR" EXIT
5 cd "$DIR"
6 pkgjs-ln form-data
7 pkgjs-ln follow-redirects
8 pkgjs-ln proxy-from-env
9 pkgjs-ln axios
10
11 node -e '
12 const assert = require("assert");
13 const axios = require("axios");
14
15 (async () => {
16 const res = await axios.get("https://www.debian.org/");
17 assert.strictEqual(res.status, 200, "GET https://www.debian.org/ should return status 200");
18 assert.ok(typeof res.data === "string" && res.data.length > 0, "response body should be a non-empty string");
19 assert.ok(res.headers, "response headers should be set");
20 console.log("CJS network test passed (GET https://www.debian.org/)");
21 })().catch((err) => {
22 console.error(err);
23 process.exit(1);
24 });
25 '
26
27 node --input-type=module -e '
28 import assert from "assert";
29 import axios from "axios";
30
31 const res = await axios.get("https://www.debian.org/");
32 assert.strictEqual(res.status, 200, "GET https://www.debian.org/ should return status 200");
33 assert.ok(typeof res.data === "string" && res.data.length > 0, "response body should be a non-empty string");
34 console.log("ESM network test passed (GET https://www.debian.org/)");
35 '