Add unit tests for models and services
- Implemented unit tests for the Package model, covering methods such as generateId, findById, findByName, and version management. - Created unit tests for the Repository model, including repository creation, name validation, and retrieval methods. - Added tests for the Session model, focusing on session creation, validation, and invalidation. - Developed unit tests for the User model, ensuring user creation, password hashing, and retrieval methods function correctly. - Implemented AuthService tests, validating login, token refresh, and session management. - Added TokenService tests, covering token creation, validation, and revocation processes.
This commit is contained in:
15
test/fixtures/cargo/demo-crate/Cargo.toml
vendored
Normal file
15
test/fixtures/cargo/demo-crate/Cargo.toml
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
[package]
|
||||
name = "demo-crate"
|
||||
version = "1.0.0"
|
||||
edition = "2021"
|
||||
authors = ["Stack.Gallery Test <test@stack.gallery>"]
|
||||
description = "Demo crate for Stack.Gallery Registry e2e tests"
|
||||
license = "MIT"
|
||||
repository = "https://github.com/stack-gallery/demo-crate"
|
||||
readme = "README.md"
|
||||
keywords = ["demo", "test", "stack-gallery"]
|
||||
categories = ["development-tools"]
|
||||
|
||||
[lib]
|
||||
name = "demo_crate"
|
||||
path = "src/lib.rs"
|
||||
13
test/fixtures/cargo/demo-crate/README.md
vendored
Normal file
13
test/fixtures/cargo/demo-crate/README.md
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
# demo-crate
|
||||
|
||||
Demo crate for Stack.Gallery Registry e2e tests.
|
||||
|
||||
## Usage
|
||||
|
||||
```rust
|
||||
use demo_crate::greet;
|
||||
|
||||
fn main() {
|
||||
println!("{}", greet("World")); // Hello, World!
|
||||
}
|
||||
```
|
||||
16
test/fixtures/cargo/demo-crate/src/lib.rs
vendored
Normal file
16
test/fixtures/cargo/demo-crate/src/lib.rs
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
//! Demo crate for Stack.Gallery Registry e2e tests
|
||||
|
||||
/// Greets the given name
|
||||
pub fn greet(name: &str) -> String {
|
||||
format!("Hello, {}!", name)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn test_greet() {
|
||||
assert_eq!(greet("World"), "Hello, World!");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user