@wenathlan/argan 2.0.89 → 2.0.94

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wenathlan/argan",
3
- "version": "2.0.89",
3
+ "version": "2.0.94",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/wenathlan/devthink"
@@ -37,7 +37,8 @@
37
37
  "build": "vite build",
38
38
  "start": "vite preview --host",
39
39
  "preview": "vite preview --host",
40
- "check": "tsc --noEmit"
40
+ "check": "tsc --noEmit",
41
+ "test": "vitest run"
41
42
  },
42
43
  "dependencies": {
43
44
  "@hono/node-server": "^2.1.3",
@@ -1,11 +1,13 @@
1
1
  // # dnssec.test — honest unit tests for the DNSSEC validation math, runnable
2
- // with the node built-in runner (no install, no dependencies):
3
- // node --test tests/dnssec.test.ts
2
+ // with the vitest runner:
3
+ // pnpm test
4
4
  import assert from "node:assert/strict";
5
- import { describe, it } from "node:test";
5
+ import { describe, it } from "vitest";
6
6
  import {
7
7
  DNSSECALGORITHMS,
8
8
  DNSSECDIGESTTYPES,
9
+ type DnsKey,
10
+ DnssecValidationError,
9
11
  keyTag,
10
12
  parseRrSig,
11
13
  validateChainLink,
@@ -13,8 +15,6 @@ import {
13
15
  validateSignatureLabels,
14
16
  validateSignatureTtl,
15
17
  validateSignatureWindow,
16
- DnssecValidationError,
17
- type DnsKey,
18
18
  } from "../dnssec.ts";
19
19
 
20
20
  /** A small DNSKEY whose key tag was computed by hand from the RFC 4034 Appendix B loop. */
@@ -41,10 +41,7 @@ describe("dnssec presentation parsing", () => {
41
41
  assert.throws(() => parseRrSig("A 8 3"), DnssecValidationError);
42
42
  assert.throws(() => parseRrSig("A 8 3 300 2026 20260101000000 1 example.com. aa"), DnssecValidationError);
43
43
  // expiration before inception is structurally impossible
44
- assert.throws(
45
- () => parseRrSig("A 8 3 300 20260101000000 20261231235959 1 example.com. aa"),
46
- DnssecValidationError,
47
- );
44
+ assert.throws(() => parseRrSig("A 8 3 300 20260101000000 20261231235959 1 example.com. aa"), DnssecValidationError);
48
45
  });
49
46
  });
50
47
 
@@ -75,10 +72,16 @@ describe("dnssec key tag and chain math", () => {
75
72
  assert.equal(unknownAlgorithm.ok ? "" : unknownAlgorithm.code, "unknown-algorithm");
76
73
  // flags and protocol are part of the rdata, so each mutation recomputes its own DS tag
77
74
  const strippedKey = { ...ZONEKEY, flags: 1 };
78
- const noZoneKey = validateDsMatch({ keyTag: keyTag(strippedKey), algorithm: 8, digestType: 2, digest: "aa" }, strippedKey);
75
+ const noZoneKey = validateDsMatch(
76
+ { keyTag: keyTag(strippedKey), algorithm: 8, digestType: 2, digest: "aa" },
77
+ strippedKey,
78
+ );
79
79
  assert.equal(noZoneKey.ok ? "" : noZoneKey.code, "not-a-zone-key");
80
80
  const oldProtocolKey = { ...ZONEKEY, protocol: 2 };
81
- const badProtocol = validateDsMatch({ keyTag: keyTag(oldProtocolKey), algorithm: 8, digestType: 2, digest: "aa" }, oldProtocolKey);
81
+ const badProtocol = validateDsMatch(
82
+ { keyTag: keyTag(oldProtocolKey), algorithm: 8, digestType: 2, digest: "aa" },
83
+ oldProtocolKey,
84
+ );
82
85
  assert.equal(badProtocol.ok ? "" : badProtocol.code, "protocol-mismatch");
83
86
  });
84
87
  });
@@ -109,7 +112,11 @@ describe("dnssec clock and ttl windows", () => {
109
112
  assert.deepEqual(validateSignatureTtl(sig, 300, 300), { ok: true });
110
113
  const mismatch = validateSignatureTtl(sig, 600, 300);
111
114
  assert.equal(mismatch.ok ? "" : mismatch.code, "ttl-mismatch");
112
- const ceiling = validateSignatureTtl(parseRrSig("A 8 3 60 20261231235959 20260101000000 1 example.com. aa"), 300, 300);
115
+ const ceiling = validateSignatureTtl(
116
+ parseRrSig("A 8 3 60 20261231235959 20260101000000 1 example.com. aa"),
117
+ 300,
118
+ 300,
119
+ );
113
120
  assert.equal(ceiling.ok ? "" : ceiling.code, "ttl-exceeds-original");
114
121
  });
115
122
 
@@ -1,8 +1,8 @@
1
- // # zonediff.test — honest unit tests for the zone diff, runnable with the node
2
- // built-in runner (no install, no dependencies):
3
- // node --test tests/zonediff.test.ts
1
+ // # zonediff.test — honest unit tests for the zone diff, runnable with the
2
+ // vitest runner:
3
+ // pnpm test
4
4
  import assert from "node:assert/strict";
5
- import { describe, it } from "node:test";
5
+ import { describe, it } from "vitest";
6
6
  import { nextSerial } from "../argan.ts";
7
7
  import {
8
8
  diffZoneFiles,
@@ -126,8 +126,14 @@ describe("zonediff planner", () => {
126
126
  });
127
127
 
128
128
  it("never changes on round robin order and reports ttl-only updates", () => {
129
- const current = [record("api.example.com.", "A", 300, "192.0.2.1"), record("api.example.com.", "A", 300, "192.0.2.2")];
130
- const reordered = [record("api.example.com.", "A", 300, "192.0.2.2"), record("api.example.com.", "A", 300, "192.0.2.1")];
129
+ const current = [
130
+ record("api.example.com.", "A", 300, "192.0.2.1"),
131
+ record("api.example.com.", "A", 300, "192.0.2.2"),
132
+ ];
133
+ const reordered = [
134
+ record("api.example.com.", "A", 300, "192.0.2.2"),
135
+ record("api.example.com.", "A", 300, "192.0.2.1"),
136
+ ];
131
137
  assert.deepEqual(diffZones(current, reordered), { creates: [], deletes: [], updates: [] });
132
138
  const rettl = current.map((entry) => record(entry.name, entry.type, 600, entry.data));
133
139
  const diff = diffZones(current, rettl);