Compare commits

..

No commits in common. "c3bd3b1f27d7119771c889ccfbcb3e765401e9d2" and "a2a1a48ea62a4f5de460273236ab5fa375b6209f" have entirely different histories.

5 changed files with 289 additions and 487 deletions

715
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -29,7 +29,6 @@ gloo-net = "0.5"
gloo-timers = { version = "0.2", features = ["futures"] } gloo-timers = { version = "0.2", features = ["futures"] }
futures = "0.3" futures = "0.3"
wasm-bindgen-futures = "0.4" wasm-bindgen-futures = "0.4"
wasm-bindgen-test = "0.3"
serde_json="1.0.133" serde_json="1.0.133"
thiserror = "2.0.9" thiserror = "2.0.9"
zerofrom = "0.1" zerofrom = "0.1"
@ -51,13 +50,6 @@ ssr = [
"dep:rusqlite" "dep:rusqlite"
] ]
# feature for wasm tests
wasm-test = [
"leptos/csr",
"leptos_meta/csr",
"leptos_router/csr",
]
# Override secp256k1's default features # Override secp256k1's default features
[dependencies.secp256k1] [dependencies.secp256k1]
version = "0.30.0" version = "0.30.0"

View file

@ -99,56 +99,6 @@ sequenceDiagram
``` ```
3. Access the application at: [http://localhost:3004](http://localhost:3004) 3. Access the application at: [http://localhost:3004](http://localhost:3004)
## **Running Tests**
CompareWare uses both native Rust tests and WebAssembly (WASM) tests for browser-based components.
### **Native Rust Tests**
To run native Rust tests (for server-side or non-WASM code):
```bash
cargo test
```
### **WASM (Browser) Tests**
To run tests for browser-based (Leptos/WASM) components, you need to use [`wasm-pack`](https://rustwasm.github.io/wasm-pack/installer/):
1. **Install wasm-pack** (if you haven't already):
```bash
cargo install wasm-pack
```
2. **Run tests in a headless browser (Chrome or Firefox):**
```bash
wasm-pack test --headless --chrome --features wasm-test --no-default-features
```
Or, for Firefox:
```bash
wasm-pack test --headless --firefox --features wasm-test --no-default-features
```
3. **Run tests in Node.js** (if your tests do not require a browser environment):
```bash
wasm-pack test --node --features wasm-test --no-default-features
```
#### **Notes**
- Make sure your test functions are annotated with `#[wasm_bindgen_test]` for WASM tests.
- If you add new test files, place them in the `tests/` directory or as modules in `src/` as appropriate.
- Warnings about unused variables or imports can be ignored unless they affect test results.
---
For more details on WASM testing, see the [wasm-bindgen-test documentation](https://rustwasm.github.io/wasm-bindgen/wasm-bindgen-test/usage.html).
### **Collaboration** ### **Collaboration**
We welcome contributions! Heres how you can help: We welcome contributions! Heres how you can help:

View file

@ -2,11 +2,8 @@
use actix_web::{web, HttpResponse, Responder}; use actix_web::{web, HttpResponse, Responder};
use std::sync::Arc; use std::sync::Arc;
use tokio::sync::Mutex; use tokio::sync::Mutex;
#[cfg(feature = "ssr")]
use compareware::db::Database; use compareware::db::Database;
#[cfg(feature = "ssr")]
use compareware::api::{ItemRequest, create_item, get_items, get_selected_properties, add_selected_property}; use compareware::api::{ItemRequest, create_item, get_items, get_selected_properties, add_selected_property};
#[cfg(feature = "ssr")]
use compareware::models::item::Item; use compareware::models::item::Item;
use compareware::utils::panic_hook; use compareware::utils::panic_hook;