Skip to content

Commit

Permalink
fix flow_input (#182)
Browse files Browse the repository at this point in the history
* fix flow_input

* update test files
  • Loading branch information
juchiast authored Jan 23, 2025
1 parent 715ec0b commit 0f86e5a
Show file tree
Hide file tree
Showing 6 changed files with 1,536 additions and 9 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ jobs:
-A clippy::too_many_arguments
- name: Assert Cargo.lock unchanged
run: .github/assert_cargo_lock_unchanged.bash
- name: Install wasm32-wasi
run: rustup target add wasm32-wasi
# - name: Install wasm32-wasi
# run: rustup target add wasm32-wasi
- name: Install deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- name: Build WASM
run: ./scripts/build_wasm_tests.bash
# - name: Build WASM
# run: ./scripts/build_wasm_tests.bash
- name: Build tests
run: cargo test --quiet --no-run
- name: Run tests
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ jobs:
with:
submodules: "recursive"
- uses: Swatinem/rust-cache@v2
- name: Install wasm32-wasi
run: rustup target add wasm32-wasi
- run: rm Cargo.lock
- name: Build
run: cargo check --tests
23 changes: 23 additions & 0 deletions crates/flow-server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,29 @@ mod tests {
dbg!(res);
}


#[tokio::test]
async fn test_flow_input() {
tracing_subscriber::fmt::try_init().ok();
let json = include_str!("../../../test_files/HTTP Request.json");
let flow_config = FlowConfig::new(serde_json::from_str::<TestFile>(json).unwrap().flow);
let mut flow = FlowGraph::from_cfg(flow_config, <_>::default(), None)
.await
.unwrap();
let (tx, _rx) = event_channel();
let res = flow
.run(
tx,
<_>::default(),
<_>::default(),
<_>::default(),
<_>::default(),
<_>::default(),
)
.await;
dbg!(res);
}

#[test]
fn test_name_unique() {
let mut m = std::collections::HashSet::new();
Expand Down
4 changes: 2 additions & 2 deletions crates/flow/src/command/flow_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl CommandTrait for FlowInputCommand {

fn outputs(&self) -> Vec<Output> {
[Output {
name: OUTPUT.into(),
name: self.label.clone(),
r#type: ValueType::Free,
optional: false,
}]
Expand All @@ -45,7 +45,7 @@ impl CommandTrait for FlowInputCommand {
async fn run(&self, _ctx: Context, mut inputs: ValueSet) -> Result<ValueSet, CommandError> {
let value = inputs.swap_remove(&self.label).unwrap_or(Value::Null);
Ok(value::map! {
OUTPUT => value,
&self.label => value,
})
}

Expand Down
Loading

0 comments on commit 0f86e5a

Please sign in to comment.