mirror of
https://github.com/coleam00/Archon
synced 2026-04-21 13:37:41 +00:00
test(workflows): add missing boundary cases for context variable substitution
Add three new test cases that complete coverage of the word-boundary fix from #1112: $ISSUE_CONTEXT with suffix variants, $ISSUE_CONTEXT with multiple suffixes, and contextSubstituted=false for suffix-only prompts. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
2b0adc24cf
commit
148b474191
1 changed files with 30 additions and 2 deletions
|
|
@ -169,7 +169,7 @@ describe('substituteWorkflowVariables', () => {
|
|||
|
||||
it('does not treat context variables as prefixes of longer identifiers', () => {
|
||||
const { prompt, contextSubstituted } = substituteWorkflowVariables(
|
||||
'Context: $CONTEXT. File: $CONTEXT_FILE. External path: $EXTERNAL_CONTEXT_PATH',
|
||||
'Context: $CONTEXT. File: $CONTEXT_FILE. External path: $EXTERNAL_CONTEXT_PATH. IssueId: $ISSUE_CONTEXT_ID',
|
||||
'run-1',
|
||||
'msg',
|
||||
'/tmp',
|
||||
|
|
@ -178,11 +178,39 @@ describe('substituteWorkflowVariables', () => {
|
|||
'context-data'
|
||||
);
|
||||
expect(prompt).toBe(
|
||||
'Context: context-data. File: $CONTEXT_FILE. External path: $EXTERNAL_CONTEXT_PATH'
|
||||
'Context: context-data. File: $CONTEXT_FILE. External path: $EXTERNAL_CONTEXT_PATH. IssueId: $ISSUE_CONTEXT_ID'
|
||||
);
|
||||
expect(contextSubstituted).toBe(true);
|
||||
});
|
||||
|
||||
it('does not substitute $ISSUE_CONTEXT when followed by identifier characters', () => {
|
||||
const { prompt } = substituteWorkflowVariables(
|
||||
'Issue: $ISSUE_CONTEXT. ID: $ISSUE_CONTEXT_ID. Type: $ISSUE_CONTEXT_TYPE',
|
||||
'run-1',
|
||||
'msg',
|
||||
'/tmp',
|
||||
'main',
|
||||
'docs/',
|
||||
'context-data'
|
||||
);
|
||||
expect(prompt).toBe('Issue: context-data. ID: $ISSUE_CONTEXT_ID. Type: $ISSUE_CONTEXT_TYPE');
|
||||
});
|
||||
|
||||
it('does not set contextSubstituted when only suffix-extended context vars are present', () => {
|
||||
const { prompt, contextSubstituted } = substituteWorkflowVariables(
|
||||
'Path: $CONTEXT_FILE',
|
||||
'run-1',
|
||||
'msg',
|
||||
'/tmp',
|
||||
'main',
|
||||
'docs/',
|
||||
'context-data'
|
||||
);
|
||||
// $CONTEXT_FILE is not a context variable — should be left untouched
|
||||
expect(prompt).toBe('Path: $CONTEXT_FILE');
|
||||
expect(contextSubstituted).toBe(false);
|
||||
});
|
||||
|
||||
it('clears context variables when issueContext is undefined', () => {
|
||||
const { prompt, contextSubstituted } = substituteWorkflowVariables(
|
||||
'Context: $CONTEXT here',
|
||||
|
|
|
|||
Loading…
Reference in a new issue