Skip to content

test(Opencode): Even more tests of potential inputs for the /associate command including error checking and in project verification - #30

Merged
carnegiedude merged 2 commits into
npeters/associate-testsfrom
npeters/associate-tests2
Oct 9, 2026
Merged

carnegiedude merged 2 commits into
npeters/associate-testsfrom
npeters/associate-tests2

Conversation

@carnegiedude

Copy link
Copy Markdown
Contributor

Issue for this PR

#13

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

This PR adds 7 additional tests of the /associate function.
They cover the following cases:
Single quoted paths with surrounding whitespace
The Session Event Error is validated
Built in command metadata and arguments are present
In-project files are accepted
Out-of-project files are rejected
If the link is broken the file is rejected
Other potential associate command do not inherit from /associate

How did you verify your code works?

From packages/opencode I ran:
bun test/test/session/prompt.test.ts --test-name-pattern associate
bun typecheck

The first command resulted in 17 passing tests with 60 expect calls in one file.
The type check did not raise any errors.

Screenshots / recordings

Not applicable. This PR contains tests only.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@carnegiedude
carnegiedude added this pull request to stack #31 October 8, 2026 22:27
@carnegiedude
carnegiedude force-pushed the npeters/associate-tests2 branch from b12f830 to b707d4a Compare October 8, 2026 22:28
})
.pipe(Effect.exit)

expect(Exit.isFailure(exit)).toBe(true)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hi Nate, there are multiple error assertions in the symlink rejection tests (another starts at line 2174). Maybe these could be grouped together in a helper to reduce duplication and make future validation tests easier to add. Great job !

@ItsJayYip

Copy link
Copy Markdown
Contributor

Other than Janna's comments, I think this looks well. Just to reiterate, I do think having the helpers can help you with testing in the regard that testing from lecture must be deterministic + side-effect free.

@carnegiedude carnegiedude self-assigned this Oct 9, 2026
…r handling, acceptance of files only inside the project and working, and malformed quotes. They also test the visibility of the /associate command in the command list and prevents override of /associate
@carnegiedude
carnegiedude force-pushed the npeters/associate-tests2 branch from b707d4a to 8a2b07d Compare October 9, 2026 05:47
@carnegiedude
carnegiedude merged commit f7c3794 into main Oct 9, 2026
6 checks passed
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.

3 participants