@riddledc/riddle-proof 0.7.125 → 0.7.127

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/dist/cli.js CHANGED
@@ -12,7 +12,7 @@ import {
12
12
  profileStatusExitCode,
13
13
  resolveRiddleProofProfileTargetUrl,
14
14
  resolveRiddleProofProfileTimeoutSec
15
- } from "./chunk-JVZWSI55.js";
15
+ } from "./chunk-JLINSUKO.js";
16
16
  import {
17
17
  createRiddleApiClient,
18
18
  parseRiddleViewport
@@ -741,6 +741,21 @@ function profileHttpStatusAssertionKeys(evidence, viewports, field) {
741
741
  }
742
742
  return [...keys];
743
743
  }
744
+ function profileHttpStatusJsonAssertionCount(viewports) {
745
+ if (!viewports.length) return void 0;
746
+ let passed = 0;
747
+ let total = 0;
748
+ for (const viewport of viewports) {
749
+ if (!Array.isArray(viewport.body_json_assertions)) continue;
750
+ for (const assertion of viewport.body_json_assertions) {
751
+ const record = cliRecord(assertion);
752
+ if (!record) continue;
753
+ total += 1;
754
+ if (record.ok === true) passed += 1;
755
+ }
756
+ }
757
+ return total ? { passed, total } : void 0;
758
+ }
744
759
  function profileHttpStatusSummaryMarkdown(result) {
745
760
  const httpStatusChecks = result.checks.filter((check) => check.type === "http_status");
746
761
  const lines = [];
@@ -771,10 +786,12 @@ function profileHttpStatusSummaryMarkdown(result) {
771
786
  profileHttpStatusAssertionKeys(evidence, viewports, "body_not_patterns"),
772
787
  false
773
788
  );
789
+ const bodyJsonAssertions = profileHttpStatusJsonAssertionCount(viewports);
774
790
  const bodyParts = [
775
791
  bodyContains ? `body_contains ${bodyContains.passed}/${bodyContains.total}` : "",
776
792
  bodyNotContains ? `body_not_contains clean ${bodyNotContains.passed}/${bodyNotContains.total}` : "",
777
- bodyNotPatterns ? `body_not_patterns clean ${bodyNotPatterns.passed}/${bodyNotPatterns.total}` : ""
793
+ bodyNotPatterns ? `body_not_patterns clean ${bodyNotPatterns.passed}/${bodyNotPatterns.total}` : "",
794
+ bodyJsonAssertions ? `body_json_assertions ${bodyJsonAssertions.passed}/${bodyJsonAssertions.total}` : ""
778
795
  ].filter(Boolean);
779
796
  lines.push(
780
797
  `- ${label}: ${method}${url ? ` ${markdownInlineCode(url)}` : ""}, statuses ${statuses.length ? statuses.join("/") : "unknown"}${bodyParts.length ? `, ${bodyParts.join(", ")}` : ""}, failures ${failedTotal}`