generated from fastify/skeleton
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: migrate from tap to node:test and c8
- Loading branch information
1 parent
31ae5c3
commit d210b26
Showing
4 changed files
with
11 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,26 @@ | ||
'use strict' | ||
|
||
const test = require('tap').test | ||
const { test } = require('node:test') | ||
const testCases = require('./testCases') | ||
const Negotiator = require('../index').Negotiator | ||
|
||
test('should create Negotiator-Instances', t => { | ||
t.plan(2) | ||
t.ok(new Negotiator() instanceof Negotiator) | ||
t.ok(Negotiator() instanceof Negotiator) | ||
t.assert.ok(new Negotiator() instanceof Negotiator) | ||
t.assert.ok(Negotiator() instanceof Negotiator) | ||
}) | ||
|
||
for (const [header, supportedEncodings, expected] of testCases) { | ||
test(`should return ${expected} when ${header} and ${supportedEncodings}`, t => { | ||
t.plan(4) | ||
const negotiatorNoCache = new Negotiator({ supportedValues: supportedEncodings }) | ||
t.equal(negotiatorNoCache.negotiate(header), expected, `should return ${expected} when ${header} and ${supportedEncodings}`) | ||
t.assert.strictEqual(negotiatorNoCache.negotiate(header), expected, `should return ${expected} when ${header} and ${supportedEncodings}`) | ||
|
||
const negotiatorNonClass = Negotiator({ supportedValues: supportedEncodings }) | ||
t.equal(negotiatorNonClass.negotiate(header), expected, `should return ${expected} when ${header} and ${supportedEncodings}`) | ||
t.assert.strictEqual(negotiatorNonClass.negotiate(header), expected, `should return ${expected} when ${header} and ${supportedEncodings}`) | ||
|
||
const negotiatorCache = new Negotiator({ supportedValues: supportedEncodings, cache: new Map() }) | ||
t.equal(negotiatorCache.negotiate(header), expected, `should return ${expected} when ${header} and ${supportedEncodings}`) | ||
t.equal(negotiatorCache.negotiate(header), expected, `should return ${expected} when ${header} and ${supportedEncodings}`) | ||
t.assert.strictEqual(negotiatorCache.negotiate(header), expected, `should return ${expected} when ${header} and ${supportedEncodings}`) | ||
t.assert.strictEqual(negotiatorCache.negotiate(header), expected, `should return ${expected} when ${header} and ${supportedEncodings}`) | ||
}) | ||
} |
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,12 +1,12 @@ | ||
'use strict' | ||
|
||
const test = require('tap').test | ||
const { test } = require('node:test') | ||
const testCases = require('./testCases') | ||
const negotiate = require('../index').negotiate | ||
|
||
for (const [header, supportedEncodings, expected] of testCases) { | ||
test(`should return ${expected} when ${header} and ${supportedEncodings}`, t => { | ||
t.plan(1) | ||
t.equal(negotiate(header, supportedEncodings), expected) | ||
t.assert.strictEqual(negotiate(header, supportedEncodings), expected) | ||
}) | ||
} |