Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
3. [x] Update contracts/tax-compliance/src/compliance.rs: No changes needed (generate_alerts already supports PaymentDueSoon/TaxOverdue).
4. [x] Update docs/compliance-regulatory-framework.md: Document new features.
5. [x] Update README.md: Add feature mention.
6. [ ] Add/update tests in contracts/tax-compliance/src/lib.rs.
7. [ ] Run `cargo test` and `./scripts/test.sh`.
8. [ ] Complete task.
6. [x] Add/update tests in contracts/tax-compliance/src/lib.rs.
7. [x] Run `cargo test` and `./scripts/test.sh`.
8. [x] Complete task.

Progress will be updated after each step.
28 changes: 28 additions & 0 deletions contracts/tax-compliance/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2679,5 +2679,33 @@ pub enum DeadlineAlertLevel {
assert_eq!(summary.compliant_properties, 1); // property 8 has no record -> not overdue
assert_eq!(summary.non_compliant_properties, 1); // property 7 has outstanding tax
}

#[ink::test]
fn tax_deadline_events_emitted() {
let mut contract = TaxComplianceModule::new(None);
let owner = AccountId::from([0x09; 32]);

// Ensure rule with 30-day due period
contract
.configure_tax_rule(jurisdiction(), rule())
.expect("rule");

// Set property assessment
contract
.set_property_assessment(55, jurisdiction(), owner, 100_000, 0)
.expect("assessment");

// Set deterministic timestamp
ink::env::test::set_block_timestamp::<ink::env::DefaultEnvironment>(1_000_000);

// Count events before
let before = ink::env::test::recorded_events().count();

// Calculate tax -> should emit TaxCalculated + TaxDeadlineApproaching + TaxDeadlineNotification
let _record = contract.calculate_tax(55, jurisdiction(), None).expect("tax");

let after = ink::env::test::recorded_events().count();
assert!(after >= before + 3, "expected at least 3 events emitted");
}
}
}
Loading