Aktueller Stand

This commit is contained in:
2026-01-22 19:05:45 +01:00
parent 85dee61a4d
commit e280e4eadb
1967 changed files with 397327 additions and 74093 deletions

View File

@@ -1,52 +0,0 @@
'use strict'
const { test } = require('tap')
const express = require('express')
const http = require('node:http')
const boot = require('..')
test('express support', (t) => {
const app = express()
boot.express(app)
// It does:
//
// boot(app, {
// expose: {
// use: 'load'
// }
// })
t.plan(2)
let loaded = false
let server
app.load(function (app, opts, done) {
loaded = true
app.use(function (req, res) {
res.end('hello world')
})
done()
})
app.after((cb) => {
t.ok(loaded, 'plugin loaded')
server = app.listen(0, cb)
t.teardown(server.close.bind(server))
})
app.ready(() => {
http.get(`http://localhost:${server.address().port}`).on('response', function (res) {
let data = ''
res.on('data', function (chunk) {
data += chunk
})
res.on('end', function () {
t.equal(data, 'hello world')
})
})
})
})

View File

@@ -1,6 +1,6 @@
'use strict'
const { test, mock } = require('tap')
const { test, mockRequire } = require('tap')
const { kThenifyDoNotWrap } = require('../../lib/symbols')
test('thenify', (t) => {
@@ -9,7 +9,7 @@ test('thenify', (t) => {
t.test('return undefined if booted', (t) => {
t.plan(2)
const { thenify } = mock('../../lib/thenify', {
const { thenify } = mockRequire('../../lib/thenify', {
'../../lib/debug': {
debug: (message) => { t.equal(message, 'thenify returning undefined because we are already booted') }
}
@@ -33,7 +33,7 @@ test('thenify', (t) => {
t.test('return PromiseConstructorLike if kThenifyDoNotWrap is false', (t) => {
t.plan(3)
const { thenify } = mock('../../lib/thenify', {
const { thenify } = mockRequire('../../lib/thenify', {
'../../lib/debug': {
debug: (message) => { t.equal(message, 'thenify') }
}
@@ -49,7 +49,7 @@ test('thenify', (t) => {
t.test('return PromiseConstructorLike', (t) => {
t.plan(3)
const { thenify } = mock('../../lib/thenify', {
const { thenify } = mockRequire('../../lib/thenify', {
'../../lib/debug': {
debug: (message) => { t.equal(message, 'thenify') }
}

View File

@@ -31,6 +31,17 @@ test('catch an error when loading a plugin with sync function', (t) => {
})
})
test('successfully load a plugin with sync function without done as a parameter', (t) => {
t.plan(1)
const app = boot({})
const plugin = new Plugin(fastq(app, app._loadPluginNextTick, 1), function (instance, opts) { }, false, 0)
app._loadPlugin(plugin, function (err) {
t.equal(err, undefined)
})
})
test('successfully load a plugin with async function', (t) => {
t.plan(1)
const app = boot({})

18
backend/node_modules/avvio/test/no-done.test.js generated vendored Normal file
View File

@@ -0,0 +1,18 @@
'use strict'
const { test } = require('tap')
const boot = require('..')
test('not taking done does not throw error.', (t) => {
t.plan(2)
const app = boot()
app.use(noDone).ready((err) => {
t.notOk(err, 'no error')
})
function noDone (s, opts) {
t.pass('did not throw')
}
})