Skip to content
This repository was archived by the owner on Mar 5, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,34 @@ jobs:
env:
INSTA_WORKSPACE_ROOT: ${{ github.workspace }}
run: wasm-pack test --chrome --headless

node-test:
if: ${{ github.actor == 'qqrm' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@v1
with:
toolchain: nightly
targets: wasm32-unknown-unknown
components: rust-src
- uses: actions/setup-node@v4
with:
node-version: '20'
- name: Cache cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
~/.cargo/bin
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Install dependencies
run: npm ci
- name: Run logic-only tests
env:
INSTA_WORKSPACE_ROOT: ${{ github.workspace }}
run: npm run test:node -- --features logic-only --test logic_only
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ quickcheck_macros = "1"

[features]
parallel = ["rayon"]
logic-only = []

[profile.dev]
panic = "unwind" # Preserves stack traces
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"name": "webgpu-candles",
"private": true,
"scripts": {
"test": "wasm-pack test --chrome --headless"
"test": "wasm-pack test --chrome --headless",
"test:node": "wasm-pack test --node"
},
"devDependencies": {
"wasm-pack": "^0.13.1"
Expand Down
11 changes: 11 additions & 0 deletions tests/logic_only.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#![cfg(feature = "logic-only")]

use price_chart_wasm::time_utils::format_time_label;
use wasm_bindgen_test::*;

#[wasm_bindgen_test]
fn format_time_label_basic() {
assert_eq!(format_time_label(0, 2.0), "00:00");
assert_eq!(format_time_label(0, 1.5), "01.01");
assert_eq!(format_time_label(0, 0.5), "01.1970");
}
Loading