Something went wrong. Try again.
A plain JavaScript validator for AT Protocol lexicon schemas
Something went wrong. Try again.
3.2 kB · 142 lines
JavaScript
at main
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143// Test inputs for datetime format validation
export const datetimeFormatInputs = [ { name: 'datetime-valid-utc', lexicons: [ { lexicon: 1, id: 'test.format.datetime', defs: { main: { type: 'record', key: 'tid', record: { type: 'object', properties: { createdAt: { type: 'string', format: 'datetime' }, }, }, }, }, }, ], collection: 'test.format.datetime', record: { createdAt: '2024-01-01T12:00:00Z' }, }, { name: 'datetime-valid-with-offset', lexicons: [ { lexicon: 1, id: 'test.format.datetime', defs: { main: { type: 'record', key: 'tid', record: { type: 'object', properties: { createdAt: { type: 'string', format: 'datetime' }, }, }, }, }, }, ], collection: 'test.format.datetime', record: { createdAt: '2024-01-01T12:00:00+00:00' }, }, { name: 'datetime-valid-with-milliseconds', lexicons: [ { lexicon: 1, id: 'test.format.datetime', defs: { main: { type: 'record', key: 'tid', record: { type: 'object', properties: { createdAt: { type: 'string', format: 'datetime' }, }, }, }, }, }, ], collection: 'test.format.datetime', record: { createdAt: '2024-01-01T12:00:00.123Z' }, }, { name: 'datetime-invalid-negative-zero-offset', lexicons: [ { lexicon: 1, id: 'test.format.datetime', defs: { main: { type: 'record', key: 'tid', record: { type: 'object', properties: { createdAt: { type: 'string', format: 'datetime' }, }, }, }, }, }, ], collection: 'test.format.datetime', record: { createdAt: '2024-01-01T12:00:00-00:00' }, }, { name: 'datetime-invalid-feb-30', lexicons: [ { lexicon: 1, id: 'test.format.datetime', defs: { main: { type: 'record', key: 'tid', record: { type: 'object', properties: { createdAt: { type: 'string', format: 'datetime' }, }, }, }, }, }, ], collection: 'test.format.datetime', record: { createdAt: '2024-02-30T12:00:00Z' }, }, { name: 'datetime-invalid-empty', lexicons: [ { lexicon: 1, id: 'test.format.datetime', defs: { main: { type: 'record', key: 'tid', record: { type: 'object', properties: { createdAt: { type: 'string', format: 'datetime' }, }, }, }, }, }, ], collection: 'test.format.datetime', record: { createdAt: '' }, },];