1 2 3 4 5 6 7 8 9 10 11 12 13 14const { describe, it, mock } = require('node:test') const assert = require('node:assert') const main = require('./main') describe('main.js', () => { describe('main', () => { it('should start the server', async () => { const startServer = mock.fn(() => Promise.resolve()) await main(startServer) assert.equal(startServer.mock.calls.length, 1) }) }) })