@jacebenson/jsn 5.5.5-dev.194.1 → 5.5.5-dev.196.1

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/flow-create.js +15 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jacebenson/jsn",
3
- "version": "5.5.5-dev.194.1",
3
+ "version": "5.5.5-dev.196.1",
4
4
  "description": "A command-line interface for ServiceNow that follows the Unix philosophy: simple, composable, and scriptable.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1404,7 +1404,21 @@ function assertStepReadback(definition, expectedSteps, kind, flowId) {
1404
1404
  if (expected.inputs) {
1405
1405
  for (const input of expected.inputs) {
1406
1406
  const found = inputList(actual).filter(i => i.name === input.name);
1407
- if (found.length !== 1 || !requestedContentMatches(found[0], input)) throw new Error(`Flow ${flowId} ${kind} ${expected.uiUniqueIdentifier} input ${input.name} did not match the requested value; preservation failed`);
1407
+ // ProcessFlow reads unwrap GraphQL value envelopes and derive choice
1408
+ // display labels (e.g. info -> Info). Compare the semantic value and
1409
+ // requested metadata, not the transport envelope or rendered label.
1410
+ const { value, displayValue: _displayValue, ...metadata } = input;
1411
+ const savedInput = { ...found[0] };
1412
+ if (metadata.parameter) {
1413
+ // Read-side attributes are a map; GraphQL accepts their string form.
1414
+ metadata.parameter = Object.fromEntries(Object.entries(flowDesignParameter(metadata.parameter)).filter(([, v]) => v !== null));
1415
+ savedInput.parameter = flowDesignParameter(savedInput.parameter);
1416
+ }
1417
+ if (found.length !== 1
1418
+ || !isDeepStrictEqual(inputRawValue(found[0]), inputRawValue(input))
1419
+ || (found[0].value && typeof found[0].value === 'object' && Object.hasOwn(found[0].value, 'schemaless')
1420
+ && !requestedContentMatches(found[0].value, value))
1421
+ || !requestedContentMatches(savedInput, metadata)) throw new Error(`Flow ${flowId} ${kind} ${expected.uiUniqueIdentifier} input ${input.name} did not match the requested value; preservation failed`);
1408
1422
  }
1409
1423
  }
1410
1424
  }