Background
lib.rs disables the notification test module:
// TODO: Fix notification_tests module (pre-existing issue - tests fail with AlreadyInitialized)
// mod notification_tests;
There is also a notification_tests.rs.disabled file at contracts/teachlink/src/notification_tests.rs.disabled containing a full test suite (initialization, notification creation, etc.) that is completely excluded from the build — it doesn't even need uncommenting, it needs renaming back to .rs once fixed. The root cause noted is that repeated calls to NotificationManager::initialize across tests in the same module return AlreadyInitialized instead of each test getting isolated state, which points to shared/leaked storage between test functions rather than a real product bug — but it means the entire notification module currently ships with zero enforced test coverage.
Implementation Plan
- Rename
notification_tests.rs.disabled back to notification_tests.rs and re-add mod notification_tests; in lib.rs.
- Fix the test isolation problem causing
AlreadyInitialized — likely each #[test] needs its own fresh Env/contract context rather than sharing state across tests in the module.
- Verify
NotificationManager::initialize semantics are correct (should it be idempotent, or is the test setup wrong?) and document the decision.
- Run the full suite and confirm no
AlreadyInitialized failures remain.
Acceptance Criteria
notification_tests.rs is a live, compiled module (no .disabled extension)
mod notification_tests; is active in lib.rs
- All tests pass without
AlreadyInitialized errors, with proper per-test isolation
Background
lib.rsdisables the notification test module:There is also a
notification_tests.rs.disabledfile atcontracts/teachlink/src/notification_tests.rs.disabledcontaining a full test suite (initialization, notification creation, etc.) that is completely excluded from the build — it doesn't even need uncommenting, it needs renaming back to.rsonce fixed. The root cause noted is that repeated calls toNotificationManager::initializeacross tests in the same module returnAlreadyInitializedinstead of each test getting isolated state, which points to shared/leaked storage between test functions rather than a real product bug — but it means the entire notification module currently ships with zero enforced test coverage.Implementation Plan
notification_tests.rs.disabledback tonotification_tests.rsand re-addmod notification_tests;inlib.rs.AlreadyInitialized— likely each#[test]needs its own freshEnv/contract context rather than sharing state across tests in the module.NotificationManager::initializesemantics are correct (should it be idempotent, or is the test setup wrong?) and document the decision.AlreadyInitializedfailures remain.Acceptance Criteria
notification_tests.rsis a live, compiled module (no.disabledextension)mod notification_tests;is active inlib.rsAlreadyInitializederrors, with proper per-test isolation