Skip to content

test: characterize the generated JavaScript extension keyword - #5352

Merged
aaltat merged 2 commits into
MarketSquare:mainfrom
aaltat:js-extension-call-tests
Oct 17, 2026
Merged

aaltat merged 2 commits into
MarketSquare:mainfrom
aaltat:js-extension-call-tests

Conversation

@aaltat

@aaltat aaltat commented Oct 17, 2026

Copy link
Copy Markdown
Member

Summary

Tests only, no production code. They pin what Python sends to Node and how it reads the reply for a generated JavaScript extension keyword, before a follow-up changes the generated keyword to call call_js_keyword and lets call_js_keyword fill defaultTimeout when the caller leaves it out (follow-up to #5318, #5321).

generated keyword (Browser._jskeyword_call)
  signature from the JS function   + defaults: NaN, Infinity, -Infinity, false, null, undefined, "str", 3
  arguments sent                   + *args as one "args" list
                                   + defaultTimeout from a Test scoped timeout
  reply read                       + bodyPart chunks joined (split inside a multi-byte character)
                                   + no result -> None

The tests sit at the Python seam: utest/test_js_extension_call.py with a stub that records CallExtensionKeyword. The repeated setup became pytest fixtures.

Not tested on purpose: a reply carrying json. Node builds every extension response with jsonResponse('', ...), so the last_json branch can't be reached; the follow-up removes it.

Evidence

  • Before: the stub returned [], so no unit test read a reply; *args, JS defaults and a Test scoped timeout were covered only by acceptance tests or not at all (NaN/Infinity).
    After: pytest utest/test_js_extension_call.py: 9 passed. Breaking the join, the None return, *args, the NaN conversion or the timeout in _jskeyword_call fails the six new tests.

Merge Danger

Door: two-way

Blast Radius: none

Unit tests only; nothing ships to users.

🤖 Generated with Claude Code

aaltat and others added 2 commits October 17, 2026 17:00
Pin how the generated keyword reads a streamed result, sends its
varargs, takes its defaults from the JavaScript signature and sends a
Test scoped timeout, before it is changed to call call_js_keyword.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@aaltat
aaltat merged commit 60e3eb4 into MarketSquare:main Oct 17, 2026
30 checks passed
@aaltat
aaltat deleted the js-extension-call-tests branch October 17, 2026 14:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant