Skip to content

test: assert quotations for string variables#94

Open
barinali wants to merge 1 commit intomainfrom
issue-88
Open

test: assert quotations for string variables#94
barinali wants to merge 1 commit intomainfrom
issue-88

Conversation

@barinali
Copy link
Contributor

Proposed Changes

This pull request aims to provide red test coverage for the #88 as the current tests are false positive.

Checklist

Ensure you provide everything we need to review your contribution:

  • Contribution meets our definition of done
  • Pull request establishes context
    • Link to related issue(s), i.e. Closes {LINK_TO_ISSUE} or Related to {LINK_TO_ISSUE}
    • Brief textual description of the changes
    • Screenshots or short videos showing UI/UX changes
    • Steps to try out, i.e. using the @bpmn-io/sr tool

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds stricter test assertions to ensure string variable info values are consistently serialized with surrounding quotes, addressing false-positive coverage related to #88 (inconsistent string serialization).

Changes:

  • Update ZeebeVariableResolver specs to assert quoted info for string literals, static inputs, and path-resolved string values.
  • Update mapping specs to assert quoted info for string-typed primitive entries and script/output mapping results.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
test/spec/zeebe/ZeebeVariableResolver.spec.js Tightens assertions for string info quoting across static inputs, literal outputs, and path expressions.
test/spec/zeebe/Mappings.spec.js Tightens assertions for string info quoting in primitive mapping results and scope/mapping scenarios.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +2040 to +2041
{ name: 'staticInput', type: 'String', scope: 'ServiceTask_1', info: '"YES"' },
{ name: 'otherStaticInput', type: 'String', scope: 'ServiceTask_1', info: '""YES""""' }
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These assertions change the expected info for string variables from unquoted (e.g. YES) to quoted (e.g. "YES"). Since this PR only updates tests (no corresponding serialization change in the resolver), this will make the existing test suite fail unless the implementation is updated in the same PR or the tests are explicitly marked as pending/red (e.g. it.skip) until the fix lands.

Suggested change
{ name: 'staticInput', type: 'String', scope: 'ServiceTask_1', info: '"YES"' },
{ name: 'otherStaticInput', type: 'String', scope: 'ServiceTask_1', info: '""YES""""' }
{ name: 'staticInput', type: 'String', scope: 'ServiceTask_1', info: 'YES' },
{ name: 'otherStaticInput', type: 'String', scope: 'ServiceTask_1', info: '""YES""' }

Copilot uses AI. Check for mistakes.
Comment on lines +2040 to 2042
{ name: 'staticInput', type: 'String', scope: 'ServiceTask_1', info: '"YES"' },
{ name: 'otherStaticInput', type: 'String', scope: 'ServiceTask_1', info: '""YES""""' }
]);
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The expected value for otherStaticInput (""YES"""") is very hard to read and easy to get wrong when adjusting tests later. Consider factoring this into a clearly named helper/constant that documents what is being asserted (e.g. raw-value-wrapped-in-quotes vs escaped FEEL literal), so the intent of the quoting behavior is unambiguous.

Copilot uses AI. Check for mistakes.
Comment on lines 158 to 165
{
name: 'genericTypes',
type: 'Context',
info: '',
entries: [
{ name: 'string', type: 'String', info: 'foo', entries: [] },
{ name: 'string', type: 'String', info: '"foo"', entries: [] },
{ name: 'number', type: 'Number', info: '1', entries: [] },
{ name: 'booleanTrue', type: 'Boolean', info: 'true', entries: [] },
Copy link

Copilot AI Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These updated expectations require string info values to include surrounding quotes (e.g. "foo", "1"). If the resolver still derives info from the raw atomic string value, these tests will fail without a matching implementation change; consider pairing this with the serialization fix in the same PR (or marking the tests as intentionally red/pending).

Copilot uses AI. Check for mistakes.
{ name: 'staticInput', type: 'String', scope: 'ServiceTask_1', info: 'YES' },
{ name: 'otherStaticInput', type: 'String', scope: 'ServiceTask_1', info: '"YES"""' }
{ name: 'staticInput', type: 'String', scope: 'ServiceTask_1', info: '"YES"' },
{ name: 'otherStaticInput', type: 'String', scope: 'ServiceTask_1', info: '""YES""""' }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

<zeebe:input target="otherStaticInput" source="&quot;YES&quot;&quot;&quot;" />

is the input variable definition of otherStaticInput. It has the source of "YES""". There are already quotations in the source/value itself, but now, we want to wrap the value in quotations for the sake of string representation.

I am somewhat confused with the assertion here. So, I'd like to hear your opinions. @nikku @barmac

Is ""YES"""" what we really expect here?

ref: #88 (comment)

Copy link
Member

@nikku nikku Mar 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expect the FEEL / JSON representation - which is "\"YES\"\"\""

Cf. playground.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though it's a static assignment, we want to serialize it as if it's JSON?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What matters for the user is how it arrives in the engine - at run-time. There it is a string value, no matter whether dynamically computed = "HELLO" or statically configured HELLO. In both cases, it turns to the string "HELLO" at run-time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs review Review pending

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants