From f8149321f2770bd3818d11eff5630698853e7af3 Mon Sep 17 00:00:00 2001 From: Lilleman auf Larv Date: Mon, 14 Sep 2026 23:43:49 +0200 Subject: [PATCH] 4.2: the review's runner and weight nits --- docker-runner.sh | 2 +- src/adf-property.test.ts | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/docker-runner.sh b/docker-runner.sh index cf66632..8602e71 100644 --- a/docker-runner.sh +++ b/docker-runner.sh @@ -7,7 +7,7 @@ node_image=node:24.19.0-alpine3.24 in_image() { local image=$1 entrypoint=$2 shift 2 - docker run --rm -u "$(id -u):$(id -g)" -e HOME=/tmp ${PROPERTY_RUNS:+-e PROPERTY_RUNS} ${in_image_network:+--network "$in_image_network"} -v "$PWD:/app" -w /app --entrypoint "$entrypoint" "$image" "$@" + docker run --rm -u "$(id -u):$(id -g)" -e HOME=/tmp ${PROPERTY_RUNS+-e PROPERTY_RUNS} ${in_image_network:+--network "$in_image_network"} -v "$PWD:/app" -w /app --entrypoint "$entrypoint" "$image" "$@" } with_firefox() { diff --git a/src/adf-property.test.ts b/src/adf-property.test.ts index aeed542..4343cb1 100644 --- a/src/adf-property.test.ts +++ b/src/adf-property.test.ts @@ -141,13 +141,11 @@ const positions = fc.letrec((tie) => { .record({ content: listItems, order: fc.oneof({ arbitrary: fc.integer({ max: 3, min: 0 }), weight: 4 }, { arbitrary: fc.integer({ max: 999999999, min: 0 }), weight: 1 }) }) .map(({ content, order }): AdfNode => ({ attrs: { order }, content, type: 'orderedList' })), ] + const flatBlocks = [...weighted(leafBlocks, 2), ...weighted(flatCommonMarkShapes, flatCommonMarkShapeWeight)] return { block: fc.oneof( { depthIdentifier, depthSize: 'small', maxDepth: 4 }, - { - arbitrary: fc.oneof(...weighted(leafBlocks, 2), ...weighted(flatCommonMarkShapes, flatCommonMarkShapeWeight)), - weight: leafBlocks.length * 2 + flatCommonMarkShapes.length * flatCommonMarkShapeWeight, - }, + { arbitrary: fc.oneof(...flatBlocks), weight: flatBlocks.reduce((sum, entry) => sum + entry.weight, 0) }, { arbitrary: fc.oneof(...containerBlocks), weight: containerBlocks.length * 2 }, { arbitrary: fc.oneof(textNode, ...inlineNodes, unknownNode), weight: misplacedWeight }, { arbitrary: fc.oneof(...nestingCommonMarkShapes), weight: nestingCommonMarkShapes.length * nestingCommonMarkShapeWeight },