%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /home2/rezakur1/api.rezakurnia.com/zh-router/node_modules/avvio/test/
Upload File :
Create Path :
Current File : /home2/rezakur1/api.rezakurnia.com/zh-router/node_modules/avvio/test/on-ready-timeout-await.test.js

'use strict'

/* eslint no-prototype-builtins: off */

const { test } = require('node:test')
const boot = require('..')

test('onReadyTimeout', async (t) => {
  const app = boot({}, {
    timeout: 10, // 10 ms
    autostart: false
  })

  app.use(function one (innerApp, opts, next) {
    t.assert.ok('loaded')
    innerApp.ready(function readyNoResolve (err, done) {
      t.assert.ifError(err)
      t.assert.ok('first ready called')
      // Do not call done() to timeout
    })
    next()
  })

  await app.start()

  try {
    await app.ready()
    t.assert.fail('should throw')
  } catch (err) {
    t.assert.strictEqual(err.message, 'Plugin did not start in time: \'readyNoResolve\'. You may have forgotten to call \'done\' function or to resolve a Promise')
    // And not Plugin did not start in time: 'bound _encapsulateThreeParam'. You may have forgotten to call 'done' function or to resolve a Promise
  }
})

Zerion Mini Shell 1.0