Something went wrong. Try again.
A plain JavaScript validator for AT Protocol lexicon schemas
Something went wrong. Try again.
2.6 kB · 119 lines
JavaScript
at main
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120// Test inputs for CID format validation
export const cidFormatInputs = [ { name: 'cid-valid-v1-base32', lexicons: [ { lexicon: 1, id: 'test.format.cid', defs: { main: { type: 'record', key: 'tid', record: { type: 'object', properties: { cid: { type: 'string', format: 'cid' }, }, }, }, }, }, ], collection: 'test.format.cid', record: { cid: 'bafybeigdyrzt5sfp7udm7hu76uh7y26nf3efuylqabf3oclgtqy55fbzdi' }, }, { name: 'cid-valid-v1-raw', lexicons: [ { lexicon: 1, id: 'test.format.cid', defs: { main: { type: 'record', key: 'tid', record: { type: 'object', properties: { cid: { type: 'string', format: 'cid' }, }, }, }, }, }, ], collection: 'test.format.cid', record: { cid: 'bafkreigh2akiscaildcqabsyg3dfr6chu3fgpregiymsck7e7aqa4s52zy' }, }, { name: 'cid-invalid-qmb-prefix', lexicons: [ { lexicon: 1, id: 'test.format.cid', defs: { main: { type: 'record', key: 'tid', record: { type: 'object', properties: { cid: { type: 'string', format: 'cid' }, }, }, }, }, }, ], collection: 'test.format.cid', record: { cid: 'QmbWqxBEKC3P8tqsKc98xmWNzrzDtRLMiMPL8wBuTGsMnR' }, }, { name: 'cid-invalid-too-short', lexicons: [ { lexicon: 1, id: 'test.format.cid', defs: { main: { type: 'record', key: 'tid', record: { type: 'object', properties: { cid: { type: 'string', format: 'cid' }, }, }, }, }, }, ], collection: 'test.format.cid', record: { cid: 'abc1234' }, }, { name: 'cid-invalid-empty', lexicons: [ { lexicon: 1, id: 'test.format.cid', defs: { main: { type: 'record', key: 'tid', record: { type: 'object', properties: { cid: { type: 'string', format: 'cid' }, }, }, }, }, }, ], collection: 'test.format.cid', record: { cid: '' }, },];