-
-
Notifications
You must be signed in to change notification settings - Fork 219
/
asyncapi-channel-no-query-nor-fragment.test.ts
51 lines (48 loc) · 1.3 KB
/
asyncapi-channel-no-query-nor-fragment.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { DiagnosticSeverity } from '@stoplight/types';
import testRule from './__helpers__/tester';
testRule('asyncapi-channel-no-query-nor-fragment', [
{
name: 'valid case',
document: {
asyncapi: '2.0.0',
channels: {
'users/{userId}/signedUp': {},
},
},
errors: [],
},
{
name: 'channels.{channel} contains a query delimiter',
document: {
asyncapi: '2.0.0',
channels: {
'users/{userId}/signedUp': {},
'users/{userId}/signedOut?byMistake={didFatFingerTheSignOutButton}': {},
},
},
errors: [
{
message: 'Channel path must not include query ("?") or fragment ("#") delimiter.',
path: ['channels', 'users/{userId}/signedOut?byMistake={didFatFingerTheSignOutButton}'],
severity: DiagnosticSeverity.Warning,
},
],
},
{
name: 'channels.{channel} contains a fragment delimiter',
document: {
asyncapi: '2.0.0',
channels: {
'users/{userId}/signedUp': {},
'users/{userId}/signedOut#onPurpose': {},
},
},
errors: [
{
message: 'Channel path must not include query ("?") or fragment ("#") delimiter.',
path: ['channels', 'users/{userId}/signedOut#onPurpose'],
severity: DiagnosticSeverity.Warning,
},
],
},
]);