Skip to content

Commit 7b84298

Browse files
committed
chore: add missing smoke and e2e tests
1 parent be6bbf2 commit 7b84298

File tree

6 files changed

+71
-2
lines changed

6 files changed

+71
-2
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
openapi: 3.1.0
2+
info:
3+
title: Food Empire API
4+
version: 0.5.1
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
extends:
2+
- ruleset.yaml
3+
4+
apis:
5+
main:
6+
root: ./openapi.yaml
7+
rules:
8+
rule/test-license: warn # should not be highlighted
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
rules:
2+
rule/test-license: # the default severity (error) of this configurable rule will be overwritten in redocly.yaml
3+
subject:
4+
type: Info
5+
property: license
6+
assertions:
7+
defined: true
8+
rule/test-description:
9+
subject:
10+
type: Info
11+
property: description
12+
assertions:
13+
defined: true
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`E2E lint assertions-severity-override 1`] = `
4+
5+
validating openapi.yaml...
6+
[1] openapi.yaml:3:3 at #/info/description
7+
8+
rule/test-description failed because the Info description didn't meet the assertions: Should be defined
9+
10+
1 | openapi: 3.1.0
11+
2 | info:
12+
3 | title: Food Empire API
13+
| ^^^^^^^^^^^^^^^^^^^^^^
14+
4 | version: 0.5.1
15+
| ^^^^^^^^^^^^^^
16+
5 |
17+
18+
Error was generated by the rule/test-description rule.
19+
20+
21+
[2] openapi.yaml:3:3 at #/info/license
22+
23+
rule/test-license failed because the Info license didn't meet the assertions: Should be defined
24+
25+
1 | openapi: 3.1.0
26+
2 | info:
27+
3 | title: Food Empire API
28+
| ^^^^^^^^^^^^^^^^^^^^^^
29+
4 | version: 0.5.1
30+
| ^^^^^^^^^^^^^^
31+
5 |
32+
33+
Warning was generated by the rule/test-license rule.
34+
35+
36+
openapi.yaml: validated in <test>ms
37+
38+
❌ Validation failed with 1 error and 1 warning.
39+
run \`redocly lint --generate-ignore-file\` to add all problems to the ignore file.
40+
41+
42+
`;

__tests__/smoke/openapi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,5 @@ paths:
1717
application/json:
1818
schema:
1919
$ref: ./message-schema.yaml
20+
400:
21+
$ref: https://raw.githubusercontent.com/Redocly/redocly-cli/refs/heads/main/resources/museum.yaml#/components/responses/BadRequest

__tests__/smoke/run-smoke.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@ $2 redocly-lint
1717
$2 redocly-bundle
1818
$2 redocly-build-docs
1919
# Check for broken styles (related issue: https://github.com/Redocly/redocly-cli/issues/1073)
20-
if [[ "$(wc -l redoc-static.html)" == "294 redoc-static.html" ]]; then
20+
if [[ "$(wc -l redoc-static.html)" == "300 redoc-static.html" ]]; then
2121
echo "Docs built correctly."
2222
else
23-
echo "Docs built incorrectly. Received lines: $(wc -l redoc-static.html) (expected 294 lines in redoc-static.html)."
23+
echo "Docs built incorrectly. Received lines: $(wc -l redoc-static.html) (expected 300 lines in redoc-static.html)."
2424
exit 1
2525
fi

0 commit comments

Comments
 (0)