Back | Home
الـ Path الحالي: /home/picotech/domains/instantly.picotech.app/public_html/public/uploads/../uploads/../../../../instantly.picotech.app/homes/../../wa.picotech.app/public_html/node_modules/escape-html/../querystring/../@protobufjs/../delayed-stream/../validator/../cheerio/../hasown/../strtok3/../mime/../cookie/../lodash.clonedeep/../css-what/../entities/../http/../hasown/../http/../wrappy/../@eshaz/../strtok3/../engine.io/../ieee754/../pino/test
الملفات الموجودة في هذا الـ Path:
.
..
basic.test.js
broken-pipe.test.js
browser-levels.test.js
browser-serializers.test.js
browser-timestamp.test.js
browser-transmit.test.js
browser.test.js
complex-objects.test.js
crlf.test.js
custom-levels.test.js
error.test.js
escaping.test.js
esm
exit.test.js
final.test.js
fixtures
formatters.test.js
helper.d.ts
helper.js
hooks.test.js
http.test.js
is-level-enabled.test.js
jest
levels.test.js
metadata.test.js
mixin-merge-strategy.test.js
mixin.test.js
multistream.test.js
pretty.test.js
redact.test.js
serializers.test.js
stdout-protection.test.js
syncfalse.test.js
timestamp.test.js
transport
types

مشاهدة ملف: browser-timestamp.test.js

'use strict'
const test = require('tape')
const pino = require('../browser')

Date.now = () => 1599400603614

test('null timestamp', ({ end, is }) => {
  const instance = pino({
    timestamp: pino.stdTimeFunctions.nullTime,
    browser: {
      asObject: true,
      write: function (o) {
        is(o.time, undefined)
      }
    }
  })
  instance.info('hello world')
  end()
})

test('iso timestamp', ({ end, is }) => {
  const instance = pino({
    timestamp: pino.stdTimeFunctions.isoTime,
    browser: {
      asObject: true,
      write: function (o) {
        is(o.time, '2020-09-06T13:56:43.614Z')
      }
    }
  })
  instance.info('hello world')
  end()
})

test('epoch timestamp', ({ end, is }) => {
  const instance = pino({
    timestamp: pino.stdTimeFunctions.epochTime,
    browser: {
      asObject: true,
      write: function (o) {
        is(o.time, 1599400603614)
      }
    }
  })
  instance.info('hello world')
  end()
})

test('unix timestamp', ({ end, is }) => {
  const instance = pino({
    timestamp: pino.stdTimeFunctions.unixTime,
    browser: {
      asObject: true,
      write: function (o) {
        is(o.time, Math.round(1599400603614 / 1000.0))
      }
    }
  })
  instance.info('hello world')
  end()
})

test('epoch timestamp by default', ({ end, is }) => {
  const instance = pino({
    browser: {
      asObject: true,
      write: function (o) {
        is(o.time, 1599400603614)
      }
    }
  })
  instance.info('hello world')
  end()
})

test('not print timestamp if the option is false', ({ end, is }) => {
  const instance = pino({
    timestamp: false,
    browser: {
      asObject: true,
      write: function (o) {
        is(o.time, undefined)
      }
    }
  })
  instance.info('hello world')
  end()
})