Skip to content

Commit 99c2a31

Browse files
committed
test: add tests for generating release description
1 parent 8438610 commit 99c2a31

File tree

16 files changed

+738
-1
lines changed

16 files changed

+738
-1
lines changed

.github/workflows/pr.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Pull Request
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- scripts/api-diff.js
7+
- tests/**
8+
9+
jobs:
10+
test-api-diff:
11+
name: Run API Diff Tests
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Use Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version-file: '.nvmrc'
21+
22+
- name: Run tests
23+
run: node --test

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v18.19.0
1+
v20.10.0
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"openapi": "3.0.3",
3+
"info": {
4+
"title": "Test API",
5+
"description": "A sample API to for testing",
6+
"version": "1.0.0"
7+
},
8+
"servers": [
9+
{
10+
"url": "https://api.example.com/v1"
11+
}
12+
],
13+
"paths": {
14+
"/user": {
15+
"post": {
16+
"summary": "Create a new user profile",
17+
"requestBody": {
18+
"required": true,
19+
"content": {
20+
"application/json": {
21+
"schema": {
22+
"$ref": "#/components/schemas/NewUser"
23+
}
24+
}
25+
}
26+
},
27+
"responses": {
28+
"201": {
29+
"description": "User created successfully",
30+
"content": {
31+
"application/json": {
32+
"schema": {
33+
"$ref": "#/components/schemas/User"
34+
}
35+
}
36+
}
37+
}
38+
}
39+
}
40+
}
41+
},
42+
"components": {
43+
"schemas": {
44+
"User": {
45+
"type": "object",
46+
"properties": {
47+
"id": {
48+
"type": "string"
49+
},
50+
"username": {
51+
"type": "string"
52+
},
53+
"email": {
54+
"type": "string"
55+
}
56+
}
57+
},
58+
"NewUser": {
59+
"type": "object",
60+
"required": [
61+
"name",
62+
"email"
63+
],
64+
"properties": {
65+
"username": {
66+
"type": "string"
67+
},
68+
"email": {
69+
"type": "string"
70+
}
71+
}
72+
}
73+
}
74+
}
75+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
## Modified
2+
- [POST] `/user`
3+
- `NewUser` modified in requestBody
4+
- `User` modified in requestBody, responses
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"openapi": "3.0.3",
3+
"info": {
4+
"title": "Test API",
5+
"description": "A sample API to for testing",
6+
"version": "1.0.0"
7+
},
8+
"servers": [
9+
{
10+
"url": "https://api.example.com/v1"
11+
}
12+
],
13+
"paths": {
14+
"/user": {
15+
"post": {
16+
"summary": "Create a new user profile",
17+
"requestBody": {
18+
"required": true,
19+
"content": {
20+
"application/json": {
21+
"schema": {
22+
"$ref": "#/components/schemas/NewUser"
23+
}
24+
}
25+
}
26+
},
27+
"responses": {
28+
"201": {
29+
"description": "User created successfully",
30+
"content": {
31+
"application/json": {
32+
"schema": {
33+
"$ref": "#/components/schemas/User"
34+
}
35+
}
36+
}
37+
}
38+
}
39+
}
40+
}
41+
},
42+
"components": {
43+
"schemas": {
44+
"User": {
45+
"type": "object",
46+
"properties": {
47+
"id": {
48+
"type": "string"
49+
},
50+
"name": {
51+
"type": "string"
52+
},
53+
"email": {
54+
"type": "string"
55+
}
56+
}
57+
},
58+
"NewUser": {
59+
"type": "object",
60+
"required": [
61+
"name",
62+
"email"
63+
],
64+
"properties": {
65+
"name": {
66+
"type": "string"
67+
},
68+
"email": {
69+
"type": "string"
70+
}
71+
}
72+
}
73+
}
74+
}
75+
}
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"openapi": "3.0.3",
3+
"info": {
4+
"title": "Test API",
5+
"description": "A sample API to for testing",
6+
"version": "1.0.0"
7+
},
8+
"servers": [
9+
{
10+
"url": "https://api.example.com/v1"
11+
}
12+
],
13+
"paths": {
14+
"/user": {
15+
"post": {
16+
"summary": "Create a new user",
17+
"requestBody": {
18+
"required": true,
19+
"content": {
20+
"application/json": {
21+
"schema": {
22+
"$ref": "#/components/schemas/NewUser"
23+
}
24+
}
25+
}
26+
},
27+
"responses": {
28+
"201": {
29+
"description": "User created",
30+
"content": {
31+
"application/json": {
32+
"schema": {
33+
"$ref": "#/components/schemas/User"
34+
}
35+
}
36+
}
37+
}
38+
}
39+
}
40+
}
41+
},
42+
"components": {
43+
"schemas": {
44+
"User": {
45+
"type": "object",
46+
"properties": {
47+
"id": {
48+
"type": "string"
49+
},
50+
"name": {
51+
"type": "string"
52+
},
53+
"email": {
54+
"type": "string"
55+
}
56+
}
57+
},
58+
"NewUser": {
59+
"type": "object",
60+
"required": [
61+
"name",
62+
"email"
63+
],
64+
"properties": {
65+
"name": {
66+
"type": "string"
67+
},
68+
"email": {
69+
"type": "string"
70+
}
71+
}
72+
}
73+
}
74+
}
75+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
## Modified
2+
- [POST] `/user`
3+
- responses
4+
- summary
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
{
2+
"openapi": "3.0.3",
3+
"info": {
4+
"title": "Test API",
5+
"description": "A sample API to for testing",
6+
"version": "1.0.0"
7+
},
8+
"servers": [
9+
{
10+
"url": "https://api.example.com/v1"
11+
}
12+
],
13+
"paths": {
14+
"/user": {
15+
"post": {
16+
"summary": "Create a new user profile",
17+
"requestBody": {
18+
"required": true,
19+
"content": {
20+
"application/json": {
21+
"schema": {
22+
"$ref": "#/components/schemas/NewUser"
23+
}
24+
}
25+
}
26+
},
27+
"responses": {
28+
"201": {
29+
"description": "User created successfully",
30+
"content": {
31+
"application/json": {
32+
"schema": {
33+
"$ref": "#/components/schemas/User"
34+
}
35+
}
36+
}
37+
}
38+
}
39+
}
40+
}
41+
},
42+
"components": {
43+
"schemas": {
44+
"User": {
45+
"type": "object",
46+
"properties": {
47+
"id": {
48+
"type": "string"
49+
},
50+
"name": {
51+
"type": "string"
52+
},
53+
"email": {
54+
"type": "string"
55+
}
56+
}
57+
},
58+
"NewUser": {
59+
"type": "object",
60+
"required": [
61+
"name",
62+
"email"
63+
],
64+
"properties": {
65+
"name": {
66+
"type": "string"
67+
},
68+
"email": {
69+
"type": "string"
70+
}
71+
}
72+
}
73+
}
74+
}
75+
}

0 commit comments

Comments
 (0)