Repository navigation
feat: support flat-fee invoice line creates - #4588
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds attach-invoice-line support for credit-then-invoice flat-fee charges, generalizes manual invoice-line handling and validation, updates invoice edit callbacks, and expands tests for manual attachment and progressive-billing rejections. ChangesManual Standard Line Attach for CreditThenInvoice
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR adds charge-backed flat-fee invoice-line creation through mutable invoice edits. The main changes are:
Confidence Score: 5/5This looks safe to merge.
Important Files Changed
Reviews (5): Last reviewed commit: "fix(billing): allow split line no-op ove..." | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
openmeter/billing/worker/subscriptionsync/service/sync_credittheninvoice_test.go (2)
4269-4299: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAssert the failed zero-amount edit leaves the draft invoice unchanged.
Right now this only proves the error and balances. It would still pass if the preallocated line were left on the invoice before
ErrInvoiceLineZeroAmountCreatecame back, which is the risky part of this new flow.Diff suggestion
s.ErrorIs(err, billing.ErrInvoiceLineZeroAmountCreate) + rejectedInvoice, err := s.BillingService.GetStandardInvoiceById(ctx, billing.GetStandardInvoiceByIdInput{ + Invoice: draftInvoice.GetInvoiceID(), + Expand: billing.StandardInvoiceExpandAll, + }) + s.NoError(err) + s.Require().Len(rejectedInvoice.Lines.OrEmpty(), 1) + _, rejectedFound := lo.Find(rejectedInvoice.Lines.OrEmpty(), func(line *billing.StandardLine) bool { + return line != nil && line.Name == "Zero manual standard setup fee" + }) + s.False(rejectedFound, "rejected zero-amount line should not persist") s.assertCreditThenInvoiceBalances(expectedCreditThenInvoiceBalances{As per path instructions,
**/*_test.go: “Make sure the tests are comprehensive and cover the changes.” Based on PR objectives, billing now “preallocates and persists invoice lines before dispatching to the line engine.”🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@openmeter/billing/worker/subscriptionsync/service/sync_credittheninvoice_test.go` around lines 4269 - 4299, The zero-amount update test in the UpdateStandardInvoice flow only checks the error and balances, so it misses the regression where the draft invoice may still keep the preallocated line after ErrInvoiceLineZeroAmountCreate. Extend this test around BillingService.UpdateStandardInvoice to assert the draft invoice state is unchanged after the failed EditFn, using the existing draftInvoice and invoice line helpers to verify the added line was not persisted on the invoice.Source: Path instructions
4325-4400: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winPlease pin the “no second customer-facing line” contract with a count assertion.
Finding one attached line by name and ID is good, but this would still pass if the attach flow also left a duplicate preallocated line behind. A
Len(..., 2)on both the edited and refetched invoice would catch that regression directly.Diff suggestion
s.Require().NoError(err) s.DebugDumpInvoice("edited draft invoice", editedInvoice) + s.Require().Len(editedInvoice.Lines.OrEmpty(), 2, "manual attach should reuse the preallocated line instead of creating a duplicate") s.assertCreditThenInvoiceBalances(expectedCreditThenInvoiceBalances{ @@ s.NoError(err) + s.Require().Len(refetchedInvoice.Lines.OrEmpty(), 2, "manual attach should persist exactly one new customer-facing line") refetchedCreatedLine, found := lo.Find(refetchedInvoice.Lines.OrEmpty(), func(line *billing.StandardLine) bool {As per path instructions,
**/*_test.go: “Make sure the tests are comprehensive and cover the changes.” Based on PR objectives, the flat-fee engine should “attach charge state to the existing line rather than creating a second customer-facing line.”🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@openmeter/billing/worker/subscriptionsync/service/sync_credittheninvoice_test.go` around lines 4325 - 4400, The test currently verifies the attached manual line by name and ID, but it does not assert that only one customer-facing line exists. In this sync_credittheninvoice_test.go scenario around editedInvoice and refetchedInvoice, add a line-count assertion on the invoice lines to ensure the attach flow does not leave a duplicate preallocated line behind. Keep the existing lo.Find checks for createdLine/refetchedCreatedLine, but pin the contract with a Len assertion on both the edited and refetched invoice line collections so the flat-fee attach behavior is covered end to end.Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@openmeter/billing/charges/flatfee/service/manualedit.go`:
- Line 172: The manual flat fee creation path is converting tax config in the
line builder before the fallback logic can run, so nil tax config causes a
failure. Update the manual edit flow in the line handling code around the
`GetTaxConfig()` / `ToProductCatalog()` conversion so it first checks whether
the tax config is present and only converts when non-nil, otherwise lets the
existing default tax-code fallback in this service apply. Use the
`manualedit.go` line construction logic and the `TaxConfig` assignment as the
place to guard this.
In `@openmeter/billing/charges/invoiceupdater/patch.go`:
- Around line 80-115: The target validation in PatchLineUpdate.RequireTarget and
PatchLineDelete.RequireTarget only compares plain line ID and InvoiceID, so a
namespace mismatch can slip through. Update both helpers to validate the full
namespaced line identifier carried by the patch and the
billing.GenericInvoiceLineReader, using the LineID value instead of just ID
where available. Keep the existing invoice check, but ensure the target line
comparison fails whenever the namespace portion differs.
---
Nitpick comments:
In
`@openmeter/billing/worker/subscriptionsync/service/sync_credittheninvoice_test.go`:
- Around line 4269-4299: The zero-amount update test in the
UpdateStandardInvoice flow only checks the error and balances, so it misses the
regression where the draft invoice may still keep the preallocated line after
ErrInvoiceLineZeroAmountCreate. Extend this test around
BillingService.UpdateStandardInvoice to assert the draft invoice state is
unchanged after the failed EditFn, using the existing draftInvoice and invoice
line helpers to verify the added line was not persisted on the invoice.
- Around line 4325-4400: The test currently verifies the attached manual line by
name and ID, but it does not assert that only one customer-facing line exists.
In this sync_credittheninvoice_test.go scenario around editedInvoice and
refetchedInvoice, add a line-count assertion on the invoice lines to ensure the
attach flow does not leave a duplicate preallocated line behind. Keep the
existing lo.Find checks for createdLine/refetchedCreatedLine, but pin the
contract with a Len assertion on both the edited and refetched invoice line
collections so the flat-fee attach behavior is covered end to end.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 2c0ba298-47e0-47fc-96f0-e45486360742
📒 Files selected for processing (9)
openmeter/billing/charges/flatfee/service/creditheninvoice.goopenmeter/billing/charges/flatfee/service/lineengine.goopenmeter/billing/charges/flatfee/service/manualedit.goopenmeter/billing/charges/invoiceupdater/patch.goopenmeter/billing/charges/meta/triggers.goopenmeter/billing/gatheringinvoice.goopenmeter/billing/invoiceline.goopenmeter/billing/service/invoiceupdate.goopenmeter/billing/worker/subscriptionsync/service/sync_credittheninvoice_test.go
42254d0 to
efd641f
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
test/billing/discount_test.go (1)
178-195: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winPlease assert the invoice stays unchanged after the rejected edit.
Right now this only checks the returned error. A bug that mutates the progressively billed line before surfacing
billing.ErrInvoiceLineProgressiveBillingUsageDiscountUpdateForbiddenwould still pass. Re-fetching the invoice and asserting the usage discount is unchanged would close that gap. As per path instructions, "Suggest missing tests only when the PR introduces behavior without meaningful coverage, or when the current tests would pass despite a concrete regression in the changed code."🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/billing/discount_test.go` around lines 178 - 195, Add an assertion in the “Editing a progressively billed invoice line usage discount is rejected” test that re-fetches the invoice after UpdateStandardInvoice returns the forbidden error and verifies the line’s usage discount was not mutated. Use the existing BillingService.UpdateStandardInvoice flow and the invoice line access via invoice.Lines.OrEmpty()[0] to confirm the pre-edit state remains unchanged after ErrInvoiceLineProgressiveBillingUsageDiscountUpdateForbidden.Source: Path instructions
test/billing/invoice_test.go (1)
1798-1817: 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick winNice contract check, but we should also prove the failed edit is side-effect free.
Both cases stop at the error assertion now. If
UpdateStandardInvoiceaccidentally mutates the line or marks it deleted before returningbilling.ErrInvoiceProgressiveBillingNotSupported, these tests would still pass. I'd add a re-fetch plus unchanged line/totals assertions after each failure. As per path instructions, "Suggest missing tests only when the PR introduces behavior without meaningful coverage, or when the current tests would pass despite a concrete regression in the changed code."Also applies to: 1850-1867
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/billing/invoice_test.go` around lines 1798 - 1817, Add post-failure coverage to prove UpdateStandardInvoice is side-effect free when it rejects progressive billing edits: after the error assertions in the "updating a progressively billed line item is rejected" and the other affected failing-case test, re-fetch the invoice and assert the targeted line from invoice.Lines.GetByID (and any related totals/state) remains unchanged and not deleted. Use the existing BillingService.UpdateStandardInvoice, invoice.GetInvoiceID, and line lookup helpers to verify the rejected edit did not mutate invoice state before returning billing.ErrInvoiceProgressiveBillingNotSupported.Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@openmeter/billing/service/invoice.go`:
- Around line 640-643: The gathering-invoice rejection in
executeTriggerOnInvoice is currently returned as a raw fmt.Errorf, which causes
UpdateStandardInvoice to surface it as an internal error instead of a
validation-style response. Move this check onto the validation path used in
service/invoice.go, and return the same kind of validation error that
DeleteInvoice uses for gathering invoices, keeping the behavior consistent for
StandardInvoiceStatusGathering.
- Around line 666-676: The joined validation errors from the StandardLine loop
are returned as plain errors instead of the normal billing validation type.
Update the invoice update path in invoice.go so the errors produced by
line.Validate() in the sm.Invoice.Lines validation branch are wrapped as
billing.ValidationError, matching the earlier sm.Invoice.Validate() handling and
the edit-failure expectations in the invoice update flow.
---
Outside diff comments:
In `@test/billing/discount_test.go`:
- Around line 178-195: Add an assertion in the “Editing a progressively billed
invoice line usage discount is rejected” test that re-fetches the invoice after
UpdateStandardInvoice returns the forbidden error and verifies the line’s usage
discount was not mutated. Use the existing BillingService.UpdateStandardInvoice
flow and the invoice line access via invoice.Lines.OrEmpty()[0] to confirm the
pre-edit state remains unchanged after
ErrInvoiceLineProgressiveBillingUsageDiscountUpdateForbidden.
In `@test/billing/invoice_test.go`:
- Around line 1798-1817: Add post-failure coverage to prove
UpdateStandardInvoice is side-effect free when it rejects progressive billing
edits: after the error assertions in the "updating a progressively billed line
item is rejected" and the other affected failing-case test, re-fetch the invoice
and assert the targeted line from invoice.Lines.GetByID (and any related
totals/state) remains unchanged and not deleted. Use the existing
BillingService.UpdateStandardInvoice, invoice.GetInvoiceID, and line lookup
helpers to verify the rejected edit did not mutate invoice state before
returning billing.ErrInvoiceProgressiveBillingNotSupported.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 704b93aa-1963-49ce-be82-7a5f6cbd43f9
📒 Files selected for processing (16)
openmeter/billing/charges/flatfee/service/creditheninvoice.goopenmeter/billing/charges/flatfee/service/lineengine.goopenmeter/billing/charges/flatfee/service/manualedit.goopenmeter/billing/charges/invoiceupdater/patch.goopenmeter/billing/charges/meta/triggers.goopenmeter/billing/gatheringinvoice.goopenmeter/billing/invoiceline.goopenmeter/billing/lineengine/engine.goopenmeter/billing/service/invoice.goopenmeter/billing/service/invoiceupdate.goopenmeter/billing/service/stdinvoice.goopenmeter/billing/stdinvoiceline.goopenmeter/billing/stdinvoiceline_test.goopenmeter/billing/worker/subscriptionsync/service/sync_credittheninvoice_test.gotest/billing/discount_test.gotest/billing/invoice_test.go
✅ Files skipped from review due to trivial changes (1)
- openmeter/billing/stdinvoiceline_test.go
🚧 Files skipped from review as they are similar to previous changes (9)
- openmeter/billing/charges/meta/triggers.go
- openmeter/billing/charges/invoiceupdater/patch.go
- openmeter/billing/gatheringinvoice.go
- openmeter/billing/charges/flatfee/service/creditheninvoice.go
- openmeter/billing/service/invoiceupdate.go
- openmeter/billing/charges/flatfee/service/manualedit.go
- openmeter/billing/invoiceline.go
- openmeter/billing/charges/flatfee/service/lineengine.go
- openmeter/billing/worker/subscriptionsync/service/sync_credittheninvoice_test.go
efd641f to
5e5ce42
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@openmeter/billing/lineengine/engine.go`:
- Around line 180-183: The guard in engine.go’s line validation is too broad
because it rejects any presence of Price or FeatureKey in ChangesToApply, even
when the values are unchanged. Update the check around the validation error in
the helper that processes override.ChangesToApply so it only fails when Price or
FeatureKey actually differ from override.ExistingLine, or move the validation to
after applying the override and compare against the resulting line. Keep the
existing billing.ValidationError path and
ErrInvoiceProgressiveBillingNotSupported behavior, but scope it to real changes
only.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 817aec26-50cd-41f2-aa98-3bb2e7488fd3
📒 Files selected for processing (16)
openmeter/billing/charges/flatfee/service/creditheninvoice.goopenmeter/billing/charges/flatfee/service/lineengine.goopenmeter/billing/charges/flatfee/service/manualedit.goopenmeter/billing/charges/invoiceupdater/patch.goopenmeter/billing/charges/meta/triggers.goopenmeter/billing/gatheringinvoice.goopenmeter/billing/invoiceline.goopenmeter/billing/lineengine/engine.goopenmeter/billing/service/invoice.goopenmeter/billing/service/invoiceupdate.goopenmeter/billing/service/stdinvoice.goopenmeter/billing/stdinvoiceline.goopenmeter/billing/stdinvoiceline_test.goopenmeter/billing/worker/subscriptionsync/service/sync_credittheninvoice_test.gotest/billing/discount_test.gotest/billing/invoice_test.go
🚧 Files skipped from review as they are similar to previous changes (15)
- openmeter/billing/stdinvoiceline_test.go
- openmeter/billing/service/stdinvoice.go
- openmeter/billing/charges/meta/triggers.go
- openmeter/billing/invoiceline.go
- test/billing/discount_test.go
- openmeter/billing/stdinvoiceline.go
- openmeter/billing/service/invoiceupdate.go
- openmeter/billing/gatheringinvoice.go
- openmeter/billing/charges/invoiceupdater/patch.go
- openmeter/billing/charges/flatfee/service/creditheninvoice.go
- test/billing/invoice_test.go
- openmeter/billing/service/invoice.go
- openmeter/billing/charges/flatfee/service/manualedit.go
- openmeter/billing/worker/subscriptionsync/service/sync_credittheninvoice_test.go
- openmeter/billing/charges/flatfee/service/lineengine.go
5e5ce42 to
885fabd
Compare
There was a problem hiding this comment.
🧹 Nitpick comments (1)
test/billing/invoice_test.go (1)
1798-1817: 🗄️ Data Integrity & Integration | 🔵 Trivial | ⚡ Quick winAlso assert the rejected edit leaves the stored line unchanged.
Right now this would still pass if
UpdateStandardInvoicereturns the right error but partially persists the price change. A quick reload assertion would cover that side effect, and the small given/when/then comments satisfy the service-subtest style rule too.Suggested test tightening
s.Run("updating a progressively billed line item is rejected", func() { + // Given a progressively billed line from the mid-period invoice. + originalPrice := flatPerUnit.UsageBased.Price + + // When an API edit tries to update the line price. _, err := s.BillingService.UpdateStandardInvoice(ctx, billing.UpdateStandardInvoiceInput{ Invoice: invoice.GetInvoiceID(), ChangeSource: billing.ChangeSourceAPIRequest, @@ + // Then the edit is rejected and the stored line remains unchanged. require.Error(s.T(), err) require.ErrorAs(s.T(), err, &billing.ValidationError{}) require.ErrorIs(s.T(), err, billing.ErrInvoiceProgressiveBillingNotSupported) + + reloadedInvoice, reloadErr := s.BillingService.GetStandardInvoiceById(ctx, billing.GetStandardInvoiceByIdInput{ + Invoice: invoice.GetInvoiceID(), + Expand: billing.StandardInvoiceExpands{ + billing.StandardInvoiceExpandLines, + }, + }) + require.NoError(s.T(), reloadErr) + + reloadedLine := reloadedInvoice.Lines.GetByID(flatPerUnit.ID) + require.NotNil(s.T(), reloadedLine) + require.Equal(s.T(), originalPrice, reloadedLine.UsageBased.Price, "rejected update should not persist line price") })As per path instructions, “Make sure the tests are comprehensive and cover the changes.” As per coding guidelines, “For service and lifecycle subtests, start non-trivial subtest bodies with concise
given/when/thenintent comments.”🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/billing/invoice_test.go` around lines 1798 - 1817, The progressive-billing rejection test in the UpdateStandardInvoice path should also verify no partial mutation is persisted. In the subtest around BillingService.UpdateStandardInvoice, keep the existing error assertions and then reload the invoice/line state to confirm the flatPerUnit line still has its original UsageBased.Price. Add concise given/when/then comments at the start of the non-trivial subtest body to match the service-subtest style rule.Sources: Coding guidelines, Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@test/billing/invoice_test.go`:
- Around line 1798-1817: The progressive-billing rejection test in the
UpdateStandardInvoice path should also verify no partial mutation is persisted.
In the subtest around BillingService.UpdateStandardInvoice, keep the existing
error assertions and then reload the invoice/line state to confirm the
flatPerUnit line still has its original UsageBased.Price. Add concise
given/when/then comments at the start of the non-trivial subtest body to match
the service-subtest style rule.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 106d6210-ae85-4fde-8e21-1e7273d24903
📒 Files selected for processing (16)
openmeter/billing/charges/flatfee/service/creditheninvoice.goopenmeter/billing/charges/flatfee/service/lineengine.goopenmeter/billing/charges/flatfee/service/manualedit.goopenmeter/billing/charges/invoiceupdater/patch.goopenmeter/billing/charges/meta/triggers.goopenmeter/billing/gatheringinvoice.goopenmeter/billing/invoiceline.goopenmeter/billing/lineengine/engine.goopenmeter/billing/service/invoice.goopenmeter/billing/service/invoiceupdate.goopenmeter/billing/service/stdinvoice.goopenmeter/billing/stdinvoiceline.goopenmeter/billing/stdinvoiceline_test.goopenmeter/billing/worker/subscriptionsync/service/sync_credittheninvoice_test.gotest/billing/discount_test.gotest/billing/invoice_test.go
🚧 Files skipped from review as they are similar to previous changes (14)
- openmeter/billing/charges/meta/triggers.go
- openmeter/billing/stdinvoiceline_test.go
- openmeter/billing/gatheringinvoice.go
- test/billing/discount_test.go
- openmeter/billing/charges/invoiceupdater/patch.go
- openmeter/billing/service/stdinvoice.go
- openmeter/billing/charges/flatfee/service/creditheninvoice.go
- openmeter/billing/lineengine/engine.go
- openmeter/billing/service/invoiceupdate.go
- openmeter/billing/charges/flatfee/service/lineengine.go
- openmeter/billing/invoiceline.go
- openmeter/billing/service/invoice.go
- openmeter/billing/charges/flatfee/service/manualedit.go
- openmeter/billing/worker/subscriptionsync/service/sync_credittheninvoice_test.go
Summary
Adds charge-backed flat-fee line creation through mutable invoice edits.
Domain Behavior
Manual invoice-line creates can now route to the flat-fee charge line engine for both gathering and standard invoices. Billing still owns invoice-line identity: created lines are preallocated and persisted before line-engine dispatch, and the flat-fee engine attaches charge state to that existing line instead of creating a second customer-facing line.
For gathering invoices, the created charge returns the target gathering line state and billing merges it onto the edited line. For standard invoices, the flat-fee state machine receives an attach-line trigger in the created state, creates the realization run against the preallocated standard line, and emits an update patch that the line engine validates and merges back.
The flat-fee create path also preserves manual feature keys, uses the invoice edit tax-code fallback when needed, and rejects zero-amount flat-fee creates with the existing "delete instead" validation behavior.
Validation
go test -tags=dynamic -count=1 ./openmeter/billing/charges/flatfee/servicego test -tags=dynamic -count=1 ./openmeter/billing/worker/subscriptionsync/service -run 'TestCreditThenInvoiceScenarios/TestStandardInvoiceManualCreateSync'go vet -tags=dynamic ./openmeter/billing/charges/flatfee/service ./openmeter/billing/serviceSummary by CodeRabbit
New Features
Bug Fixes
Tests