Compare commits
2 commits
a2a1a48ea6
...
c3bd3b1f27
Author | SHA1 | Date | |
---|---|---|---|
c3bd3b1f27 | |||
1334336377 |
5 changed files with 486 additions and 288 deletions
713
Cargo.lock
generated
713
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -29,6 +29,7 @@ gloo-net = "0.5"
|
|||
gloo-timers = { version = "0.2", features = ["futures"] }
|
||||
futures = "0.3"
|
||||
wasm-bindgen-futures = "0.4"
|
||||
wasm-bindgen-test = "0.3"
|
||||
serde_json="1.0.133"
|
||||
thiserror = "2.0.9"
|
||||
zerofrom = "0.1"
|
||||
|
@ -50,6 +51,13 @@ ssr = [
|
|||
"dep:rusqlite"
|
||||
]
|
||||
|
||||
# feature for wasm tests
|
||||
wasm-test = [
|
||||
"leptos/csr",
|
||||
"leptos_meta/csr",
|
||||
"leptos_router/csr",
|
||||
]
|
||||
|
||||
# Override secp256k1's default features
|
||||
[dependencies.secp256k1]
|
||||
version = "0.30.0"
|
||||
|
|
50
README.md
50
README.md
|
@ -99,6 +99,56 @@ sequenceDiagram
|
|||
```
|
||||
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**
|
||||
We welcome contributions! Here’s how you can help:
|
||||
|
||||
|
|
|
@ -2,8 +2,11 @@
|
|||
use actix_web::{web, HttpResponse, Responder};
|
||||
use std::sync::Arc;
|
||||
use tokio::sync::Mutex;
|
||||
#[cfg(feature = "ssr")]
|
||||
use compareware::db::Database;
|
||||
#[cfg(feature = "ssr")]
|
||||
use compareware::api::{ItemRequest, create_item, get_items, get_selected_properties, add_selected_property};
|
||||
#[cfg(feature = "ssr")]
|
||||
use compareware::models::item::Item;
|
||||
use compareware::utils::panic_hook;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue