Skip to content

Commit

Permalink
chore: update rust discounts allocator function
Browse files Browse the repository at this point in the history
  • Loading branch information
mathiusj committed Jan 23, 2024
1 parent ade6840 commit 958902c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
10 changes: 10 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions discounts/rust/discounts-allocator/default/src/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use shopify_function::Result;
#[shopify_function_target(query_path = "src/run.graphql", schema_path = "schema.graphql")]
fn run(input: input::ResponseData) -> Result<output::FunctionRunResult> {
let no_discounts = output::FunctionRunResult {
line_discounts: Some(vec![]),
displayable_errors: Some(vec![]),
line_discounts: Some(vec![]),
displayable_errors: Some(vec![]),
};

Ok(no_discounts)
Expand All @@ -15,10 +15,11 @@ fn run(input: input::ResponseData) -> Result<output::FunctionRunResult> {
mod tests {
use super::*;
use shopify_function::run_function_with_input;
use run::output;

#[test]
fn test_result_with_no_discounts() -> Result<()> {
use run::output;

let result = run_function_with_input(
run,
r#"
Expand All @@ -30,12 +31,11 @@ mod tests {
"#,
)?;
let expected = output::FunctionRunResult {
line_discounts: Some(vec![]),
displayable_errors: Some(vec![]),
line_discounts: Some(vec![]),
displayable_errors: Some(vec![]),
};

assert_eq!(result, expected);
Ok(())
}

}

0 comments on commit 958902c

Please sign in to comment.