MCPcopy
hub / github.com/ajv-validator/ajv / testTimestamp

Function testTimestamp

spec/jtd-timestamps.spec.ts:33–44  ·  view source on GitHub ↗
(
      opts: JTDOptions,
      valid: {Date: boolean; datetime: boolean; date: boolean}
    )

Source from the content-addressed store, hash-verified

31 })
32
33 function testTimestamp(
34 opts: JTDOptions,
35 valid: {Date: boolean; datetime: boolean; date: boolean}
36 ) {
37 const ajv = new _AjvJTD(opts)
38 const schema = {type: "timestamp"}
39 const validate = ajv.compile(schema)
40 assert.strictEqual(validate(new Date()), valid.Date)
41 assert.strictEqual(validate("2021-05-03T05:24:43.906Z"), valid.datetime)
42 assert.strictEqual(validate("2021-05-03"), valid.date)
43 assert.strictEqual(validate("foo"), false)
44 }
45 })
46
47 describe("parseDate option", () => {

Callers 1

Calls 2

validateFunction · 0.85
compileMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…