Testing | laravel-honeypot-rust | Spatie       

 SPATIE  

laravel-honeypot-rust
=====================

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Laravel-honeypot-rust](https://spatie.be/docs/laravel-honeypot-rust/v1)  Testing

 Version   v1      

 Other versions for crawler [v1](https://spatie.be/docs/laravel-honeypot-rust/v1) 

  Testing    
- [ Introduction ](https://spatie.be/docs/laravel-honeypot-rust/v1/introduction)
- [ Support us ](https://spatie.be/docs/laravel-honeypot-rust/v1/support-us)
- [ Installation ](https://spatie.be/docs/laravel-honeypot-rust/v1/installation-and-setup)
- [ Usage ](https://spatie.be/docs/laravel-honeypot-rust/v1/usage)
- [ Testing ](https://spatie.be/docs/laravel-honeypot-rust/v1/testing)
- [ Changelog ](https://spatie.be/docs/laravel-honeypot-rust/v1/changelog)

 Testing
=======

###  On this page 

1. [ Test coverage ](#content-test-coverage)

1. Run these checks from the package directory:

```
cargo fmt --all -- --check
cargo clippy --locked --all-targets --all-features -- -D warnings
cargo test --locked --all-targets --all-features
cargo test --locked --doc --all-features
cargo doc --locked --no-deps --all-features
cargo package --locked --list
```

- Set both `RUSTFLAGS` and `RUSTDOCFLAGS` to `-D warnings`. In POSIX shells, use `export RUSTFLAGS='-D warnings' RUSTDOCFLAGS='-D warnings'`. In PowerShell, set `$env:RUSTFLAGS = '-D warnings'` and `$env:RUSTDOCFLAGS = '-D warnings'`.
- Clippy enables pedantic lints. Independent config switches keep booleans, and trait implementations retain the framework's async syntax.
- `cargo package --list` checks the distribution file list. A crates.io archive cannot preserve the unpublished Git dependency on package-tools. Compilation and tests use the pinned Git revision; publication stays disabled.
- README.md and all Markdown pages in docs/ participate in rustdoc tests. Setup lines prefixed with `# ` compile and execute but are hidden in rendered rustdoc.

2. Check the minimum supported Rust version:

```
rustup toolchain install 1.99.0 --profile minimal
cargo +1.99.0 test --locked --all-targets --all-features
cargo +1.99.0 test --locked --doc --all-features
```

3. Check security advisories:

```
cargo install cargo-audit --locked
cargo audit
```

- CI runs stable checks on Linux, macOS and Windows, and the MSRV and audit checks on Linux. An audit requires access to the RustSec advisory database.

Test coverage
-----------------------------------------------------------------------------------------------

- `tests/registration.rs` boots sessions, CSRF, MiniJinja, and registration routes. It extracts fields from a rendered GET form and submits URL-encoded POST bodies through the full middleware stack. No database or network listener is needed.
- The clock stops at a fractional timestamp. Boundary checks cover exactly the minimum and maximum ages and one representable tick beyond each: 100 nanoseconds on Windows, one nanosecond elsewhere.
- Registration tests cover raw-body preservation, whitespace traps, missing/extra/nested/duplicate fields, modified/expired tokens, wrong keys and scopes, previous-key decryption, validation rules, and CSRF. DOM assertions check hidden inputs, tab exclusion, fresh names, and escaping.
- `tests/framework.rs` uses the native HTTP client and event fakes. It covers blank responses, optional fields, disabled timing, non-POST methods, custom checkers/responders, JSON/multipart bodies, uploaded-file traps, and typed environment settings.
- Provider tests check injectable fields against route middleware, final application overrides, typed configuration errors, and replacement services. Middleware can be cloned without cloning the checker.
- With all features enabled, tests round-trip serialized fields through an Inertia page and JSON POST. Also run `cargo test --locked --all-targets --no-default-features` to check an application without Inertia.

Print the registration HTTP outcomes with:

```
cargo test --locked --test registration -- --nocapture
```

All dependencies are public. CI needs no GitHub token to fetch them.

 A good
match?
-------------

### What we do best

- All things Laravel
- Custom frontend components
- Building APIs
- AI-powered features
- Simplifying things
- Clean solutions
- Integrating services

### Not our cup of tea

- WordPress themes
- Cutting corners
- Free mockups to win a job
- "Just execute the briefing"

 In short: we'd like to be a **substantial part** of your project.

 [ Get in touch via email ](mailto:info@spatie.be?subject=A%20good%20match%21&body=Tell%20us%20as%20much%20as%20you%20can%20about%0A-%20your%20online%20project%0A-%20your%20planning%0A-%20your%20budget%0A-%20%E2%80%A6%0A%0AAnything%20that%20helps%20us%20to%20start%20straightforward%21)
