-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: migrate from tap to node test and c8 (#248)
* migrate test suite from tap to node:test * update c8 coverage to 100% * migrate ESM test from tap to node:test * test: remove unnecessary async from test functions --------- Co-authored-by: Simone Busoli <simone.busoli@gmail.com>
- Loading branch information
1 parent
97ec7bc
commit 9481e92
Showing
10 changed files
with
117 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,14 @@ | ||
'use strict' | ||
|
||
const t = require('tap') | ||
const test = t.test | ||
const { test } = require('node:test') | ||
const fp = require('../plugin') | ||
|
||
test('anonymous function should be named composite.test0', t => { | ||
test('anonymous function should be named composite.test0', (t) => { | ||
t.plan(2) | ||
|
||
const fn = fp((fastify, opts, next) => { | ||
next() | ||
}) | ||
|
||
t.equal(fn[Symbol.for('plugin-meta')].name, 'composite.test-auto-0') | ||
t.equal(fn[Symbol.for('fastify.display-name')], 'composite.test-auto-0') | ||
t.assert.strictEqual(fn[Symbol.for('plugin-meta')].name, 'composite.test-auto-0') | ||
t.assert.strictEqual(fn[Symbol.for('fastify.display-name')], 'composite.test-auto-0') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,11 @@ | ||
import t from 'tap' | ||
|
||
import { test } from 'node:test' | ||
import fp from '../../plugin.js' | ||
|
||
t.test('esm base support', async t => { | ||
test('esm base support', (t) => { | ||
fp((fastify, opts, next) => { | ||
next() | ||
}, { | ||
fastify: '^5.0.0' | ||
}) | ||
|
||
t.end() | ||
t.assert.ok(true, 'fp function called without throwing an error') | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
'use strict' | ||
|
||
const t = require('tap') | ||
const test = t.test | ||
const { test } = require('node:test') | ||
const fp = require('../plugin') | ||
|
||
test('anonymous function should be named mu1tip1e.composite.test', t => { | ||
test('anonymous function should be named mu1tip1e.composite.test', (t) => { | ||
t.plan(2) | ||
|
||
const fn = fp((fastify, opts, next) => { | ||
next() | ||
}) | ||
|
||
t.equal(fn[Symbol.for('plugin-meta')].name, 'mu1tip1e.composite.test-auto-0') | ||
t.equal(fn[Symbol.for('fastify.display-name')], 'mu1tip1e.composite.test-auto-0') | ||
t.assert.strictEqual(fn[Symbol.for('plugin-meta')].name, 'mu1tip1e.composite.test-auto-0') | ||
t.assert.strictEqual(fn[Symbol.for('fastify.display-name')], 'mu1tip1e.composite.test-auto-0') | ||
}) |
Oops, something went wrong.