A plain JavaScript validator for AT Protocol lexicon schemas
at main 121 lines 2.6 kB view raw
1// Test inputs for subscription data validation 2 3export const subscriptionDataInputs = [ 4 { 5 name: 'subscription-data-valid-parameters', 6 lexicons: [ 7 { 8 lexicon: 1, 9 id: 'test.subscription.data', 10 defs: { 11 main: { 12 type: 'subscription', 13 parameters: { 14 type: 'params', 15 properties: { 16 cursor: { type: 'integer' }, 17 }, 18 }, 19 }, 20 }, 21 }, 22 ], 23 collection: 'test.subscription.data', 24 record: { 25 cursor: 12345, 26 }, 27 }, 28 { 29 name: 'subscription-data-invalid-missing-required', 30 lexicons: [ 31 { 32 lexicon: 1, 33 id: 'test.subscription.missingreq', 34 defs: { 35 main: { 36 type: 'subscription', 37 parameters: { 38 type: 'params', 39 properties: { 40 collection: { type: 'string' }, 41 }, 42 required: ['collection'], 43 }, 44 }, 45 }, 46 }, 47 ], 48 collection: 'test.subscription.missingreq', 49 record: {}, 50 }, 51 { 52 name: 'subscription-data-valid-no-parameters', 53 lexicons: [ 54 { 55 lexicon: 1, 56 id: 'test.subscription.noparam', 57 defs: { 58 main: { 59 type: 'subscription', 60 }, 61 }, 62 }, 63 ], 64 collection: 'test.subscription.noparam', 65 record: {}, 66 }, 67 { 68 name: 'subscription-data-invalid-constraint-violation', 69 lexicons: [ 70 { 71 lexicon: 1, 72 id: 'test.subscription.constraint', 73 defs: { 74 main: { 75 type: 'subscription', 76 parameters: { 77 type: 'params', 78 properties: { 79 limit: { 80 type: 'integer', 81 maximum: 100, 82 }, 83 }, 84 }, 85 }, 86 }, 87 }, 88 ], 89 collection: 'test.subscription.constraint', 90 record: { 91 limit: 200, 92 }, 93 }, 94 { 95 name: 'subscription-data-valid-array-parameter', 96 lexicons: [ 97 { 98 lexicon: 1, 99 id: 'test.subscription.array', 100 defs: { 101 main: { 102 type: 'subscription', 103 parameters: { 104 type: 'params', 105 properties: { 106 repos: { 107 type: 'array', 108 items: { type: 'string' }, 109 }, 110 }, 111 }, 112 }, 113 }, 114 }, 115 ], 116 collection: 'test.subscription.array', 117 record: { 118 repos: ['did:plc:abc', 'did:plc:xyz'], 119 }, 120 }, 121];