Skip to content

Commit 8e0e619

Browse files
committed
add fixtures
1 parent a5f38b9 commit 8e0e619

File tree

3 files changed

+27
-6
lines changed

3 files changed

+27
-6
lines changed

src/engine.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,6 @@ pub fn run(params: FunctionRunParams) -> Result<FunctionRunResult> {
292292
fn try_parse_as_msgpack(raw_output: &[u8]) -> FunctionOutput {
293293
match rmp_serde::from_slice::<serde_json::Value>(raw_output) {
294294
Ok(json_output) => {
295-
// If we get a number that matches the first byte's ASCII value, it's likely text
296295
if let Some(n) = json_output.as_u64() {
297296
if n < 127 && raw_output.len() > 1 && raw_output[0] as u64 == n {
298297
// This is likely text being misinterpreted as a number
@@ -477,10 +476,8 @@ mod tests {
477476
let module = Module::from_file(&Engine::default(), module_path).unwrap();
478477
assert!(!uses_wasm_api_provider(&module));
479478

480-
// This test will only pass if you have a test function compiled with the wasm api provider
481-
// If this test fails, you may need to create such a test fixture.
482-
// let wasm_api_module_path = Path::new("tests/fixtures/build/wasm_api_function.wasm");
483-
// let wasm_api_module = Module::from_file(&Engine::default(), wasm_api_module_path).unwrap();
484-
// assert!(uses_wasm_api_provider(&wasm_api_module));
479+
let wasm_api_module_path = Path::new("tests/fixtures/build/wasm_api_function.merged.wasm");
480+
let wasm_api_module = Module::from_file(&Engine::default(), wasm_api_module_path).unwrap();
481+
assert!(uses_wasm_api_provider(&wasm_api_module));
485482
}
486483
}
85.6 KB
Binary file not shown.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"cart": {
3+
"lines": [
4+
{
5+
"merchandise": {
6+
"id": "gid://shopify/ProductVariant/1",
7+
"title": "Sample Product"
8+
},
9+
"quantity": 2,
10+
"cost": {
11+
"totalAmount": {
12+
"amount": "24.99",
13+
"currencyCode": "USD"
14+
}
15+
}
16+
}
17+
]
18+
},
19+
"discounts": {
20+
"metafield": {
21+
"value": "{\"percentage\":20,\"applicable_items\":[\"gid://shopify/ProductVariant/1\"]}"
22+
}
23+
}
24+
}

0 commit comments

Comments
 (0)