Skip to content
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
3 changes: 2 additions & 1 deletion crates/core/src/runtime/functions/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ fn r#if(
ctx.push_runtime_trace_label("branch=if".to_string());
run(*if_pointer, ctx)
} else {
Comment thread
raphael-goetz marked this conversation as resolved.
Signal::Return(Value {
ctx.push_runtime_trace_label("branch=else".to_string());
Signal::Success(Value {
kind: Some(Kind::NullValue(0)),
})
}
Expand Down
16 changes: 6 additions & 10 deletions crates/tests/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,29 +51,25 @@ impl Testable for Case {
"name": err.name,
"message": err.message,
});
return CaseResult::Failure(input, json);
if json != input.clone().expected_result {
return CaseResult::Failure(input, json);
}
}
taurus_core::context::signal::Signal::Success(value) => {
let json = to_json_value(value);
if json == input.clone().expected_result {
return CaseResult::Success;
} else {
if json != input.clone().expected_result {
return CaseResult::Failure(input, json);
}
}
taurus_core::context::signal::Signal::Return(value) => {
let json = to_json_value(value);
if json == input.clone().expected_result {
return CaseResult::Success;
} else {
if json != input.clone().expected_result {
return CaseResult::Failure(input, json);
}
}
taurus_core::context::signal::Signal::Respond(value) => {
let json = to_json_value(value);
if json == input.clone().expected_result {
return CaseResult::Success;
} else {
if json != input.clone().expected_result {
return CaseResult::Failure(input, json);
}
}
Expand Down
2 changes: 1 addition & 1 deletion flows/01_return_object.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"input": null,
"expected_result": {
"status_code": 200,
"http_status_code": 200,
"headers": {
"Header": "X"
},
Expand Down
4 changes: 2 additions & 2 deletions flows/02_return_flow_input.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"input": null,
"expected_result": {
"status_code": 200,
"http_status_code": 200,
"headers": {
"Authentication": "X"
},
Expand All @@ -23,7 +23,7 @@
]
},
"expected_result": {
"status_code": 200,
"http_status_code": 200,
"headers": {
"Authentication": "X"
},
Expand Down
7 changes: 2 additions & 5 deletions flows/04_example_action.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,8 @@
{
"input": null,
"expected_result": {
"status_code": 200,
"headers": {
"Header": "X"
},
"payload": "Hello World"
"message": "Remote runtime not configured",
"name": "RemoteRuntimeNotConfigured"
}
}
],
Expand Down
220 changes: 220 additions & 0 deletions flows/05_if_control.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,220 @@
{
"name": "05_if_control",
"description": "This flow expects an object as input (from http request) structured payload.test = bool which the flow will return",
"inputs": [
{
"input": {
"http_method": "GET",
"headers": {
"Content-Type": "text/plain"
},
"payload": {
"test": 1
}
},
"expected_result": {
"message": "Expected a bool value but received [Eval(Value { kind: Some(NumberValue(NumberValue { number: Some(Integer(1)) })) }), Thunk(12)]",
"name": "InvalidArgumentRuntimeError"
}
},
{
"input": {
"http_method": "GET",
"headers": {
"Content-Type": "text/plain"
},
"payload": {
"test": false
}
},
"expected_result": {
"http_status_code": 200,
"headers": {},
"payload": "Blub"
}
},
{
"input": {
"http_method": "GET",
"headers": {
"Content-Type": "text/plain"
},
"payload": {
"test": true
}
},
"expected_result": {
"http_status_code": 200,
"headers": {},
"payload": true
}
}
],
"flow": {
"flowId": "2",
"projectId": "1",
"type": "REST",
"settings": [
{
"databaseId": "3",
"flowSettingId": "httpURL",
"value": {
"stringValue": "/test2"
}
},
{
"databaseId": "4",
"flowSettingId": "httpMethod",
"value": {
"stringValue": "GET"
}
}
],
"startingNodeId": "11",
"nodeFunctions": [
{
"databaseId": "13",
"runtimeFunctionId": "rest::control::respond",
"parameters": [
{
"databaseId": "57",
"runtimeParameterId": "http_response",
"value": {
"referenceValue": {
"nodeId": "14"
}
}
}
]
},
{
"databaseId": "14",
"runtimeFunctionId": "http::response::create",
"parameters": [
{
"databaseId": "54",
"runtimeParameterId": "http_status_code",
"value": {
"literalValue": {
"numberValue": {
"integer": "200"
}
}
}
},
{
"databaseId": "55",
"runtimeParameterId": "headers",
"value": {
"literalValue": {
"structValue": {}
}
}
},
{
"databaseId": "56",
"runtimeParameterId": "payload",
"value": {
"literalValue": {
"stringValue": "Blub"
}
}
}
],
"nextNodeId": "13"
},
{
"databaseId": "11",
"runtimeFunctionId": "std::control::if",
"parameters": [
{
"databaseId": "49",
"runtimeParameterId": "condition",
"value": {
"referenceValue": {
"paths": [
{
"path": "payload"
},
{
"path": "test"
}
],
"flowInput": {}
}
}
},
{
"databaseId": "50",
"runtimeParameterId": "runnable",
"value": {
"nodeFunctionId": "12"
}
}
],
"nextNodeId": "14"
},
{
"databaseId": "15",
"runtimeFunctionId": "rest::control::respond",
"parameters": [
{
"databaseId": "58",
"runtimeParameterId": "http_response",
"value": {
"referenceValue": {
"nodeId": "12"
}
}
}
]
},
{
"databaseId": "12",
"runtimeFunctionId": "http::response::create",
"parameters": [
{
"databaseId": "51",
"runtimeParameterId": "http_status_code",
"value": {
"literalValue": {
"numberValue": {
"integer": "200"
}
}
}
},
{
"databaseId": "52",
"runtimeParameterId": "headers",
"value": {
"literalValue": {
"structValue": {}
}
}
},
{
"databaseId": "53",
"runtimeParameterId": "payload",
"value": {
"referenceValue": {
"paths": [
{
"path": "payload"
},
{
"path": "test"
}
],
"flowInput": {}
}
}
}
],
"nextNodeId": "15"
}
],
"projectSlug": "codezero-project",
"signature": "(httpURL: HTTP_URL, httpMethod: HTTP_METHOD): { payload: { test: BOOLEAN }, headers: { test: TEXT } }"
}
}
Loading