Skip to content

[#6] StoryFactory Tests#14

Merged
realproject7 merged 2 commits into
mainfrom
task/6-storyfactory-tests
Mar 13, 2026
Merged

[#6] StoryFactory Tests#14
realproject7 merged 2 commits into
mainfrom
task/6-storyfactory-tests

Conversation

@realproject7

Copy link
Copy Markdown
Owner

15 tests: createStoryline (happy, events, reverts), chainPlot (happy, index, reverts), donate (happy, reverts). forge test passes. Fixes #6

Tests cover:
- createStoryline: happy path, event emission, empty title revert,
  invalid CID revert
- chainPlot: happy path, correct index emission, wrong writer revert,
  invalid CID revert, deadline expired revert, no-deadline allows late
- donate: happy path with transfer verification, zero amount revert,
  non-existent storyline revert, insufficient allowance revert

Uses MockBond and MockPlot for isolated unit testing.

Fixes #6

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

@project7-interns project7-interns left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Verdict: REQUEST CHANGES

Summary

The test suite is close, but it does not yet satisfy the full issue #6 merge checklist. One of the required chainPlot() revert cases is explicitly called out in the ticket and is still untested.

Findings

  • [medium] The sunset revert case is not actually covered. test_chainPlot_revert_sunset() is effectively a placeholder comment and never exercises require(!s.sunset, "Storyline sunset"). Issue #6 explicitly requires coverage for the sunset-story revert path.
    • File: test/StoryFactory.t.sol:222
    • Suggestion: set the sunset flag in storage within the test (for example with Foundry cheatcodes) and assert that chainPlot() reverts with "Storyline sunset".

Decision

Request changes because the current test suite does not cover all required chainPlot() revert cases from the ticket, so the merge checklist is not fully met yet.

Use storage slot 2 (not 7) for storylines mapping. vm.store sets
sunset=true directly, then verifies chainPlot reverts correctly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

@project7-interns project7-interns left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

T2b Review: APPROVE

Sunset revert test confirmed — uses vm.store with correct storage slot calculation to set sunset flag, verifies revert. All 15 tests now functional. Good coverage of happy paths and revert cases across all three functions.

@project7-interns project7-interns left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Verdict: APPROVE

Summary

The missing sunset-path coverage is now in place: the test suite uses vm.store to set the packed sunset flag and verifies that chainPlot() reverts with "Storyline sunset". Foundry CI is green on the updated head commit.

Findings

  • None.

Decision

Approve because the required revert-case coverage gap is resolved and the PR now satisfies the merge criteria for issue #6.

@realproject7 realproject7 merged commit 85fc1e5 into main Mar 13, 2026
2 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.

[P2-6] StoryFactory Tests

2 participants