%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/after-pass-through.test.js

'use strict'

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

test('proper support for after with a passed async function in wrapped mode', (t, testCompleted) => {
  const app = {}
  boot(app)

  t.plan(5)

  const e = new Error('kaboom')

  app.use(function (f, opts) {
    return Promise.reject(e)
  }).after(function (err, cb) {
    t.assert.deepStrictEqual(err, e)
    cb(err)
  }).after(function () {
    t.assert.ok('this is just called')
  }).after(function (err, cb) {
    t.assert.deepStrictEqual(err, e)
    cb(err)
  })

  app.ready().then(() => {
    t.assert.fail('this should not be called')
  }).catch(err => {
    t.assert.ok(err)
    t.assert.strictEqual(err.message, 'kaboom')
    testCompleted()
  })
})

Zerion Mini Shell 1.0