Aktueller Stand
This commit is contained in:
40
backend/node_modules/process-warning/test/index.test.js
generated
vendored
40
backend/node_modules/process-warning/test/index.test.js
generated
vendored
@@ -1,6 +1,6 @@
|
||||
'use strict'
|
||||
|
||||
const test = require('tap').test
|
||||
const { test } = require('node:test')
|
||||
const { createWarning, createDeprecation } = require('..')
|
||||
|
||||
process.removeAllListeners('warning')
|
||||
@@ -13,9 +13,9 @@ test('Create warning with zero parameter', t => {
|
||||
code: 'CODE',
|
||||
message: 'Not available'
|
||||
})
|
||||
t.equal(warnItem.name, 'TestWarning')
|
||||
t.equal(warnItem.message, 'Not available')
|
||||
t.equal(warnItem.code, 'CODE')
|
||||
t.assert.deepStrictEqual(warnItem.name, 'TestWarning')
|
||||
t.assert.deepStrictEqual(warnItem.message, 'Not available')
|
||||
t.assert.deepStrictEqual(warnItem.code, 'CODE')
|
||||
})
|
||||
|
||||
test('Create error with 1 parameter', t => {
|
||||
@@ -26,9 +26,9 @@ test('Create error with 1 parameter', t => {
|
||||
code: 'CODE',
|
||||
message: 'hey %s'
|
||||
})
|
||||
t.equal(warnItem.name, 'TestWarning')
|
||||
t.equal(warnItem.format('alice'), 'hey alice')
|
||||
t.equal(warnItem.code, 'CODE')
|
||||
t.assert.deepStrictEqual(warnItem.name, 'TestWarning')
|
||||
t.assert.deepStrictEqual(warnItem.format('alice'), 'hey alice')
|
||||
t.assert.deepStrictEqual(warnItem.code, 'CODE')
|
||||
})
|
||||
|
||||
test('Create error with 2 parameters', t => {
|
||||
@@ -39,9 +39,9 @@ test('Create error with 2 parameters', t => {
|
||||
code: 'CODE',
|
||||
message: 'hey %s, I like your %s'
|
||||
})
|
||||
t.equal(warnItem.name, 'TestWarning')
|
||||
t.equal(warnItem.format('alice', 'attitude'), 'hey alice, I like your attitude')
|
||||
t.equal(warnItem.code, 'CODE')
|
||||
t.assert.deepStrictEqual(warnItem.name, 'TestWarning')
|
||||
t.assert.deepStrictEqual(warnItem.format('alice', 'attitude'), 'hey alice, I like your attitude')
|
||||
t.assert.deepStrictEqual(warnItem.code, 'CODE')
|
||||
})
|
||||
|
||||
test('Create error with 3 parameters', t => {
|
||||
@@ -52,9 +52,9 @@ test('Create error with 3 parameters', t => {
|
||||
code: 'CODE',
|
||||
message: 'hey %s, I like your %s %s'
|
||||
})
|
||||
t.equal(warnItem.name, 'TestWarning')
|
||||
t.equal(warnItem.format('alice', 'attitude', 'see you'), 'hey alice, I like your attitude see you')
|
||||
t.equal(warnItem.code, 'CODE')
|
||||
t.assert.deepStrictEqual(warnItem.name, 'TestWarning')
|
||||
t.assert.deepStrictEqual(warnItem.format('alice', 'attitude', 'see you'), 'hey alice, I like your attitude see you')
|
||||
t.assert.deepStrictEqual(warnItem.code, 'CODE')
|
||||
})
|
||||
|
||||
test('Creates a deprecation warning', t => {
|
||||
@@ -65,24 +65,24 @@ test('Creates a deprecation warning', t => {
|
||||
code: 'CODE',
|
||||
message: 'hello %s'
|
||||
})
|
||||
t.equal(deprecationItem.name, 'DeprecationWarning')
|
||||
t.equal(deprecationItem.format('world'), 'hello world')
|
||||
t.equal(deprecationItem.code, 'CODE')
|
||||
t.assert.deepStrictEqual(deprecationItem.name, 'DeprecationWarning')
|
||||
t.assert.deepStrictEqual(deprecationItem.format('world'), 'hello world')
|
||||
t.assert.deepStrictEqual(deprecationItem.code, 'CODE')
|
||||
})
|
||||
|
||||
test('Should throw when error code has no name', t => {
|
||||
t.plan(1)
|
||||
t.throws(() => createWarning(), new Error('Warning name must not be empty'))
|
||||
t.assert.throws(() => createWarning(), new Error('Warning name must not be empty'))
|
||||
})
|
||||
|
||||
test('Should throw when error has no code', t => {
|
||||
t.plan(1)
|
||||
t.throws(() => createWarning({ name: 'name' }), new Error('Warning code must not be empty'))
|
||||
t.assert.throws(() => createWarning({ name: 'name' }), new Error('Warning code must not be empty'))
|
||||
})
|
||||
|
||||
test('Should throw when error has no message', t => {
|
||||
t.plan(1)
|
||||
t.throws(() => createWarning({
|
||||
t.assert.throws(() => createWarning({
|
||||
name: 'name',
|
||||
code: 'code'
|
||||
}), new Error('Warning message must not be empty'))
|
||||
@@ -90,7 +90,7 @@ test('Should throw when error has no message', t => {
|
||||
|
||||
test('Cannot set unlimited other than boolean', t => {
|
||||
t.plan(1)
|
||||
t.throws(() => createWarning({
|
||||
t.assert.throws(() => createWarning({
|
||||
name: 'name',
|
||||
code: 'code',
|
||||
message: 'message',
|
||||
|
||||
Reference in New Issue
Block a user