Skip to content

Commit 573ce01

Browse files
authored
Merge pull request #51 from JaredCE/improve-onSuccess-tests
Improve on success tests
2 parents ccec752 + 9570346 commit 573ce01

18 files changed

+2729
-3
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "arazzo-runner",
3-
"version": "0.0.19",
3+
"version": "0.0.20",
44
"description": "A runner to run through Arazzo Document workflows",
55
"main": "index.js",
66
"scripts": {
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
{
2+
"$schema": "https://spec.openapis.org/arazzo/1.0/schema/2025-10-15",
3+
"arazzo": "1.0.1",
4+
"info": {
5+
"title": "users",
6+
"description": "The Arazzo Workflow for a Pet Store User",
7+
"summary": "Araazo Workflow for Pet Store User",
8+
"version": "1.0.0"
9+
},
10+
"sourceDescriptions": [
11+
{
12+
"name": "users-openAPI",
13+
"url": "https://raw.githubusercontent.com/JaredCE/Arazzo-Runner/refs/heads/main/test/mocks/openapi/security/api-key/users-openapi.json",
14+
"type": "openapi"
15+
}
16+
],
17+
"workflows": [
18+
{
19+
"workflowId": "onSuccess-end",
20+
"summary": "Deletes the current user",
21+
"description": "Logs the user in and then deletes them",
22+
"inputs": {
23+
"type": "object",
24+
"properties": {
25+
"username": {
26+
"type": "string"
27+
},
28+
"password": {
29+
"type": "string"
30+
}
31+
}
32+
},
33+
"steps": [
34+
{
35+
"stepId": "LoginExistingUser",
36+
"operationId": "loginUser",
37+
"requestBody": {
38+
"contentType": "application/json",
39+
"payload": {
40+
"username": "$inputs.username",
41+
"password": "$inputs.password"
42+
}
43+
},
44+
"outputs": {
45+
"AccessToken": "$response.body#/AccessToken"
46+
},
47+
"successCriteria": [
48+
{
49+
"condition": "$statusCode == 200"
50+
}
51+
],
52+
"onSuccess": [
53+
{
54+
"criteria": [
55+
{
56+
"condition": "$statusCode == 200"
57+
}
58+
],
59+
"name": "EndOnSuccess",
60+
"type": "end"
61+
}
62+
]
63+
},
64+
{
65+
"stepId": "deleteUser",
66+
"operationId": "deleteUser",
67+
"parameters": [
68+
{
69+
"name": "Authorization",
70+
"in": "header",
71+
"value": "$steps.LoginExistingUser.outputs.AccessToken"
72+
},
73+
{
74+
"name": "username",
75+
"in": "path",
76+
"value": "$inputs.username"
77+
}
78+
]
79+
}
80+
]
81+
}
82+
]
83+
}
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
{
2+
"$schema": "https://spec.openapis.org/arazzo/1.0/schema/2025-10-15",
3+
"arazzo": "1.0.1",
4+
"info": {
5+
"title": "users",
6+
"description": "The Arazzo Workflow for a Pet Store User",
7+
"summary": "Araazo Workflow for Pet Store User",
8+
"version": "1.0.0"
9+
},
10+
"sourceDescriptions": [
11+
{
12+
"name": "users-openAPI",
13+
"url": "https://raw.githubusercontent.com/JaredCE/Arazzo-Runner/refs/heads/main/test/mocks/openapi/security/api-key/users-openapi.json",
14+
"type": "openapi"
15+
}
16+
],
17+
"workflows": [
18+
{
19+
"workflowId": "onSuccess-end-middleStep",
20+
"summary": "Deletes the current user",
21+
"description": "Logs the user in and then deletes them",
22+
"inputs": {
23+
"type": "object",
24+
"properties": {
25+
"username": {
26+
"type": "string"
27+
},
28+
"password": {
29+
"type": "string"
30+
}
31+
}
32+
},
33+
"steps": [
34+
{
35+
"stepId": "LoginExistingUser",
36+
"operationId": "loginUser",
37+
"requestBody": {
38+
"contentType": "application/json",
39+
"payload": {
40+
"username": "$inputs.username",
41+
"password": "$inputs.password"
42+
}
43+
},
44+
"outputs": {
45+
"AccessToken": "$response.body#/AccessToken"
46+
},
47+
"successCriteria": [
48+
{
49+
"condition": "$statusCode == 200"
50+
}
51+
],
52+
"onFailure": [
53+
{
54+
"criteria": [
55+
{
56+
"condition": "$statusCode == 400"
57+
}
58+
],
59+
"name": "EndOnError",
60+
"type": "end"
61+
}
62+
]
63+
},
64+
{
65+
"stepId": "getUser",
66+
"operationId": "getUserByName",
67+
"parameters": [
68+
{
69+
"name": "Authorization",
70+
"in": "header",
71+
"value": "$steps.LoginExistingUser.outputs.AccessToken"
72+
},
73+
{
74+
"name": "username",
75+
"in": "path",
76+
"value": "$inputs.username"
77+
}
78+
],
79+
"successCriteria": [
80+
{
81+
"condition": "$statusCode == 200"
82+
}
83+
],
84+
"onSuccess": [
85+
{
86+
"criteria": [
87+
{
88+
"condition": "$statusCode == 200"
89+
}
90+
],
91+
"name": "EndOnSuccess",
92+
"type": "end"
93+
}
94+
]
95+
},
96+
{
97+
"stepId": "deleteUser",
98+
"operationId": "deleteUser",
99+
"parameters": [
100+
{
101+
"name": "Authorization",
102+
"in": "header",
103+
"value": "$steps.LoginExistingUser.outputs.AccessToken"
104+
},
105+
{
106+
"name": "username",
107+
"in": "path",
108+
"value": "$inputs.username"
109+
}
110+
]
111+
}
112+
]
113+
}
114+
]
115+
}

test/mocks/arazzo/arazzo-rules/onSuccess/end/workflow/external-arazzo.json

Whitespace-only changes.
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
{
2+
"$schema": "https://spec.openapis.org/arazzo/1.0/schema/2025-10-15",
3+
"arazzo": "1.0.1",
4+
"info": {
5+
"title": "users",
6+
"description": "The Arazzo Workflow for a Pet Store User",
7+
"summary": "Araazo Workflow for Pet Store User",
8+
"version": "1.0.0"
9+
},
10+
"sourceDescriptions": [
11+
{
12+
"name": "users-openAPI",
13+
"url": "https://raw.githubusercontent.com/JaredCE/Arazzo-Runner/refs/heads/main/test/mocks/openapi/security/api-key/users-openapi.json",
14+
"type": "openapi"
15+
}
16+
],
17+
"workflows": [
18+
{
19+
"workflowId": "successActions-end",
20+
"summary": "Deletes the current user",
21+
"description": "Logs the user in and then deletes them",
22+
"inputs": {
23+
"type": "object",
24+
"properties": {
25+
"username": {
26+
"type": "string"
27+
},
28+
"password": {
29+
"type": "string"
30+
}
31+
}
32+
},
33+
"successActions": [
34+
{
35+
"criteria": [
36+
{
37+
"condition": "$statusCode == 200"
38+
}
39+
],
40+
"name": "WorkflowEndOnSuccess",
41+
"type": "end"
42+
}
43+
],
44+
"steps": [
45+
{
46+
"stepId": "LoginExistingUser",
47+
"operationId": "loginUser",
48+
"requestBody": {
49+
"contentType": "application/json",
50+
"payload": {
51+
"username": "$inputs.username",
52+
"password": "$inputs.password"
53+
}
54+
},
55+
"outputs": {
56+
"AccessToken": "$response.body#/AccessToken"
57+
},
58+
"successCriteria": [
59+
{
60+
"condition": "$statusCode == 200"
61+
}
62+
]
63+
},
64+
{
65+
"stepId": "deleteUser",
66+
"operationId": "deleteUser",
67+
"parameters": [
68+
{
69+
"name": "Authorization",
70+
"in": "header",
71+
"value": "$steps.LoginExistingUser.outputs.AccessToken"
72+
},
73+
{
74+
"name": "username",
75+
"in": "path",
76+
"value": "$inputs.username"
77+
}
78+
]
79+
}
80+
]
81+
}
82+
]
83+
}

0 commit comments

Comments
 (0)