Skip to content

Commit

Permalink
fix: broken assertion table af asserts is empty but tests is not (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
krummbar authored Jun 27, 2024
1 parent 2bcbd3d commit 3e22ed8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 20 deletions.
18 changes: 0 additions & 18 deletions docs/examples/report-result.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ Pass
| :white_check_mark: | assert | res.body.message Authentication successful | |



</details>

### 🟢 auth/basic/via auth/Basic Auth 401 - 2/2 - ⌛0.2 s</h3>
Expand All @@ -79,7 +78,6 @@ Pass
| :white_check_mark: | assert | res.body Unauthorized | |



</details>

### 🟢 auth/basic/via script/Basic Auth 200 - 2/2 - ⌛0.239 s</h3>
Expand All @@ -104,7 +102,6 @@ Pass
| :white_check_mark: | assert | res.body.message Authentication successful | |



</details>

### 🟢 auth/basic/via script/Basic Auth 401 - 2/2 - ⌛0.21 s</h3>
Expand All @@ -129,7 +126,6 @@ Pass
| :white_check_mark: | assert | res.body Unauthorized | |



</details>

### 🟢 auth/bearer/via auth/Bearer Auth 200 - 2/2 - ⌛0.476 s</h3>
Expand All @@ -154,7 +150,6 @@ Pass
| :white_check_mark: | assert | res.body.message Authentication successful | |



</details>

### 🟢 auth/bearer/via auth/Bearer Auth 401 - 2/2 - ⌛0.494 s</h3>
Expand All @@ -179,7 +174,6 @@ Pass
| :white_check_mark: | assert | res.body.message Unauthorized | |



</details>

### 🟢 auth/bearer/via headers/Bearer Auth 200 - 2/2 - ⌛0.549 s</h3>
Expand All @@ -204,7 +198,6 @@ Pass
| :white_check_mark: | assert | res.body.message Authentication successful | |



</details>

### 🟢 auth/bearer/via headers/Bearer Auth 401 - 2/2 - ⌛0.502 s</h3>
Expand All @@ -229,7 +222,6 @@ Pass
| :white_check_mark: | assert | res.body.message Unauthorized | |



</details>

### 🟢 auth/cookie/Login - 0/0 - ⌛0.193 s</h3>
Expand Down Expand Up @@ -409,7 +401,6 @@ Pass

| Status | Type | Expression | Error |
| :----: | ---- | ---------- | ----- |

| :white_check_mark: | test | should return parsed xml | |


Expand Down Expand Up @@ -524,7 +515,6 @@ Pass
| :white_check_mark: | assert | res.body.message Authentication successful | |



</details>

### 🟢 auth/basic/via auth/Basic Auth 401 - 2/2 - ⌛0.202 s</h3>
Expand All @@ -549,7 +539,6 @@ Pass
| :white_check_mark: | assert | res.body Unauthorized | |



</details>

### 🟢 auth/basic/via script/Basic Auth 200 - 2/2 - ⌛0.204 s</h3>
Expand All @@ -574,7 +563,6 @@ Pass
| :white_check_mark: | assert | res.body.message Authentication successful | |



</details>

### 🟢 auth/basic/via script/Basic Auth 401 - 2/2 - ⌛0.205 s</h3>
Expand All @@ -599,7 +587,6 @@ Pass
| :white_check_mark: | assert | res.body Unauthorized | |



</details>

### 🟢 auth/bearer/via auth/Bearer Auth 200 - 2/2 - ⌛0.486 s</h3>
Expand All @@ -624,7 +611,6 @@ Pass
| :white_check_mark: | assert | res.body.message Authentication successful | |



</details>

### 🟢 auth/bearer/via auth/Bearer Auth 401 - 2/2 - ⌛0.212 s</h3>
Expand All @@ -649,7 +635,6 @@ Pass
| :white_check_mark: | assert | res.body.message Unauthorized | |



</details>

### 🟢 auth/bearer/via headers/Bearer Auth 200 - 2/2 - ⌛0.192 s</h3>
Expand All @@ -674,7 +659,6 @@ Pass
| :white_check_mark: | assert | res.body.message Authentication successful | |



</details>

### 🟢 auth/bearer/via headers/Bearer Auth 401 - 2/2 - ⌛0.224 s</h3>
Expand All @@ -699,7 +683,6 @@ Pass
| :white_check_mark: | assert | res.body.message Unauthorized | |



</details>

### 🟢 auth/cookie/Login - 0/0 - ⌛0.198 s</h3>
Expand Down Expand Up @@ -879,7 +862,6 @@ Pass

| Status | Type | Expression | Error |
| :----: | ---- | ---------- | ----- |

| :white_check_mark: | test | should return parsed xml | |


Expand Down
21 changes: 19 additions & 2 deletions src/bru-md-utils.jq
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,33 @@ def md_assert_table_assert_row:
"| \(get_status_icon(.status)) | assert | \(.lhsExpr) \(.rhsExpr // "--") | \(.error // "") |"
;


def md_assert_table_assert_rows:
if (.assertionResults | length > 0) then
"\([ .assertionResults[] | md_assert_table_assert_row ] | join("\n"))\n"
else
""
end
;

def md_assert_table_test_row:
"| \(get_status_icon(.status)) | test | \(.description // "--") | \(.error // "") |"
;

def md_assert_table_test_rows:
if (.testResults | length > 0) then
([ .testResults[] | md_assert_table_test_row ] | join("\n")) + "\n"
else
""
end
;

def md_assert_table:
if (. | count_verify_steps > 0) then
"| Status | Type | Expression | Error |\n" +
"| :----: | ---- | ---------- | ----- |\n" +
([ .assertionResults[] | md_assert_table_assert_row ] | join("\n")) + "\n" +
([ .testResults[] | md_assert_table_test_row ] | join("\n")) + "\n"
"\( . | md_assert_table_assert_rows )" +
"\( . | md_assert_table_test_rows )"
else
"> **None**\n"
end
Expand Down

0 comments on commit 3e22ed8

Please sign in to comment.