Skip to content

Commit a68acb3

Browse files
author
hanquliu
committed
test: migrated plugin-loaded-so-far.test.js from tap to node:test
1 parent 433468a commit a68acb3

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

test/plugin-loaded-so-far.test.js

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
'use strict'
22

3-
const { test } = require('tap')
3+
const { test } = require('node:test')
44
const fastq = require('fastq')
55
const boot = require('..')
66
const { Plugin } = require('../lib/plugin')
77

88
test('loadedSoFar resolves a Promise, if plugin.loaded is set to true', async (t) => {
9-
t.plan(1)
109
const app = boot({})
1110

1211
const plugin = new Plugin(fastq(app, app._loadPluginNextTick, 1), function (instance, opts, done) {
@@ -15,28 +14,27 @@ test('loadedSoFar resolves a Promise, if plugin.loaded is set to true', async (t
1514

1615
plugin.loaded = true
1716

18-
await t.resolves(plugin.loadedSoFar())
17+
await plugin.loadedSoFar()
1918
})
2019

2120
test('loadedSoFar resolves a Promise, if plugin was loaded by avvio', async (t) => {
22-
t.plan(2)
21+
t.plan(1)
2322
const app = boot({})
2423

2524
const plugin = new Plugin(fastq(app, app._loadPluginNextTick, 1), function (instance, opts, done) {
2625
done()
2726
}, false, 0)
2827

2928
app._loadPlugin(plugin, function (err) {
30-
t.equal(err, undefined)
29+
t.assert.ifError(err)
3130
})
3231

3332
await app.ready()
3433

35-
await t.resolves(plugin.loadedSoFar())
34+
await plugin.loadedSoFar()
3635
})
3736

3837
test('loadedSoFar resolves a Promise, if .after() has no error', async t => {
39-
t.plan(1)
4038
const app = boot()
4139

4240
app.after = function (callback) {
@@ -49,7 +47,7 @@ test('loadedSoFar resolves a Promise, if .after() has no error', async t => {
4947

5048
app._loadPlugin(plugin, function () {})
5149

52-
await t.resolves(plugin.loadedSoFar())
50+
await plugin.loadedSoFar()
5351
})
5452

5553
test('loadedSoFar rejects a Promise, if .after() has an error', async t => {
@@ -66,12 +64,10 @@ test('loadedSoFar rejects a Promise, if .after() has an error', async t => {
6664

6765
app._loadPlugin(plugin, function () {})
6866

69-
await t.rejects(plugin.loadedSoFar(), new Error('ArbitraryError'))
67+
await t.assert.rejects(plugin.loadedSoFar(), new Error('ArbitraryError'))
7068
})
7169

7270
test('loadedSoFar resolves a Promise, if Plugin is attached to avvio after it the Plugin was instantiated', async t => {
73-
t.plan(1)
74-
7571
const plugin = new Plugin(fastq(null, null, 1), function (instance, opts, done) {
7672
done()
7773
}, false, 0)
@@ -80,5 +76,5 @@ test('loadedSoFar resolves a Promise, if Plugin is attached to avvio after it th
8076

8177
plugin.server = boot()
8278
plugin.emit('start')
83-
await t.resolves(promise)
79+
await promise
8480
})

0 commit comments

Comments
 (0)