Skip to content

Commit 414c32c

Browse files
committed
test: failing regression for stale didYouMean props
1 parent 065407a commit 414c32c

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
"""Contract test for the didYouMean alert-type class's props.
2+
3+
The OpenAPI schema (`socket-sdk-js/openapi.json` around line 9298) declares
4+
that the API emits `didYouMean` alerts with ``props: { alternatePackage,
5+
detectedAt }``. The Python SDK previously declared four props
6+
(``alternatePackage``, ``downloads``, ``downloadsRatio``, ``editDistance``);
7+
the latter three are no longer in the API schema and were dead keys at
8+
runtime — and ``detectedAt`` was missing.
9+
10+
Tracks CUS2-5. Sibling of CUS2-4.
11+
"""
12+
13+
import unittest
14+
15+
from socketdev.core.issues import didYouMean
16+
17+
18+
class TestDidYouMeanProps(unittest.TestCase):
19+
def test_props_match_openapi_schema(self):
20+
"""API emits props { alternatePackage, detectedAt } (openapi.json:9298)."""
21+
issue = didYouMean()
22+
self.assertEqual(set(issue.props.keys()), {"alternatePackage", "detectedAt"})
23+
24+
def test_props_label_strings_are_non_empty(self):
25+
"""Every props key must have a non-empty human-readable label."""
26+
issue = didYouMean()
27+
for key, label in issue.props.items():
28+
self.assertTrue(label, f"props[{key!r}] label should not be empty")

0 commit comments

Comments
 (0)