A plain JavaScript validator for AT Protocol lexicon schemas
at main 160 lines 3.4 kB view raw
1// Test inputs for integer data validation 2 3export const integerDataInputs = [ 4 { 5 name: 'integer-data-valid-basic', 6 lexicons: [ 7 { 8 lexicon: 1, 9 id: 'test.integer.data', 10 defs: { 11 main: { 12 type: 'record', 13 key: 'tid', 14 record: { 15 type: 'object', 16 properties: { 17 count: { 18 type: 'integer', 19 minimum: 0, 20 maximum: 100, 21 }, 22 }, 23 }, 24 }, 25 }, 26 }, 27 ], 28 collection: 'test.integer.data', 29 record: { count: 42 }, 30 }, 31 { 32 name: 'integer-data-invalid-below-minimum', 33 lexicons: [ 34 { 35 lexicon: 1, 36 id: 'test.integer.min', 37 defs: { 38 main: { 39 type: 'record', 40 key: 'tid', 41 record: { 42 type: 'object', 43 properties: { 44 count: { 45 type: 'integer', 46 minimum: 10, 47 }, 48 }, 49 }, 50 }, 51 }, 52 }, 53 ], 54 collection: 'test.integer.min', 55 record: { count: 5 }, 56 }, 57 { 58 name: 'integer-data-invalid-above-maximum', 59 lexicons: [ 60 { 61 lexicon: 1, 62 id: 'test.integer.max', 63 defs: { 64 main: { 65 type: 'record', 66 key: 'tid', 67 record: { 68 type: 'object', 69 properties: { 70 count: { 71 type: 'integer', 72 maximum: 10, 73 }, 74 }, 75 }, 76 }, 77 }, 78 }, 79 ], 80 collection: 'test.integer.max', 81 record: { count: 15 }, 82 }, 83 { 84 name: 'integer-data-valid-enum', 85 lexicons: [ 86 { 87 lexicon: 1, 88 id: 'test.integer.enumvalid', 89 defs: { 90 main: { 91 type: 'record', 92 key: 'tid', 93 record: { 94 type: 'object', 95 properties: { 96 level: { 97 type: 'integer', 98 enum: [1, 2, 3], 99 }, 100 }, 101 }, 102 }, 103 }, 104 }, 105 ], 106 collection: 'test.integer.enumvalid', 107 record: { level: 2 }, 108 }, 109 { 110 name: 'integer-data-invalid-enum', 111 lexicons: [ 112 { 113 lexicon: 1, 114 id: 'test.integer.enuminvalid', 115 defs: { 116 main: { 117 type: 'record', 118 key: 'tid', 119 record: { 120 type: 'object', 121 properties: { 122 level: { 123 type: 'integer', 124 enum: [1, 2, 3], 125 }, 126 }, 127 }, 128 }, 129 }, 130 }, 131 ], 132 collection: 'test.integer.enuminvalid', 133 record: { level: 5 }, 134 }, 135 { 136 name: 'integer-data-invalid-wrong-type', 137 lexicons: [ 138 { 139 lexicon: 1, 140 id: 'test.integer.wrongtype', 141 defs: { 142 main: { 143 type: 'record', 144 key: 'tid', 145 record: { 146 type: 'object', 147 properties: { 148 count: { 149 type: 'integer', 150 }, 151 }, 152 }, 153 }, 154 }, 155 }, 156 ], 157 collection: 'test.integer.wrongtype', 158 record: { count: '42' }, 159 }, 160];